Prerequisites
- A Telegram account (personal or team)
- Access to BotFather on Telegram to create the bot and obtain the token
- An Agent created and active in Timely.ai
Unlike WhatsApp and Instagram, Telegram does not require a verified business account or third-party approval. Any Telegram account can create a bot.
Step-by-step connection
Create a bot in BotFather
Open Telegram and search for BotFather will ask for:Copy this token — you will need it in the next step.
@BotFather. Start a conversation and send the command:- Bot name — a friendly name that appears in conversations (e.g., “Timely Support”)
- Bot username — must end in
bot(e.g.,timely_support_bot)
Go to Channels in the Dashboard
In the Timely.ai sidebar, go to Channels → Add channel and select Telegram.
Paste the token and connect
Enter the bot token in the corresponding field. The token must be in the 
number:string format (e.g., 123456789:ABCdef...). Timely.ai validates the token with the Telegram API before proceeding.
Webhook configured automatically
Upon confirming the valid token, Timely.ai:
- Calls
setWebhookon the Telegram API pointing tohttps://[YOUR-SUPABASE].supabase.co/functions/v1/telegram-webhook - Generates a random webhook secret to validate requests
- Saves the integration in the database with the bot information (
bot_id,bot_username,bot_name)
Link to the Agent
Select the Agent that will handle Telegram Conversations. One Telegram integration corresponds to one bot and one Agent.
Supported features
Media types
| Type | Receive | Send |
|---|---|---|
| Text | Yes | Yes |
| Image (JPG, PNG, WebP) | Yes | Yes |
| Document (PDF, DOCX, etc.) | Yes | Yes |
| Audio / Voice message | Yes | — |
| Video | Yes | — |
| Sticker | Yes | — |
| Location | Yes | — |
Bot commands
Telegram allows users to send slash commands (e.g.,/start, /help). You can register commands in BotFather with /setcommands and the Agent treats those commands as regular text messages — the Agent’s prompt should describe how to respond to each one.
Groups and supergroups
By default, the bot only responds to direct messages (DMs). To enable responses in groups:- In BotFather, send
/setjoingroupsand select Enable - Add the bot to the desired group
- Configure the Agent to respond to
@mentionsor to all group messages
Incoming webhook
Messages arrive via:X-Telegram-Bot-Api-Secret-Token header on each request. For details about the payload and supported events, see External Webhooks → Telegram.
Limits and best practices
- Telegram API rate limit — 30 messages/second for the same chat, 20 messages/minute for different groups. The API returns error
429when the limit is reached. - File size — bots can receive files up to 20 MB and send up to 50 MB.
- Unique token per bot — one token corresponds to a single bot. For multiple Telegram channels, create separate bots in BotFather.
- Bot cannot initiate conversation — unlike some channels, Telegram bots can only send messages to users who have already started a conversation with
/start. Account for this in your prompt configuration. - Token rotation — if you suspect the token has been compromised, revoke it in BotFather with
/revokeand generate a new one. Update it in Timely.ai under Channels → [your Telegram integration] → Edit.
Troubleshooting
'Invalid token' error when trying to connect
'Invalid token' error when trying to connect
Confirm that the token is in the correct format:
number:string without spaces (e.g., 123456789:ABCdefGHI...). Tokens generated by BotFather always have two segments separated by :. If you copied it with accidental spaces, remove them.Bot does not respond after connecting
Bot does not respond after connecting
Check whether the webhook was configured correctly by calling the Telegram API directly:The
url field should point to https://[YOUR-SUPABASE].supabase.co/functions/v1/telegram-webhook. If it is empty, disconnect and reconnect the Channel in Timely.ai to force the setWebhook.Bot responds in DMs but not in groups
Bot responds in DMs but not in groups
For groups, the bot needs permission to read messages. Check with BotFather whether
can_read_all_group_messages is enabled (/setprivacy → Disable). Also, in groups with privacy enabled, the bot only receives messages with @mention.Messages arrive duplicated
Messages arrive duplicated
This can happen if there are two webhooks pointing to the same bot (e.g., development and production environments). Use
getWebhookInfo to check the active URL and deleteWebhook to clear it before reconfiguring.How to change the token without losing history?
How to change the token without losing history?
Go to Channels → [Telegram integration] → Edit, update the token, and save. Timely.ai calls
setWebhook with the new token automatically. The Conversation history is preserved in Timely.ai’s database.