amaxlab / skype-bot-sdk
此包最新版本(v0.2.0-alpha)没有可用的许可证信息。
Microsoft Skype 机器人框架的 PHP SDK
v0.2.0-alpha
2019-05-21 10:57 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-19 09:59:51 UTC
README
Skype 机器人框架 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' ) );