How to Connect Telegram to AI Agent
Connect your Flametree AI agent to Telegram to automatically process and respond to messages sent to your Telegram bot. This integration uses the Telegram Bot API and a bot token issued by @BotFather.
Prerequisites
- Access to Telegram mobile app or web version
- A Flametree account with agent creation permissions
- Admin access to the Flametree integration settings
Creating and Configuring Telegram Bot
Step 1: Create a Telegram Bot
-
Find BotFather
- Open Telegram and search for @BotFather (official bot)
- Send the
/startcommand to begin
-
Create New Bot
- Send
/newbotcommand - Follow the setup wizard:
- Bot Name: Choose a display name (for example, "My Company Support")
- Username: Must end with
bot(for example,mycompany_support_bot)
tipYou can customize your bot later using @BotFather commands such as
/setuserpic,/setdescription, and/setcommands - Send
-
Save Your Token
- BotFather will provide an access token in format:
123456789:AAH...XYZ - Keep this token secure — you’ll need it for Flametree integration
- If the token is invalid, compromised, or belongs to another bot, check it in @BotFather using
/mybotsor generate a new token
- BotFather will provide an access token in format:
Step 2: Configure Integration in Flametree
-
Navigate to Settings
- Go to Settings > Channels
- Open Telegram
- Select Add +
-
Fill Configuration
Field Description Required Default Name Custom name for this integration ✅ - Description Optional description for internal reference ❌ - Bot Username Bot username in Telegram. Will be displayed on the Flametree platform ✅ - Telegram Bot Token Token received from @BotFather ✅ - Enable telegram streaming Shows AI responses as they are generated instead of waiting for the complete response ❌ True -
Click Save to create the integration
-
Click Start in the upper-right corner to start the channel.
Step 3: Connect to AI Agent
-
Open Agent Configuration
- Navigate to your target AI agent's settings
- Go to Communication channels section
-
Assign Channel
- Select your Telegram integration from the list
- Save the agent configuration
Configuration Options
Customize features through Set Environment Variables:
| Variable | Description | Default |
|---|---|---|
SHOW_VOICE_TRANSCRIPTION | Show transcription text for voice messages. Requires Speech-to-Text support for voice message processing | True |
TELEGRAM_SHOW_KEYBOARD_REPLY | Display control buttons such as clear, thoughts, and stop | True |
Testing Your Integration
-
Find Your Bot
- Search for your bot username in Telegram
- Start a conversation with
/start
tipTelegram bots are marked with the BOT label and do not show online status — this is expected behavior
-
Send Test Message
- Type any message to your bot
- Verify the AI agent responds appropriately
-
Test Voice Messages
- Send a voice message
- Check if transcription appears (if
SHOW_VOICE_TRANSCRIPTIONis true)
importantIf voice messages are not processed, make sure Speech-to-Text integration is configured in your agent
-
Check supported message types
- The integration supports text, voice messages with transcription, images, and basic interaction features
- Documents and video calls are not supported
Security Considerations
- Protect the bot token. Anyone with this token can control the bot
- Rotate the token in @BotFather if it is compromised
- Configure bot privacy settings in @BotFather using
/setprivacy - Review group chat permissions if the bot is used in groups
- Review message retention policies in your Flametree account