The Bot Template Framework allows for rapid development of chatbots through templates that describe a chatbot scenario. It uses blocks to define listen and response actions and drivers to configure chatbot platforms. Templates contain blocks for different response types like text, images, menus and drivers for platforms like Facebook, Telegram, and Skype. The framework handles chains of blocks, variables, localization, and integrations with NLP services. Developers simply define the template and drivers and the framework takes care of the implementation.
2. Agenda
➔ What is Bot Template Framework
➔ How to use it
➔ Templates structure
➔ Blocks
➔ Drivers
➔ Example
➔ Links
3. What is Bot Template Framework
A framework for rapid development of chatbots (templates), describing a
chatbot in a scenario file. It’s built on Botman framework. More here:
https://github.com/adellantado/bot-template-framework
What is the problem? You need to write code even for standart things, like
sending an image, asking a simple question or even replying with a simple button,
often you need to write a lot of code. After you need to change the chatbot
behavior and again it means write code. And in final you have the none consistent
scenario which look like a bunch of code.
4. How to use it
All principle is simple, to subscribe your chatbot you need to set up Botman and
before call of listen() method simply put these rows:
$templateEngine = new TemplateEngine(file_get_contents(app_path('template.json')), $botman);
$templateEngine->listen();
Note: In order to use tokens from “drivers” section in Botman, you need to load it
instead of a config:
$config = TemplateEngine::getConfig(file_get_contents(app_path('template.json')));
BotManFactory::create($config);
5. Templates structure
In templates there two main points:
➔ what and how to reply - Blocks section;
➔ and where - Drivers section;
➔ some basic information like: chatbot name, default answer and so on;
6. Blocks
Block is an atomic action, listen => asnwer action. Like listen to “Hi!” =>
respond with “Hello!” and send it as a text.
{
"name":"TestBlock",
"type":"text",
"template":"Hi!",
"content":"Hello!"
}
But often you need to send images, videos, files, buttons, lists or carousels, ask
questions and so on.
Framework’s supported blocks (for now):
text, image, menu, audio, video, file, location, carousel, list, request, ask, intent and method
7. Blocks
Blocks support:
➔ flows: Using “next” field it’s easy to create chains;
➔ save/restore data with variables;
➔ built in variables;
➔ NLP (with dialogflow);
➔ locale;
➔ HTTP requests;
8. Drivers
Simply a setup of a platform which chatbot should work on..
Eg. Telegram driver
{
"name": "Telegram",
"token": "TELEGRAM_TOKEN",
"config": "true"
}
Note: for each configured driver you have to have installed a proper driver with
Botman.
Driver’s supported platforms (for now): Facebook, Telegram, Skype, Dialogflow,
Amazon Alexa