Telegram Bot¶
Bots are small applications that run inside the Telegram app. Users interact with bots through flexible interfaces that can support any type of task or service. This document describes how to create a Telegram Bot notification target in Guance to push alert messages directly to Telegram private chats, groups, or channels.
Click for more information about Bots.
Note
This notification target applies only to international site workspaces that have bound an International Billing Center account.
Prerequisites¶
Before configuring in Guance, complete the following preparation in Telegram:
Step 1: Create a Bot and Obtain the Token¶
- Search for and start @BotFather in Telegram.
- Send the
/newbotcommand to create a new bot. - Set the bot name and username as prompted (the username must end with
bot). - After the bot is created, keep the returned Bot Token safe (format:
123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11).
Note
The Bot Token is the credential for calling the Telegram API. Keep it safe and never disclose it.
Step 2: Obtain the Chat ID¶
Add the Bot to the target group, or create a private chat. Send the message @userinfobot in the chat and click the link to obtain the Chat ID.
Chat ID supports the following formats:
| Receiving Scenario | Chat ID Format | Example |
|---|---|---|
| Private chat | User ID (numeric only) | 123456789 |
| Group | Group ID (negative number) | -1001234567890 |
| Channel | Channel username | @my_channel |
Step 2: Obtain the Topic ID (Optional)¶
Required only when the target is a Forum Supergroup and you need to send to a specific topic:
- Send a message in the target topic.
- Visit
https://api.telegram.org/bot<YourBOTToken>/getUpdates. - Find the
message_thread_idfield value in the returned data.
Return to the Telegram Bot Configuration Page¶
- Define a name for the current notification target, used to identify it in the notification target list.
- Enter the Bot Token obtained from @BotFather.
- Enter the Chat ID.
- If you need to send to a forum group, enter the Message Thread ID.
- Test as needed whether the notification has been sent (❗️The system sends a test message; go to the corresponding notification target to verify whether the test message was sent successfully).
- Configure operation permissions.
- Confirm.