PHP code example of polyskalov / botman-viber-driver

1. Go to this page and download the library: Download polyskalov/botman-viber-driver library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

polyskalov / botman-viber-driver example snippets


DriverManager::loadDriver(\TheArdent\Drivers\Viber\ViberDriver::class);

// Create BotMan instance
BotManFactory::create($config);



/** @var \BotMan\BotMan\BotMan $botman */
$botman = resolve('botman');

$botman->on(
    'conversation_started',
    static function (array $payload, BotMan $bot) {
        $bot->reply('Hi, ' . $bot->getUser()->getUsername());
    }
);

$botman->hears('hi', static function (BotMan $bot) {
    $bot->reply('👋');
});

$botman->fallback(static function (BotMan $bot) {
    $bot->reply('I do not understand');
});

$botman->listen();
 php artisan botman:viber:register