We live in a rapidly changing world. Several months ago messenger bots topic was a taboo. But right now most of the messaging platforms like Facebook or Telegram already have bots in their ecosystem or planning to have them. Surprising, right?

It is very difficult to predict the future of the bots. Currently there are a few messiahs and the same amount of skeptics. Thus I want to look at the main factors, which made the bots so popular.

 

Premises

1. Decline of Application Platforms

The first fact is that application distribution platforms are not very popular anymore. As a result, companies that were focused on mobile application development are trying to find/create new ways to acquire new users and enlarge their audience. This situation does not help to enlarge messenger bots industry directly but increases the potential of all other industries in general.

2. Messengers boom

The second fact is that anyone likes to talk, share thoughts and emotions. As a result top ten messengers in the world have over 5 billion users in total. There are some duplicates for sure, but if we sum up all the other messaging platforms and drop duplicates – I am sure we will get even larger number. Finally, businesses ask themselves: “If there are so many people using messaging apps, why should we try to pull them to our website? It will be more efficient to make a deal right in the messaging app!”.

3. Price factor

The third fact is that large web applications are pricey. Your development team should support a bunch of browsers, design new pages, make A/B tests, upgrade UI, write JS, use CDN, etc. Making an online store requires significant effort.

In case of a bot application you do not have to bother about the UI. You should not design it, you should not support different browsers, you should not even thing about content delivery network! User gets a super easy interaction with basic interface (and craigslist proves that simple interface works very good even nowadays). Nothing more. This way businesses can lower their expenses and invest the difference into other fields.

This is pretty enough to change bots status from taboo to a new highly progressive feature. From that point of view the whole situation looks bright and shiny. But many mature businesses are still waiting and trying to understand “should I make yet another bot or not?”. To answer that question we have to check the dark sides and restrictions.

 

Restrictions

The first vital restriction is a simple interface. This fact is on the surface, but developers and business owners tend to miss it still. That’s why you should not even think about your own bot if you have complex business logic and user interactions inside your application. Just imagine how will you work with a CRM bot. Scared? I am.

Nevertheless, you can use bot as a secondary system in your application (e.g. notification system or feedback system). This approach will work smoothly if your functionality can be easily divided and user will not have to go to your website to finish some action.

The second fact is that the whole messenger bots direction is very young, and certainly has room for improvement. It tends to repeat most of the steps web development already did and I hope it will go further. But right now it does not make a WOW effect.

Take a look at the latest news of the telegram bots. Bots have new buttons and allow message editing to minimize chat history. New buttons, really? HTML has that feature for over 20 years and I do not think you can find news about that. Edit messages? Are we back in 2005 when AJAX was invented? Adoption of existing web tools for bots is a natural process but it will take some time.

 

Implementation

To make reasonable conclusion we have to write a simple implementation and make sure we are comfortable with the way it works. Once it is done we will be able to provide precise estimates for bot development tasks in future. I assume that parrot-bot will cover main data flows between user and bot. Lets start!

I will use Telegram – the pioneer of the messaging bots direction. The API introduction might be found here. So lets create our parrot-bot at first.

  1. Install telegram (if you do not have it already).
  2. Talk to botfather and create a new bot.
  3. Remember the TOKEN.
  4. Find your new bot and start a conversation.

It was simple. The bot is ready and we can greet him. It is time to setup Telegram to server communication. Telegram offers two ways to get user messages:

  1. Live polling
  2. Webhook

I prefer to use webhook approach since it works faster and you will get updates only once user sent a message to your bot. To setup webhook you should visit following url:

https://api.telegram.org/botTOKEN/setWebhook?url=https://MY_SERVER.COM/webhooks/telegram_b34c430dbf1631ea075954ddd8ds1

I want to highlight three not intuitive things here.

  1. The “bot” string should go in front of your TOKEN.
  2. Use url with a long random string on the end to make sure nobody can guess it and cheat your system.
  3. If you want to test your bot locally – ngrok will help you a lot to get a temporary external domain name.

We are ready to write a rails server, which will answer Telegram and keep communication data. Lets use Ruby on Rails and make a simple controller to retrieve and process the data. I assume you know how to create new Rails application (if no – check here) and will note only valuable changes.

 

Gemfile

 

lib/bot_message_dispatcher.rb

 

app/controllers/webhooks_controller.rb

 

config/routes.rb

Now you should be able to run the server and accept Telegram webhooks. It was pretty straightforward, right? Feel free to use the code above as a template for your bot.

 

Conclusion

As you could see, it is very easy to create a new bot and start conversation in half an hour. Keep in mind the bot ecosystem restrictions and you will prevent expensive mistakes. I encourage you to create simple useful bots to save your users’ time. Besides, Telegram will be happy to give $1,000,000 to bot developers. Do your best and claim your award!

 

 

Questions? Comments? Let’s talk about them in the comments section below.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?


Author

Business Analyst at Rubyroid Labs

Write A Comment