DEV Community

Cover image for Introduction - A bot responding to a recruiter via Telegram using Watson Assistant's Natural Language Processing
Leandro Boeing Vieira
Leandro Boeing Vieira

Posted on

Introduction - A bot responding to a recruiter via Telegram using Watson Assistant's Natural Language Processing

I believe that naming articles is as difficult as naming variables and classes, but let's go. For now, that'll do. Although large, it seems significant enough to demonstrate what I intend to cover in this series.

As you may have seen in my LinkedIn post, I will "teach" (how much pretension) how to train a bot to respond to recruiters, making decisions for me, using the good principles of a clean architecture to separate the logic of my business from the necessary infrastructure for that.

Ok, but what are my business rules? Respond to a recruiter based on the context of the conversation. And what is the infra? Telegram API, Watson Assistant, REST etc. You'll see below a drawing of the initial architecture. Of course, it may change until the end of the project, but whenever it happens, I will tell you what has changed.

Bot's Architecture

I was surprised that an architecture for such a cool theme is as simple as that. I finished drawing and thought: something must be missing. But in fact, it has served me well so far. Some points to highlight in relation to the stack I use to implement this architecture:

  1. Telegram itself indicates some unofficial SDKs for developers at

  2. I decided to use the Java Telegram Bot API ( because it suited me well and I liked the support on github, answering a question in less than 24 hrs.

  3. This implementation of the telegram API provides a much better Webhook mechanism than polling the server for a possible new message. With that, I end up being "nice" with Heroku too, as my application can shut down after 30 minutes of inactivity. With the polling solution, the application receives a POST every X seconds and it never sleeps.

  4. Currently, the application does not yet have the "Take decision based on context" logic developed within the Use Case "Answer Recruiter". I mean, we will develop together. Nice right?! But it already communicates with IBM Watson Assistant and returns the context I need for the bot to be able to answer at least the initial greeting.

  5. I have a minimum logging for development level so I can analyze what the user is sending and what he is receiving as a response. As the application sleeps from time to time (characteristic of Heroku) I always lose these logs. If anyone has a cool idea on how to persist these logs for free, I would appreciate it very much!

It is worth noting that, in an initial idea, I will not "teach" how to create an instance of IBM's Watson Assistant. There is a very complete material at: But I will show you how I created the dialog nodes, the intents and the entities related to the domain of my application. I think it makes more sense that way.

I'm also not going to teach you how to create a bot on Telegram. It is VERY simple and they teach here: how-do-i-create-a-bot.

That's it for now. We haven't entered "show me the code" yet, but be patient. I thought this introduction is important for us to give a cool rhythm in this series, without too much information at once. I also think it is important that you have a first contact with the architecture, become familiar with it, before looking at the implementation decisions soon.

Top comments (0)