Created
August 5, 2024 13:18
-
-
Save Cosmologist/5af203ff4ce0d53f0f4c28b16e95e296 to your computer and use it in GitHub Desktop.
Simple Skype-bot to post messages to the Skype chat
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
<?php | |
/** | |
* Simple Skype-bot to post messages to the Skype chat | |
* | |
* <code> | |
* composer require "botman/botman" "botman/driver-botframework" | |
* </code> | |
* | |
* https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-quickstart?view=azure-bot-service-4.0 | |
* | |
* 1. Register bot in Azure - get app_id and app_key | |
* 2. Enable support of groups for the bot | |
* 3. Set HTTP-endpoint URL (webhook callback) | |
* 4. Access to the bot trough Skype to receive serviceUrl and conversationId via webhook (see 3) | |
* 5. Add a bot to the Skype-group | |
* 6. Start conversation with bot (without bot publication) - https://join.skype.com/bot/bot-id | |
* 7. How to add bot to a group (without bot publication) - https://stackoverflow.com/questions/41509631/skype-bot-can-not-be-added-to-group-chat | |
*/ | |
$config = [ | |
"botframework" => [ | |
"app_id" => "b0b89c1sdfgfdsg284sdfgdff2e831", | |
"app_key" => "mtjHsdfgsdfyrQPI79", | |
] | |
]; | |
$driver = new BotFrameworkDriver(Request::createFromGlobals(), $config, new Curl()); | |
$bot = BotManFactory::create($config); | |
$bot->setDriver($driver); | |
$bot->say( | |
'Hello!', | |
'19:2e67fdsgfsdgs635besdfgf8df@thread.skype', // conversation.id from HTTP-callback | |
$driver, | |
['serviceUrl' => 'https://smba.trafficmanager.net/apis/'] // serviceUrl from HTTP-callback | |
); | |
@Cosmologist | |
Comment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment