Bot Template Framework. First look.

With the emergence and growing popularity of the chatbots, the frequent question you may hear is “What tool to use when developing a chatbot?” The short answer is the one that suits your needs the most. One way is to use platforms (such as Chatfuel or Manychat), the second is to develop your own application. With the first experience, we have big restrictions on the scaling and improvement of the bot, and during the second experience, we lose the flexibility of setting up the chatbot in the visual editor and often lose valuable time writing bot scenario directly in the code. In Beedevs, we do not describe chatbot texts directly in the code. For these purposes, we use the Bot Template Framework. This is a framework that allows you to negate the disadvantages of the second approach, simplifying and reducing the time for describing a chatbot script to a minimum. How to use the framework? Let’s take a look..

Learn more about Graphical Components in the next part.

Writing a simple Hello World bot

Scenario description of the chatbot on the Bot Template Framework begins with the creation of a json file with the initial fields.

Now we need to add a new block to the “blocks” section. A block is one message that will send a chatbot on a specific event, it can be a text, a picture, a file, or a button menu. In total, the framework has 17 types of blocks:

text, image, menu, audio, video, file, location, attachment, carousel, list, request, ask, intent, if, method, extend, idle

We also need to add a new driver to the “drivers” section. A driver is a platform setting on which our bot will work. At the time of this writing, the Bot Template Framework supports 6 drivers:

Facebook, Telegram, Viber, Skype, Dialogflow, Alexa

For demonstration purposes, we will make a chatbot on Telegram. Therefore, we describe our driver

And add a text block that returns “Hello World!”

As you can see, we put the chatbot’s answer in “content”. You must specify the type of block – “text”.

The whole chatbot scenario looks like this:

If we now go to our chatbot, it will not answer anything, why? Because there is no event that determines when the block “My First Text Block” should be sent. Therefore, we will add a “template” field with the keywords which the chatbot will respond. For example, add ‘hi’, as well as ‘/start’ (this is the command that Telegram sends when starting a chat). So:

Let’s check out the result of the work:

Bot Template Framework, the very first bot

Everything is working fine. Now let’s complicate the task and send the next message with a picture and a button with the link to our blog.

Image block in the Bot Template Framework

We will describe a new block with a picture and a button (it’s good that the “image” block supports buttons).

As previously mentioned, the block needs an event at which the Bot Template Framework will send it to the chat. But this time, add our block to the queue as a second message after “Hello World!”. To do this, add the “next” field to the first block with the name of the second block – “My Second Image Block”. And so, the full chatbot scenario:

Now let’s test out our chatbot:

Bot Template Framework example of using image block

As you can see everything is working fine. In the next article, we will try the more advanced features of the framework.

Conclusion

Bot Template Framework is a simple tool for describing a chatbot scenario in a text file without any programming skills. The framework supports several platforms, to utilize which it’s enough to add a description of the new driver and … Voila, we have a new chatbot for Facebook or Viber.

Leave a Reply

Your email address will not be published. Required fields are marked *