Telegram:Bot
lastmod 2025-02-14created 2016-06-2113 edits
API Token
You can obtain a token through @BotFather.
- [Input] /newbot
- BotFather: Alright, a new bot. How are we going to call it? Please choose a name for your bot.
- [Input (Korean allowed)] DecanBot
- BotFather: Good. Now let's choose a username for your bot. It must end in
bot. Like this, for example: TetrisBot or tetris_bot. - [Input (English only)] DecanBot
- BotFather: Done! Congratulations on your new bot. You will find it at telegram.me/DecanBot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.
Use this token to access the HTTP API:
----- TOKEN -----
For a description of the Bot API, see this page: https://core.telegram.org/bots/api
Then just add the ID. (@DecanBot in the case above)
Join Group
To simply add the bot to a group, you need to send the /setjoingroups command to @BotFather.
Privacy mode
Note that even after the bot joins a group, it cannot fetch the group's messages through the Bot API. To get permission to access messages, set the /setprivacy command to Disable via @BotFather.
Inline bots
Turning off URL preview mode
You can set disable_web_page_preview attribute to true when using sendMessage method.
It will disable link previews for links in this message.
https://core.telegram.org/bots/api#sendmessage
Adding command autocompletion to the bot
Just send the /setcommands command to BotFather.
It asks you to enter them as follows:
OK. Send me a list of commands for your bot. Please use this format:
command1 - Description
command2 - Another description
Send /empty to keep the list empty.
Command names must be entered without the /.
For example, not:
but as follows:
Troubleshooting
When you added the bot to a group but it says it cannot access messages
The English message is Has no access to message.
Go to BotFather and
See also
Favorite site
- [Recommended] Telegram Bot API
- [Recommended] Core.telegram: Bot Code Examples
- Introduction to using Telegram bots and a review
- [Recommended] Telegram CLI - Building a Telegram Bot with Python
- Generating a Telegram Bot API Token
- Building a Raspberry Pi Telegram BOT Part 1 - Installing Telegram cli 1
- Github: acidpop/bot
- Building a Raspberry Pi Telegram BOT Part 2 - Basic usage of Telegram cli 2
- Building a Raspberry Pi Telegram BOT Part 3 - Building the skeleton of a Telegram cli BOT 3
- Building a Raspberry Pi Telegram BOT Part 4 - Running the Telegram CLI daemon and registering it as a service 4
- Building a Raspberry Pi Telegram BOT Part 5 - Telegram CLI BOT final 5
Python Telegram Bot
- Python - Building a Telegram bot
- Building a Telegram Bot
- Using a telegram bot with python - 1 Basic setup