amaxlab/skype-bot-sdk

There is no license information available for the latest version (v0.2.0-alpha) of this package.

PHP SDK for Microsoft skype bot framework

v0.2.0-alpha 2019-05-21 10:57 UTC

This package is not auto-updated.

Last update: 2024-04-18 08:06:11 UTC


README

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