Telegram
Prerequisites
- A Telegram account and a Telegram bot
- A Botpress Cloud account and a Botpress Bot
Create a Bot
To create a bot on Telegram, use Telegram's BotFather. The BotFather will ask you for a name and username, then generate an authorization token for your new bot
The name of your bot is displayed in contact details and elsewhere
The Username is a short name to be used in mentions and t.me links. Usernames are 5-32 characters long and are case insensitive but may only include Latin characters, numbers, and underscores. Your bot's username must end in bot
, such as tetris_bot
or TetrisBot
Setting up the Telegram integration in Botpress
- Go to the Integration Hub in Botpress Cloud (if you don't have the integration installed yet).
- Find and open the Telegram integration then click on the "Install to Bot" button, now go back to your bot settings.
The Telegram integration has the following settings:
- Enabled: Whether Botpress will communicate with Telegram
- Webhook URL: The URL for receiving data in Botpress
- Bot Token: The token of your Telegram bot
Setting up Telegram
Generate an Authorization Token
When you create a Telegram bot, BotFather will automatically generate a token. The token is a string that is required to authorize the bot and send requests to the Bot API. Keep your token secure and store it safely; anyone can use it to control your bot
If your existing token is compromised or you lost it for some reason, use the /token
command to generate a new one
Bot Token
Copy your Telegram bot token and paste it into the Bot Token channel configuration and click Save.
That's it, you may now start chatting with your bot on Telegram!
Tips
-
To get the Telegram conversation ID, you can read the following variable:
{{ event.tags.conversation["telegram:id"] }}
. -
To get the Telegram user ID, you can read the following variable:
{{ event.tags.user["telegram:id"] }}
. -
To get the Telegram message ID, you can read the following variable:
{{ event.tags.message["telegram:id"] }}
.
Updated 3 months ago