BotMan acquaintance

I want to talk about the PHP framework for creating BotMan bots ( Website ). Botman can be used both as a library and as an extension Laravel (BotMan Studio).

The advantage of this framework is that the code for the bot can work for a variety of platforms:

  • Amazon Alexa
  • Cisco Spark
  • Facebook messenger
  • Hangouts chat
  • HipChat
  • Microsoft Bot Framework
  • Nexmo
  • Slack
  • Telegram
  • Twilio
  • Web
  • WeChat
  • VK

Code example:

$botman->hears('Hello BotMan!', function($bot){
    $bot->ask('Whats your name?', function($answer, $bot){
        $bot->say('Welcome '.$answer->getText());


Install BotMan Studio

Create a new project in the botman folder:

composer create-project --prefer-dist botman/studio botman

You can check the operation via the command line:

$ php artisan botman:tinker
You: test
BotMan: hello!

Or check through the browser. Run the test server:

php artisan serve
Laravel development server started: <>

Open the browser : 8000 / botman / tinker

and write hi or start conversation for verification.

How to create a bot for a telegram?

The first step is to register the bot with @BotFather.

All bot is registered and we have a token.

The first step is to install the telegram driver:

composer require botman/driver-telegram

Option A, if you use BotMan Studio:

php artisan botman:install-driver telegram

In file


add your telegram token

'telegram' => [

Option B, if you do not use BotMan Studio:

// Create BotMan instance

We register Webhook in Telegram

In order for Telegram to know how it can communicate with your BotMan bot, you need to register the URL that BotMan works with in Telegram.

You can do this by sending a POST request to this URL:<YOUR-TELEGRAM-TOKEN-HERE>/setWebhook

This POST request requires only one url parameter with a URL pointing to the BotMan route. If you use Botman Studio, it will be:


HTTPS is required for security reasons.

Instead of manually sending a request to Telegram, you can use the console command to register your Webhook. You can pass the --output flag to see the json Telegram response.

$ php artisan botman:telegram:register

Good luck everyone. Make bots.

Also popular now: