First thing we must do is to obtain a bot token from Telegram.
How do we do that? We must talk to the Botfather
I’m not joking! This is the official Telegram bot that grants access to other bots.
First thing, install Telegram and get an account there if you don’t have one yet.
Next, inside Telegram search for “botfather”:
Click it, and then press the Start button at the bottom
The bot will reply to the /start
command (sent automatically when you click “Start”) with a list of the commands you can send it:
We need to use the /newbot
command, here described as “create a new bot”.
You follow the instructions which basically ask for the bot name. I used langbuddybot
, you can pick any name you want (you’ll have to choose your unique bot name):
Note down the token. We’ll use that in our Node.js app.
The bot is now reachable at t.me/langbuddybot! We can talk to it, but nothing will happen. It’s just an empty placeholder.
We need to actually create the bot code.