Skip to content

penicylline/skype-bot-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

skype-bot-sdk

Skype bot framework PHP sdk

Build Status Code Climate Test Coverage Issue Count

How to use

Create new application, get app id and app password

https://apps.dev.microsoft.com/#/quickstart/skypebot

Create your bot

https://dev.botframework.com/bots/new

Set your bot's "Messaging endpoint" to https://yourdomain/listener.php

Installation

composer require penicylline/skype-bot-sdk or require_once <vendor_dir>/SkypeBot/autoload.php

Initialize bot

$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);

In your notification listener (listener.php)

$bot->getNotificationListener()->setMessageHandler(
    function($payload) {
        file_put_contents(
            sys_get_temp_dir() . '/conversation_id.txt',
            $payload->getConversation()->getId();
        );
    }
);

Send message to conversation

$bot->getApiClient()->call(
    new \SkypeBot\Command\SendMessage(
        'Hello World.',
        'Your conversation id'
    )
);