青霉素 / skype-bot-sdk
此包最新版本(v0.1-alpha)没有可用的许可证信息。
Microsoft skype bot 框架的 PHP SDK
v0.1-alpha
2016-12-16 10:19 UTC
Requires
- php: >=5.5
- ext-curl: *
Requires (Dev)
- codeclimate/php-test-reporter: dev-master
This package is not auto-updated.
Last update: 2024-09-28 19:36:40 UTC
README
Skype bot 框架 PHP sdk
如何使用
创建新应用,获取应用 ID 和密码
https://apps.dev.microsoft.com/#/quickstart/skypebot
创建你的机器人
https://dev.botframework.com/bots/new
设置你的机器人的 "消息端点" 为 https://yourdomain/listener.php
安装
composer require penicylline/skype-bot-sdk 或 require_once <vendor_dir>/SkypeBot/autoload.php
初始化机器人
$dataStorate = new \SkypeBot\Storage\FileStorage(sys_get_temp_dir()); $config = new \SkypeBot\Config( 'YOUR SKYPE BOT ID', 'YOUR SKYPE BOT SECRET' ); $bot = \SkypeBot\SkypeBot::init($config, $dataStorate);
在你的通知监听器(listener.php)中
$bot->getNotificationListener()->setMessageHandler( function($payload) { file_put_contents( sys_get_temp_dir() . '/conversation_id.txt', $payload->getConversation()->getId(); ); } );
向会话发送消息
$bot->getApiClient()->call( new \SkypeBot\Command\SendMessage( 'Hello World.', 'Your conversation id' ) );