How to Connect a Telegram Bot
This guide shows you how to connect a Telegram bot to Raytio by creating a channel endpoint. When you save the endpoint, Raytio registers the webhook with Telegram automatically — no manual configuration in Telegram is required.
Prerequisites
- You have the Interaction administrator role.
- You have a Telegram bot token. You can create a bot and obtain its token using BotFather in Telegram.
- The bot has been added as an administrator to your Telegram supergroup, with the ability to manage topics.
- You have at least one queue configured in Raytio to receive unbound incoming conversations.
Steps
1. Open Channel Endpoints
From the top navigation bar, open the Administration menu and select Channel Endpoints.
2. Create a new endpoint
Click Create. The channel endpoint form opens.
3. Fill in the endpoint details
| Field | What to enter |
|---|---|
| Channel | Select Telegram |
| Name | A descriptive label for this endpoint (e.g. Operator Bot) |
| Bot token | The token you received from BotFather (e.g. 1234567890:ABCdef...) |
| Default queue | The queue where unbound incoming conversations will be placed |
4. Save
Click Save. Raytio stores the endpoint and immediately sends a webhook registration request to Telegram. Telegram will forward all messages sent to your bot to Raytio.
You do not need to call any Telegram API endpoints manually or configure anything else in BotFather.
5. Verify the registration
After saving, the endpoint record shows a Webhook status field. A status of Subscribed confirms that Telegram has accepted the webhook registration and is actively forwarding messages.
If the status shows Error, check that:
- The bot token is correct and has not been revoked.
- The bot is an administrator in the Telegram group.
You can retry the registration by editing the endpoint and saving again.
What happens next
Once the webhook is registered:
- Messages sent to the bot (including messages in the Telegram group's topics) arrive in Raytio within seconds.
- Messages sent in the General topic of the group are placed in the default queue as unbound conversations.
- Messages sent in a topic that is already linked to a conversation are added to that conversation's history automatically.
- Raytio sends a typing indicator to acknowledge receipt while the worker prepares a reply.