Telegram
Connect a Telegram bot to Tavio so customers can interact with your AI agent directly in Telegram.
BotFather Setup
- Open Telegram and search for @BotFather
- Send
/newbotand follow the prompts to create your bot - Copy the bot token provided by BotFather
- Optionally, send
/setdescriptionand/setabouttextto customize your bot's profile
Required Credentials
| bot_token | Token from BotFather (e.g., 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11) |
| webhook_secret | A secret string you create for webhook signature verification |
Webhook URL
Telegram Webhook
text
https://bankmind.aihookd.site/api/v1/channels/telegram/webhookSetting Up the Webhook
Register your webhook URL with Telegram using the Bot API. You can do this with a single cURL request:
Register webhook via Telegram API
bash
curl -X POST "https://api.telegram.org/botYOUR_BOT_TOKEN/setWebhook" \
-H "Content-Type: application/json" \
-d '{
"url": "https://bankmind.aihookd.site/api/v1/channels/telegram/webhook",
"secret_token": "YOUR_WEBHOOK_SECRET",
"allowed_updates": ["message"]
}'You can also set the webhook from the Tavio dashboard under Channels > Telegram, which will make this API call for you.
Message Flow
- Customer sends a message to your Telegram bot
- Telegram forwards the message to your webhook URL
- Tavio verifies the
X-Telegram-Bot-Api-Secret-Tokenheader - The message is processed through the AI pipeline
- Response is sent back via the Telegram Bot API
Inbound Payload
Telegram webhook payload
json
{
"update_id": 123456789,
"message": {
"message_id": 42,
"from": {
"id": 987654321,
"first_name": "John",
"username": "john_doe"
},
"chat": {
"id": 987654321,
"type": "private"
},
"date": 1700000000,
"text": "What are your interest rates?"
}
}