/bot-php-sdk

Soroush Messenger Bot Wrapper for PHP

Primary LanguagePHPMIT LicenseMIT

Soroush Messenger Bot PHP SDK

Soroush Messenger Bot Wrapper for PHP

Dependencies

  • PHP 5.6+
  • JSON Extension (php-json)
  • cURL Extension (php-curl)

Installation

Run the below commands

git clone https://github.com/soroush-app/bot-php-sdk
cd bot-php-sdk
composer install

Usage

require dirname(__FILE__) . '/vendor/autoload.php';

$bot_token = 'your-bot-token';
$bot = new Soroush\Client($bot_token);
try {
    $to = 'bot user id';
    list($error, $success) = $bot->sendText($to, 'Sample text');
    if($success) {
        echo 'Message sent successfully' . PHP_EOL;
    } else {
        echo 'Fail : ' . $error. PHP_EOL;
    }
} catch (Exception $e) {
    die($e->getMessage());
}

More examples are in the examples folder.

Contribute

Contributions to the package are always welcome!