How to create your own Telegram bot who answer its users, without coding.
This is my second article after the one allowing you to automate a Telegram bot. This one is about a new functionality on Paquebot (now known at Chatfuel), that allow to create custom answers to commands.
WARNING: THIS TUTORIAL WILL BE UPDATED SOON. SOME INSTRUCTIONS MAY NOT BE AVAILABLE EXACTLY AS DESCRIBED.
1. Get a bot idea
There are two kind of bots possible: the bots that send you updates (without reactions), and the bots that answer to your messages. Of course, you can make a bot that makes both.
In that tutorial, we will use Paquebot.io, a service that allow to create bots without any code knowledge, without servers, or any other geeky stuff (that’s my role).
A bot that send regular updates:
Personal News. Podcasts. Sport results. Language lessons. Weather forecasts. Daily quotes. Blog updates. Instagram notifications. Newsletters.
A bot that answer to commands/question:
Vocabulary verification. Random song from your band. Random picture of a famous actor. Request pages of a book. Recipes. Get countries informations.
All these kind of bot can be done without code knowledge. There are plenty of other good ideas, but in some case you may need to learn to code. And that’s a bit longer 😉
In my case, I will make a bot to promote a music band, and I will take the identity of “Breakbot” (yes, it actually exists).
2. Requirements & Installation
The first step is to add a new bot on Paquebot.
If you already created bots, here is a reminder:
1) Open Bot Father on Telegram. Type /newbot and follow the instructions. Save the token somewhere, we need it on the next step.
2) Open Paquebot on Telegram ( → new name: Chatfuelbot on Telegram). Type /addbot followed by your token. It’s ready.
If it’s your first time creating bots, follow the steps 1 and 2 (and the step 3 if you want) of this tutorial, then come back here:
This tutorial will show you how to make a bot fully automated without servers, code knowledge or any technical…medium.com
Now you should have a bot ready. For me, it’s okay.
3. Create your first commands
The first command I’ll create is to send picture of this DJ. To do so, I’ll start by sending /help to my bot.
As you can see, there are different ways to customize the bot.
We are interested in creating answers to the user commands/requests, so we will use the /commands instruction. We have the listing of the different ways to manipulate the commands we will create.
The texts possible must be on one line, and it’s not necessary to contain text only. A text starting by a slash (“/”), will be transformed in a link that your users can select. It’s useful if you want to write it in a text.
Examples of commands: “/contact”, “⚓️”, “Hello”, “Pictures 📷”.
For my first command, I’ll create the “🎧 Music” command. To do so, I’ll enter that command: /commands add 🎧 Music
The system ask me for my answers for that command. I will put a welcome text, and explain about “me” (okay, I’m not that famous guy with a beard). Once I sent the text, I can add other answers. I don’t need that, so I send /cancel to exit.
The problem, is that my /songs command doesn’t exist yet, so I have to create it as soon as possible. I’ll write this: /commands add /songs (please note that I wrote “/songs” and not “songs”).
I can send all my songs in a row, and as soon as they are uploaded, they are added to my answers.
When I’m done, I can send /cancel again.
It’s important to wait that all the files are uploaded first, as the bot will receive them only when the transmission is done.
If I want to add new songs later, it’s possible: I just need to write /commands add /songs again, with exactly the same style (the case, especially).
Now, I can test it: when I click on the top right button, the text is sent. And when I tap on “/songs” in the text, a random song is sent to me. It works!
4. Customize the keyboard
Okay, it works, but I’m not satisfied. The command /songs should not be displayed on the keyboard, because it doesn’t look good. I prefer welcome them and give them the command only when I want.
It’s possible: I just have to send /commands hide /songs
And the best, is that I still can click on the link on the text! Nice, isn’t it?
5. Remove the answers
Oh, I just realized that nobody will buy my album if I give everything for free on Telegram! So I’ll remove few songs.
First, I’ll send /commands list to know the commands that are available. Then, I chose one of them: /commands list /songs
My bot sends me the list of the answers that are available for that command. Actually, it’s all the songs I send before, and under all of them, there are the deletion instructions.
I just need to follow the instructions to remove: /commands delete 9845 (9845 is the number of the answer in Paquebot’s database).
Now imagine that I want to remove all the songs (because the real Breakbot wouldn’t be happy that I give all his songs for free 😡).
The instruction “/commands deleteAll /songs” will remove the question and all its answers:
6. Make your bot looks good
Don’t forget to use the @BotFather and its command /setcommands. It will only work for your commands starting with a slash (“/songs”, for example).
To set a welcome message to your bot, use /setabout inside your bot, followed by your text. It will also make the about button appear.
/setabout Hey, you can use my bot.
To recieve songs, send /songs. To know all my social accounts, send /contact. Enjoy it!
You can also change the language, like this /locale fr will put the language in french. To know the locales available, type /locale alone.