SlideShare a Scribd company logo
Creating chatbots
with BotMan
Adam Matysiak
CTO / Team Leader
adam@highsolutions.pl
What is chatbot?
Definition:
“A conversational
user interface
used for interaction
with application”
Where we can use it?
- Automatic/interactive deployments
- DevOps
- Sales support (E-commerce)
- Customer service support
- Brand marketing
- Blog/content promotion
- Self-service (e.g. weather forecast, bus timetable etc.)
- Fun
- … ?
Examples
https://highsolutions.pl/blog/wpis/7-zastosowan-chatbota-
o-ktorych-musisz-wiedziec-prowadzac-biznes
The time is now?
“Chatbot Market Size Is About To
Reach $1.25 Billion By 2025”
GrandViewResearch, August 2017
Efficiency
Data source: https://neilpatel.com/blog/open-rates-facebook-messenger
Laravel Poznań Meetup #2 - Creating chatbots with BotMan
BotMan
composer create-project --prefer-dist botman/studio your-awesome-bot
Requirements: PHP >= 7.0
● https://botman.io/ - Documentation / Demo
● https://buildachatbot.io/ - Video course
● https://playground.botman.io/ - On-line IDE
● https://christoph-rumpel.com/build-chatbots-with-php - E-book
Available services
- Amazon Alexa
- Cisco Spark
- Facebook Messenger
- HipChat
- Kik
- Microsoft Bot Framework
- Nexmo
- Slack
- Telegram
- Twilio
- WeChat
How chatbots work
1. Listening 🙉
2. Processing 🌀
3. Responding 📢
How chatbots work
Hear and respond...
File botman.php in routes directory
$botman->hears('Hi', function ($bot) {
$bot->reply('Hello World!');
});
// Process incoming message
$botman->listen();
Sending to controller...
$botman->hears('Hi', 'SomeNamespaceCommandController@respond');
class CommandController {
public function respond($bot) {
$bot->reply('Hello World!');
}
}
Parameters and regular expressions
$botman->hears('I like {team}', function ($bot, $team) {
$bot->reply('You like: '. $team);
});
$botman->hears('.*(hi|hey|hello).*', function ($bot) {
$bot->reply('Hello World!');
});
$botman->hears('I want to buy ([0-9]+) tickets', function ($bot, $number) {
$bot->reply('I am ordering ’. $number .’ tickets for you!’);
});
Attachments (images, videos, localization etc.)
$bot->receivesImages(function($bot, $images) {
foreach ($images as $image) {
$url = $image->getUrl(); // The direct url
$title = $image->getTitle(); // The title, if available
$payload = $image->getPayload(); // The original payload
}
});
Responding
$botman->hears('Hi!', function (BotMan $bot) {
$bot->reply("Foo");
$bot->reply("Bar");
$bot->typesAndWaits(2); // It shows typing icon for 2 seconds...
$bot->reply("Baz!");
});
Responding with an image
use BotManBotManMessagesAttachmentsImage;
use BotManBotManMessagesOutgoingOutgoingMessage;
$botman->hears('Show me your logo', function (BotMan $bot) {
// Create attachment
$attachment = new Image('https://highsolutions.pl/images/logo-image.png');
// Build message object
$message = OutgoingMessage::create('Our logo')
->withAttachment($attachment);
// Reply message object
$bot->reply($message);
});
Conversations
$botman->hears('I want to create an account', function($bot) {
$bot->startConversation(new AccountRegisterConversation);
});
Conversations
class AccountRegisterConversation extends Conversation
{
protected $name;
protected $email;
public function run()
{
$this->askName();
}
public function askName()
{
$this->ask('What is your name?', function(Answer $answer) {
$this->name = $answer->getText();
$this->say('Nice to meet you, '. $this->name);
$this->askEmail();
});
}
public function askEmail()
{
$this->ask('Please provide your e-mail address:', function(Answer $answer) {
$this->email = $answer->getText();
// ... sending e-mail
$this->say('Thank you. We send confirmation e-mail to: '. $this->email);
});
}
}
Questions
public function askWhoWillWinNextMatch()
{
$this->ask('Who will win next match?', function (Answer $response) {
$this->say('Great, your answer is - ' . $response->getText());
});
}
Questions with predefined options
public function askForNextMatchWinner()
{
$question = Question::create('Who will win next match?')
->fallback(“Can’t say...”)
->callbackId('who_will_win_next_match')
->addButtons([
Button::create('Team A')->value('a'),
Button::create('Team B')->value('b'),
]);
$this->ask($question, function (Answer $answer) {
// Detect if button was clicked:
if ($answer->isInteractiveMessageReply()) {
$selectedValue = $answer->getValue(); // will be either 'a' or 'b'
$selectedText = $answer->getText(); // will be either 'Team A' or 'Team B'
}
});
}
Questions with patterns
public function askWhoWillWinNextMatch()
{
$this->ask('Who will win next match? [Real - Barca]', [
[
'pattern' => 'real|madrid|hala',
'callback' => function () {
$this->say('In Cristiano you trust!');
}
],
[
'pattern' => 'barca|barcelona|fcb',
'callback' => function () {
$this->say('In Messi you trust!');
}
]
]);
}
User information
/**
* Retrieve User information.
* @param IncomingMessage $matchingMessage
* @return UserInterface
*/
public function getUser(IncomingMessage $matchingMessage)
{
return new User($matchingMessage->getSender());
}
// Access user
$user = $bot->getUser();
Cache
$storage = $botman->userStorage();
$storage = $botman->channelStorage();
$storage = $botman->driverStorage();
$bot->userStorage()->save([
'name' => $name
]);
$bot->userStorage()->all();
$userInformation = $bot->userStorage()->find($id);
$name = $userInformation->get('name');
$bot->userStorage()->delete();
NLP
Hey, I am going to match Real - Barca on Sunday at 15:00 with Suzy.
{
"intent": "create_meeting",
"entities": {
"name" : "Match Real - Barca",
"invitees" : [‘Suzy’],
"time": "2017-03-11 15:00:00"
}
}
Middleware
Testing
/** @test */
public function test_simple_reply()
{
$this->bot
->receives('Hi')
->assertReply('Hello World!');
}
/** @test */
public function test_image_reply()
{
$this->bot
->receivesImage(['https://highsolutions.pl/images/logo-image.png'])
->assertReply('This is our logo!');
}
Testing
/** @test */
public function test_conversation()
{
$this->bot
->receives('Hi')
->assertReplies([
'Foo',
'Bar',
])->receives('And?')
->assertReply('Baz');
}
Web driver
Web widget
NLP model
Laravel Poznań Meetup #2 - Creating chatbots with BotMan
Messenger / Button Template
$bot->reply(ButtonTemplate::create('How do you like BotMan so far?')
->addButton(ElementButton::create('Quite good')->type('postback')->payload('quite-good'))
->addButton(ElementButton::create('Love it!')->url('https://botman.io'))
);
Messenger / Generic Template
$bot->reply(GenericTemplate::create()
->addElements([
Element::create('BotMan Documentation')
->subtitle('All about BotMan')
->image('http://botman.io/img/botman-body.png')
->addButton(ElementButton::create('visit')
->url('http://botman.io')
)
->addButton(ElementButton::create('tell me more')
->payload('tellmemore')
->type('postback')
),
Element::create('BotMan Laravel Starter')
->subtitle('This is the best way to start...')
->image('http://botman.io/img/botman-body.png')
->addButton(ElementButton::create('visit')
->url('https://github.com/botman/botman')
),
])
);
Messenger / List Template
$bot->reply(ListTemplate::create()
->useCompactView()
->addGlobalButton(ElementButton::create('view more')->url('http://buildachatbot.io'))
->addElement(
Element::create('BotMan Documentation')
->subtitle('All about BotMan')
->image('http://botman.io/img/botman-body.png')
->addButton(ElementButton::create('tell me more')
->payload('tellmemore')->type('postback'))
)
->addElement(
Element::create('BotMan Laravel Starter')
->subtitle('This is the best way to start...')
->image('http://botman.io/img/botman-body.png')
->addButton(ElementButton::create('visit')
->url('http://botman.io')
)
)
);
Messenger / Media Template
$bot->reply(MediaTemplate::create()
->element(MediaAttachmentElement::create('image')
->addButton(ElementButton::create('Tell me more')
->type('postback')
->payload('Tell me more'))
->addButton(ElementButton::create('Documentation')
->url('https://botman.io/'))));
Messenger Demo Viewer
Questions?
adam@highsolutions.pl
@AdamMatysiak
chatbot.highsolutions.pl

More Related Content

PDF
EmberConf 2015 – Ambitious UX for Ambitious Apps
PDF
AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)
PPTX
Laravel ua chatbot
PDF
Clustaar chatbot intervention for Crédit Agricole 19/05/2017
PDF
IRJET - A Study on Building a Web based Chatbot from Scratch
PDF
Oyoty - Lessons learnt building a “chatbot” for children
PPTX
Using Chatbots in Extension Programming
PDF
The PHP developer stack for building chatbots | Christoph Rumpel | CODEiD
EmberConf 2015 – Ambitious UX for Ambitious Apps
AngularJS: The Bridge Between Today and Tomorrow's Web (Todd Motto)
Laravel ua chatbot
Clustaar chatbot intervention for Crédit Agricole 19/05/2017
IRJET - A Study on Building a Web based Chatbot from Scratch
Oyoty - Lessons learnt building a “chatbot” for children
Using Chatbots in Extension Programming
The PHP developer stack for building chatbots | Christoph Rumpel | CODEiD

Similar to Laravel Poznań Meetup #2 - Creating chatbots with BotMan (20)

PPTX
Isa632 final-presentation
PDF
PDF
chatbots.pdf
PPTX
Chatbots: It's like Uber for Conversations
DOCX
A Comprehensive Overview of Chatbot Development_ Tools and Best Practices.docx
PPTX
Building bots to automate common developer tasks - Writing your first smart c...
PDF
Chatbots for Brand Representation in Comparison with Traditional Websites
PDF
Chatler.ai Országos Ügyfélszolgálati Konferencia, 2017 Sümeg
PPTX
Banking Chatbot
PDF
Build powerful AI chatbots effortlessly with chatbot builder
 
DOCX
DEEPESH KUSHWAH PROJECT 3rd sem 1.docx
PDF
A concise guide to chatbots
PDF
The rise of Chatbots and Virtual Assistants in Customer Experience
PPTX
Chatbot Abstract
PDF
antraaa-181127090143.pdf
PDF
All You Need To Know About Chatbot Development.pdf
PPTX
virtual-2021-data.sql_.saturday.la-Building database interactions with users ...
PDF
GSoC 2017 Proposal - Chatbot for DBpedia
PPTX
Final presentation on chatbot
PDF
E.D.D.I - 6 Years of Chatbot Development Experience in one Open Source Chatbo...
Isa632 final-presentation
chatbots.pdf
Chatbots: It's like Uber for Conversations
A Comprehensive Overview of Chatbot Development_ Tools and Best Practices.docx
Building bots to automate common developer tasks - Writing your first smart c...
Chatbots for Brand Representation in Comparison with Traditional Websites
Chatler.ai Országos Ügyfélszolgálati Konferencia, 2017 Sümeg
Banking Chatbot
Build powerful AI chatbots effortlessly with chatbot builder
 
DEEPESH KUSHWAH PROJECT 3rd sem 1.docx
A concise guide to chatbots
The rise of Chatbots and Virtual Assistants in Customer Experience
Chatbot Abstract
antraaa-181127090143.pdf
All You Need To Know About Chatbot Development.pdf
virtual-2021-data.sql_.saturday.la-Building database interactions with users ...
GSoC 2017 Proposal - Chatbot for DBpedia
Final presentation on chatbot
E.D.D.I - 6 Years of Chatbot Development Experience in one Open Source Chatbo...
Ad

More from HighSolutions Sp. z o.o. (19)

PDF
Laravel Poland Meetup #22 - "Kilka slajdów o castowaniu atrybutów w Eloquent"
PDF
Laravel Poznań Meetup #16 - "Action-based Laravel"
PDF
Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ...
PDF
Laravel Poznań Meetup #12 - "Laravel 6.0 - co nowego?"
PDF
Dni Kariery - "Turkusowe organizacje. Nowoczesny styl zarządzania"
PDF
Laravel Poznań Meetup #8 - "Laravel czy lumen, oto jest pytanie"
PDF
Laravel Poznań Meetup #8 - "Laravel Telescope - niezastąpione narzędzie do de...
PDF
Laravel Poznań Meetup #7 - "Praktyczne użycie Repository Pattern w Laravel cz...
PDF
Laravel Poznań Meetup #7 - "PWA - Progressive Web App"
PDF
Laravel Poznań Meetup #7 - "Laravel nova - czy to się w ogóle opłaca"
PDF
Laravel Poznań Meetup #6 - "Nowości w Laravel 5.7"
PPTX
Laravel Poznań Meetup #4 - EloquentSequence - Historia pewnej biblioteki Open...
PPTX
Laravel Poznań Meetup #3 - Uruchomienie i praca z Laravel w wirtualnym konten...
PPTX
How business and IT should cooperate with each other to verify business model...
PPTX
Jak Biznes i IT powinny współpracować ze sobą by zweryfikować model biznesowy...
PDF
Laravel Poznań Meetup #2 - Koniec CSS? Jest Tailwind!
PPTX
Laravel Poznań Meetup #2 - Wykorzystanie FormRequest w Laravelu
PPTX
Laravel Poznań Meetup #2 - Tworzenie chatbotów z BotMan
PPTX
Jak błędów unikać prowadząc własną firmę i jak ją rozwijać
Laravel Poland Meetup #22 - "Kilka slajdów o castowaniu atrybutów w Eloquent"
Laravel Poznań Meetup #16 - "Action-based Laravel"
Laravel Poznań Meetup #12 - "Speed up web API with Laravel and Swoole using ...
Laravel Poznań Meetup #12 - "Laravel 6.0 - co nowego?"
Dni Kariery - "Turkusowe organizacje. Nowoczesny styl zarządzania"
Laravel Poznań Meetup #8 - "Laravel czy lumen, oto jest pytanie"
Laravel Poznań Meetup #8 - "Laravel Telescope - niezastąpione narzędzie do de...
Laravel Poznań Meetup #7 - "Praktyczne użycie Repository Pattern w Laravel cz...
Laravel Poznań Meetup #7 - "PWA - Progressive Web App"
Laravel Poznań Meetup #7 - "Laravel nova - czy to się w ogóle opłaca"
Laravel Poznań Meetup #6 - "Nowości w Laravel 5.7"
Laravel Poznań Meetup #4 - EloquentSequence - Historia pewnej biblioteki Open...
Laravel Poznań Meetup #3 - Uruchomienie i praca z Laravel w wirtualnym konten...
How business and IT should cooperate with each other to verify business model...
Jak Biznes i IT powinny współpracować ze sobą by zweryfikować model biznesowy...
Laravel Poznań Meetup #2 - Koniec CSS? Jest Tailwind!
Laravel Poznań Meetup #2 - Wykorzystanie FormRequest w Laravelu
Laravel Poznań Meetup #2 - Tworzenie chatbotów z BotMan
Jak błędów unikać prowadząc własną firmę i jak ją rozwijać
Ad

Recently uploaded (20)

PDF
5 Lead Qualification Frameworks Every Sales Team Should Use
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Mini project ppt template for panimalar Engineering college
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
L1 - Introduction to python Backend.pptx
PDF
AI in Product Development-omnex systems
PPTX
Introduction to Artificial Intelligence
PPTX
Materi-Enum-and-Record-Data-Type (1).pptx
PPTX
CRUISE TICKETING SYSTEM | CRUISE RESERVATION SOFTWARE
PDF
Understanding Forklifts - TECH EHS Solution
PDF
medical staffing services at VALiNTRY
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
A REACT POMODORO TIMER WEB APPLICATION.pdf
PPTX
Materi_Pemrograman_Komputer-Looping.pptx
PDF
top salesforce developer skills in 2025.pdf
5 Lead Qualification Frameworks Every Sales Team Should Use
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Mini project ppt template for panimalar Engineering college
VVF-Customer-Presentation2025-Ver1.9.pptx
L1 - Introduction to python Backend.pptx
AI in Product Development-omnex systems
Introduction to Artificial Intelligence
Materi-Enum-and-Record-Data-Type (1).pptx
CRUISE TICKETING SYSTEM | CRUISE RESERVATION SOFTWARE
Understanding Forklifts - TECH EHS Solution
medical staffing services at VALiNTRY
How Creative Agencies Leverage Project Management Software.pdf
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
A REACT POMODORO TIMER WEB APPLICATION.pdf
Materi_Pemrograman_Komputer-Looping.pptx
top salesforce developer skills in 2025.pdf

Laravel Poznań Meetup #2 - Creating chatbots with BotMan

  • 3. What is chatbot? Definition: “A conversational user interface used for interaction with application”
  • 4. Where we can use it? - Automatic/interactive deployments - DevOps - Sales support (E-commerce) - Customer service support - Brand marketing - Blog/content promotion - Self-service (e.g. weather forecast, bus timetable etc.) - Fun - … ?
  • 6. The time is now? “Chatbot Market Size Is About To Reach $1.25 Billion By 2025” GrandViewResearch, August 2017
  • 9. BotMan composer create-project --prefer-dist botman/studio your-awesome-bot Requirements: PHP >= 7.0 ● https://botman.io/ - Documentation / Demo ● https://buildachatbot.io/ - Video course ● https://playground.botman.io/ - On-line IDE ● https://christoph-rumpel.com/build-chatbots-with-php - E-book
  • 10. Available services - Amazon Alexa - Cisco Spark - Facebook Messenger - HipChat - Kik - Microsoft Bot Framework - Nexmo - Slack - Telegram - Twilio - WeChat
  • 11. How chatbots work 1. Listening 🙉 2. Processing 🌀 3. Responding 📢
  • 13. Hear and respond... File botman.php in routes directory $botman->hears('Hi', function ($bot) { $bot->reply('Hello World!'); }); // Process incoming message $botman->listen();
  • 14. Sending to controller... $botman->hears('Hi', 'SomeNamespaceCommandController@respond'); class CommandController { public function respond($bot) { $bot->reply('Hello World!'); } }
  • 15. Parameters and regular expressions $botman->hears('I like {team}', function ($bot, $team) { $bot->reply('You like: '. $team); }); $botman->hears('.*(hi|hey|hello).*', function ($bot) { $bot->reply('Hello World!'); }); $botman->hears('I want to buy ([0-9]+) tickets', function ($bot, $number) { $bot->reply('I am ordering ’. $number .’ tickets for you!’); });
  • 16. Attachments (images, videos, localization etc.) $bot->receivesImages(function($bot, $images) { foreach ($images as $image) { $url = $image->getUrl(); // The direct url $title = $image->getTitle(); // The title, if available $payload = $image->getPayload(); // The original payload } });
  • 17. Responding $botman->hears('Hi!', function (BotMan $bot) { $bot->reply("Foo"); $bot->reply("Bar"); $bot->typesAndWaits(2); // It shows typing icon for 2 seconds... $bot->reply("Baz!"); });
  • 18. Responding with an image use BotManBotManMessagesAttachmentsImage; use BotManBotManMessagesOutgoingOutgoingMessage; $botman->hears('Show me your logo', function (BotMan $bot) { // Create attachment $attachment = new Image('https://highsolutions.pl/images/logo-image.png'); // Build message object $message = OutgoingMessage::create('Our logo') ->withAttachment($attachment); // Reply message object $bot->reply($message); });
  • 19. Conversations $botman->hears('I want to create an account', function($bot) { $bot->startConversation(new AccountRegisterConversation); });
  • 20. Conversations class AccountRegisterConversation extends Conversation { protected $name; protected $email; public function run() { $this->askName(); } public function askName() { $this->ask('What is your name?', function(Answer $answer) { $this->name = $answer->getText(); $this->say('Nice to meet you, '. $this->name); $this->askEmail(); }); } public function askEmail() { $this->ask('Please provide your e-mail address:', function(Answer $answer) { $this->email = $answer->getText(); // ... sending e-mail $this->say('Thank you. We send confirmation e-mail to: '. $this->email); }); } }
  • 21. Questions public function askWhoWillWinNextMatch() { $this->ask('Who will win next match?', function (Answer $response) { $this->say('Great, your answer is - ' . $response->getText()); }); }
  • 22. Questions with predefined options public function askForNextMatchWinner() { $question = Question::create('Who will win next match?') ->fallback(“Can’t say...”) ->callbackId('who_will_win_next_match') ->addButtons([ Button::create('Team A')->value('a'), Button::create('Team B')->value('b'), ]); $this->ask($question, function (Answer $answer) { // Detect if button was clicked: if ($answer->isInteractiveMessageReply()) { $selectedValue = $answer->getValue(); // will be either 'a' or 'b' $selectedText = $answer->getText(); // will be either 'Team A' or 'Team B' } }); }
  • 23. Questions with patterns public function askWhoWillWinNextMatch() { $this->ask('Who will win next match? [Real - Barca]', [ [ 'pattern' => 'real|madrid|hala', 'callback' => function () { $this->say('In Cristiano you trust!'); } ], [ 'pattern' => 'barca|barcelona|fcb', 'callback' => function () { $this->say('In Messi you trust!'); } ] ]); }
  • 24. User information /** * Retrieve User information. * @param IncomingMessage $matchingMessage * @return UserInterface */ public function getUser(IncomingMessage $matchingMessage) { return new User($matchingMessage->getSender()); } // Access user $user = $bot->getUser();
  • 25. Cache $storage = $botman->userStorage(); $storage = $botman->channelStorage(); $storage = $botman->driverStorage(); $bot->userStorage()->save([ 'name' => $name ]); $bot->userStorage()->all(); $userInformation = $bot->userStorage()->find($id); $name = $userInformation->get('name'); $bot->userStorage()->delete();
  • 26. NLP Hey, I am going to match Real - Barca on Sunday at 15:00 with Suzy. { "intent": "create_meeting", "entities": { "name" : "Match Real - Barca", "invitees" : [‘Suzy’], "time": "2017-03-11 15:00:00" } }
  • 28. Testing /** @test */ public function test_simple_reply() { $this->bot ->receives('Hi') ->assertReply('Hello World!'); } /** @test */ public function test_image_reply() { $this->bot ->receivesImage(['https://highsolutions.pl/images/logo-image.png']) ->assertReply('This is our logo!'); }
  • 29. Testing /** @test */ public function test_conversation() { $this->bot ->receives('Hi') ->assertReplies([ 'Foo', 'Bar', ])->receives('And?') ->assertReply('Baz'); }
  • 34. Messenger / Button Template $bot->reply(ButtonTemplate::create('How do you like BotMan so far?') ->addButton(ElementButton::create('Quite good')->type('postback')->payload('quite-good')) ->addButton(ElementButton::create('Love it!')->url('https://botman.io')) );
  • 35. Messenger / Generic Template $bot->reply(GenericTemplate::create() ->addElements([ Element::create('BotMan Documentation') ->subtitle('All about BotMan') ->image('http://botman.io/img/botman-body.png') ->addButton(ElementButton::create('visit') ->url('http://botman.io') ) ->addButton(ElementButton::create('tell me more') ->payload('tellmemore') ->type('postback') ), Element::create('BotMan Laravel Starter') ->subtitle('This is the best way to start...') ->image('http://botman.io/img/botman-body.png') ->addButton(ElementButton::create('visit') ->url('https://github.com/botman/botman') ), ]) );
  • 36. Messenger / List Template $bot->reply(ListTemplate::create() ->useCompactView() ->addGlobalButton(ElementButton::create('view more')->url('http://buildachatbot.io')) ->addElement( Element::create('BotMan Documentation') ->subtitle('All about BotMan') ->image('http://botman.io/img/botman-body.png') ->addButton(ElementButton::create('tell me more') ->payload('tellmemore')->type('postback')) ) ->addElement( Element::create('BotMan Laravel Starter') ->subtitle('This is the best way to start...') ->image('http://botman.io/img/botman-body.png') ->addButton(ElementButton::create('visit') ->url('http://botman.io') ) ) );
  • 37. Messenger / Media Template $bot->reply(MediaTemplate::create() ->element(MediaAttachmentElement::create('image') ->addButton(ElementButton::create('Tell me more') ->type('postback') ->payload('Tell me more')) ->addButton(ElementButton::create('Documentation') ->url('https://botman.io/'))));