Telegram has evolved from a simple messaging app to a social media platform that is used by millions of people across the globe. Apart from its simple user interface and easy ways to join new groups, what made Telegram popular in the first place is the ability to integrate a bunch of other applications. This can make the seemingly single-use chat app become a productivity and workflow management tool.
Dialogflow is one such tool, allowing you to create a chatbot within Telegram that your company’s customers and clients can use for instantaneous help and support. Here’s how to integrate Dialogflow to Telegram.
Part 1 – Creating a Basic Telegram Bot
Dialogflow itself is a language processing platform, but it doesn’t come with a built-in bot that goes on social media platforms like Telegram. That’s why you’ll first need to make a separate bot and use it to link the two tools.
Step 1. In the Telegram app (it’s best to use the browser version for this) search for “BotFather” and select the first result that pops up. This is the tool that can make new bots on the platform.

Step 2. In the chat with the Botfather, type in “/newbot” and hit Enter.
Step 3. The BotFather will ask you to input the bot’s name. Type it into the chat and hit Enter.

Step 4. Similarly, insert a username for the bot. Note that this username must end with “bot.”
Step 5. The BotFather will send a lengthy message containing a string of characters (the API key). Copy this key, as you’ll need it later.

Part 2 – Adding a Dialogflow Agent
With the bot created, you will need to create a Dialogflow agent. This is the part that takes in the user queries and creates appropriate responses. Unfortunately, this is also the most difficult part of the process, as you’ll need to either fetch the code from somewhere or make one yourself.
Step 1. Go to the Dialogflow website that you’re using to make the chatbot.
Step 2. Select “Create Agent.”

Step 3. Provide the agent with a name. For simplicity, you might want to keep the name of the bot and the agent similar, if not the same.
Step 4. Select the language that your agent needs to detect. For most purposes, this will be English.
Step 5. Click on “Create” to finalize the basic process.
Step 6. The agent’s code window will open. In here, you’ll need to set up the user intents and the appropriate responses. You can start with the basics and move from there, and Google’s documentation is pretty extensive.

Part 3 – Integrating the Agent Into the Bot
With the agent made, all that’s left to do is to link Telegram and Dialogflow.
Step 1. Go to the Dialogflow console.
Step 2. Select the “Integrations” tab on the left.

Step 3. From the list of possible integrations, click on “Telegram.”
Step 4. You’ll get a popup menu that asks you to provide the bot’s API. Paste the sequence from Part 1 here.

Step 5. Make sure that you chose the correct agent in the “environment” section in the popup.
Step 6. Dialogflow will set up the webhook URL using your agent’s fulfillment settings. Make sure your webhook is publicly accessible and properly configured to receive HTTPS requests.
If the connection was successful, you should be able to converse with the newly-made chatbot and it should detect text or in some cases even speech, depending on the extent of the agent setup from Part 2.
After that, it’s all down to testing and optimizing the bot to ensure it provides the correct responses.
Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.

