In this tutorial, I will explain how you can add a Telegram chatbot to your Telegram group and automatically reply to messages in your group.
I will show you:
- How the chatbot can only reply when you mention it
- How the chatbot can respond to all messages in the group
P.S. In my Telegram Chatbots guide, I already explained how you can can create a chatbot (without using any code), so if you haven’t already seen that one, I highly recommend to read it 🙂
Let’s dive in!
Create a Telegram Group
As already mentioned in the beginning, I created my own Telegram chatbot which can reply to simple questions such as “Can I order a pizza”:
So the first step we need to do, is create our own Telegram group.
If you are on a desktop, just install Telegram, click on the Pen icon in the top-left corner and select New group:
Here, you need to select the members you want to add (probably some friends/colleagues of yours), give a name to the group (for example “Bot Test”) and click on Create:
Add Telegram Chatbot to the group
Now we’ve created our Telegram group and we need to add our chatbot.
So, you can just go to your Telegram chatbot (mine is called “Pizza-DF-Bot”) and click on the Top Bar:
Then, you need to click on “More” and select Add to Group:
And select the Telegram group you want to add the chatbot to:
Only reply if you mention the Telegram Chatbot
Once you’ve added your Telegram chatbot to your Telegram group, and you mention it, you will probably see that the chatbot doesn’t automatically respond:
This is because the chatbot is not an admin of the group.
So, you need to click on the top bar of your Telegram group:
Click on Edit:
And then choose for Administrators:
Click on Add admin:
Select your chatbot:
And then give it all the rights it needs:
When you’ve done this, and you will ask a question and mention the chatbot again, you will see that it is responding now:
Let Telegram Bot respond to all messages in the group
Now, the chatbot is only responding when you mention it.
But what if you want the chatbot to respond to all messages in the group?
Then, we need to have a talk with the BotFather.
In Telegram, you need to search for “BotFather” and start a conversation with him:
The BotFather immediately gives you a list of commands that you can use to change the settings of your chatbot:
Now, you need to type “/setprivacy”, which is a command we can use to change the privacy settings in Telegram groups.
Then, you can select which bot you want to change:
Then, you will see that the privacy settings are set to Enable (by default), which means the bot only replies to commands and mentions. Now, if you just type in “Disable” or click on the button, you can disable this setting:
And if you go back to your Telegram group and say something (without mentioning the bot), you will see that the chatbot automatically responds:
Now It’s Your Turn
And that’s how you add a Telegram chatbot to your Telegram group.
Now I have a question for you:
Do you already use Telegram Bots in your Groups? And if not, why not?
Let me know by leaving a comment below!