Skip to content

Telegram Bot


Bots are small applications that run within 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 TrueWatch to push alert messages directly to Telegram private chats, groups, or channels.

Click to learn more about Bots.

Note

This notification target is only applicable to international site workspaces that have bound an International Billing Center account.

Preparation Before Configuration

Before configuring in TrueWatch, you need to complete the following preparations in Telegram:

Step 1: Create a Bot and Obtain the Token

  1. Search for and start @BotFather in Telegram.
  2. Send the /newbot command to create a new Bot.
  3. Follow the prompts to set the Bot name and username (the username must end with bot).
  4. After successful creation, securely save the returned Bot Token (format example: 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11).
Note

The Bot Token is the credential for calling the Telegram API. Please keep it secure and do not 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 to jump to obtain the Chat ID.

The Chat ID supports the following formats:

Receiving Scenario Chat ID Format Example
Private Chat User ID (pure numbers) 123456789
Group Group ID (negative number) -1001234567890
Channel Channel username @my_channel

Step 2: Obtain the Topic ID (Optional)

Only required when the target is a forum supergroup and messages need to be sent to a specific topic:

  1. Send a message in the target topic.
  2. Visit https://api.telegram.org/bot<YourBOTToken>/getUpdates.
  3. Find the value of the message_thread_id field in the returned data.

Return to the Telegram Bot Configuration Page

  1. Define the name of the current notification target for identification in the notification target list.
  2. Enter the Bot Token obtained from @BotFather.
  3. Enter the Chat ID.
  4. If you need to send to a forum group, enter the Message Thread ID.
  5. Test the notification as needed (❗️ The system sends a test message. Please go to the corresponding notification target to check if the test message was sent successfully).
  6. Configure operation permissions.
  7. Confirm.