What I learned from building a chatbot without a framework (part 1/2)

Photo credit: Robin Zebrowski
There is tremendous learning value in interfacing a bot with a bot API directly, without going through an external bot building framework.
To provide some context, the chatbot I built sends the user daily Twitter trends. It is called TwTrendsBot and is available on Telegram. You don’t need Twitter to use it. If you do have a Twitter account, it serves as a supplement to your Twitter experience, because the trends it sends you are country-specific.
Each platform allows different kinds of interactions
Things are simple when the chatbot and the user can only communicate in plaintext. However, different chat platforms like Facebook Messenger, Kik or Telegram provide different features and interactions that change the user experience substantially.
The best way to learn about what’s possible is to try their bot API directly, without going through an external framework or library.
For example, Telegram has a unique inline query feature, where the user can simply type “@bot_name
Once the query is submitted, the bot can process it and generate a list of results, which can be formatted in a variety of ways. When the user selects a result, the message will be sent to the chat. For performance reasons, lazy loading and caching are supported by Telegram.

A sample list of inline query results
As I was finishing my bot, I realized that it was not enough to send the user a list of Twitter trends. After all, the user may want to see tweets related to a certain trending topic, and one way to do that is to direct the user to Twitter via a specific link.
Thankfully, I discovered that the Telegram API supports custom hyperlinks with HTML tags, so I could keep the message really succinct! The user can simply tap on an individual trend to open up Twitter and view the tweets related to it.

Service messages are useful
I handled the different ways in which the user could stop my bot
Frameworks can be unexpectedly complex
Conclusion
Stay updated on the go with our mobile app.
Get latest insights with smoother, more personalized experience through TIA mobile app.






