socola/sdk-php-chatfuel-socola
Composer 安装命令:
composer require socola/sdk-php-chatfuel-socola
包简介
class gender json for chatbot facebook chatfuel
README 文档
README
SDK Php Chatfue Socola
Using php to generate JSON for Chatfuel bot
Create bot
use Socola\Chatfuel; $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, $setAttributes = Null);
Create Button To Block
$title = "button to block"; $block = "re-start"; $buttonToBlock = $bot->createButtonToBlock($title, $block, $setAttributes = Null);
Create Button Share
$buttonShare = $bot->createButtonShare();
Create Button Call
$phoneNumber = '096******5'; $buttonCall = $bot->createButtonCall($phoneNumber, $title = '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'; $uttons = [ $buttonToURL, $buttonToBlock, $buttonShare ]; $bot->sendTextCard($text, $button); $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, $button_or_arrayButtons); $arrayElements = array( $element1, $element2 );
Send a gallery
$bot->sendGallery($element_or_arrayElements);
Send a list template min 2 element
You can switch type “top_element_style” between “large” and “compact”.
$topElementStyle = 'large'; $bot->sendList($arrayElements, $topElementStyle);
socola/sdk-php-chatfuel-socola 适用场景与选型建议
socola/sdk-php-chatfuel-socola 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 26 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 02 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 socola/sdk-php-chatfuel-socola 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 socola/sdk-php-chatfuel-socola 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 26
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-04