-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db8fbfc
commit 538b88b
Showing
3 changed files
with
138 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/vendor/ | ||
test.php | ||
/test/ | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
// require_once __DIR__ . '/' . '../src/socola/Chatfuel.php'; | ||
// // Chatfuel::sendText("ádas"); | ||
// $bot = new Chatfuel(); | ||
|
||
|
||
// print_r($_SERVER); | ||
require_once __DIR__ . '/' . 'vendor/autoload.php'; | ||
use Socola\Chatfuel; | ||
## Create bot | ||
$bot = new Chatfuel(); | ||
|
||
## Send text | ||
$text = 'Socola'; | ||
$texts = [$text, $text, $text, $text]; | ||
$bot->sendText($text); | ||
$bot->sendText($texts); | ||
|
||
## Send image | ||
$image = 'http://i.imgur.com/luWlRwV.jpg'; | ||
$images = [ | ||
'http://i.imgur.com/luWlRwV.jpg', | ||
'http://i.imgur.com/luWlRwV.jpg' | ||
]; | ||
$bot->sendImage($image); | ||
$bot->sendImage($images); | ||
|
||
## Send file | ||
$file = 'https://01b02091.ngrok.io/test.pdf'; | ||
$files = array( | ||
'https://01b02091.ngrok.io/test.pdf', | ||
'https://01b02091.ngrok.io/test.pdf' | ||
); | ||
$bot->sendFile($file); | ||
$bot->sendFile($files); | ||
|
||
## Send audio | ||
$audio = 'https://01b02091.ngrok.io/test.mp3'; | ||
$audios = [ | ||
'https://01b02091.ngrok.io/test.mp3', | ||
'https://01b02091.ngrok.io/test.mp3' | ||
]; | ||
$bot->sendAudio($audio); | ||
$bot->sendAudio($audios); | ||
|
||
## Create a button | ||
### Create Button To URL | ||
$title = "button to url"; | ||
$url = "http://www.facebook.com"; | ||
$buttonToURL = $bot->createButtonToURL($title, $url, Null); | ||
|
||
### Create Button To Block | ||
$title = "button to block"; | ||
$block = "re-start"; | ||
$buttonToBlock = $bot->createButtonToBlock($title, $block, Null); | ||
|
||
### Create Button Share | ||
$buttonShare = $bot->createButtonShare(); | ||
|
||
### Create Button Call | ||
$phoneNumber = '096******5'; | ||
$buttonCall = $bot->createButtonCall($phoneNumber, 'Call'); | ||
|
||
### Create Button Quick Reply | ||
$block = 're-start'; | ||
$blocks = [ | ||
'play', | ||
'pause' | ||
]; | ||
$bot->createButtonQuickReply($title, $block); | ||
$bot->createButtonQuickReply($title, $blocks); | ||
|
||
|
||
### Send a text card with one or more button (max 3 buttons) | ||
$text = 'this is text card'; | ||
$buttons = [ | ||
$buttonToURL, | ||
$buttonToBlock, | ||
$buttonShare | ||
]; | ||
$bot->sendTextCard($text, $buttonToURL); | ||
$bot->sendTextCard($text, $buttons); | ||
|
||
|
||
### Create element | ||
$title = 'this is element'; | ||
$image = 'http://i.imgur.com/luWlRwV.jpg'; | ||
$subTitle = 'this is sub title'; | ||
$element = $bot->createElement($title, $image, $subTitle, $buttonToURL); | ||
$elements = [$element, $element]; | ||
$bot->sendGallery($element); | ||
### Send a list template min 2 element | ||
$topElementStyle = 'large'; | ||
$bot->sendList($elements, $topElementStyle); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters