Telegram
The Telegram channel lets users interact with Open Astra agents directly from Telegram using the Bot API. It supports text messages, file uploads, and inline keyboards for structured interactions.
Setup
- Open Telegram and start a chat with
@BotFather - Send
/newbotand follow the prompts to create a new bot - Copy the bot token (format:
123456789:ABCDefGhIJKlmNoPQRsTUvwxyz) - Add the token to your environment:
bash
TELEGRAM_BOT_TOKEN=123456789:ABCDefGhIJKlmNoPQRsTUvwxyzThe gateway starts the Telegram long-polling listener automatically when this env var is present.
Configuration in astra.yml
yaml
channels:
telegram:
enabled: true
defaultAgent: assistant-agent
allowedUserIds: [] # Empty means all users allowed
allowedChatIds: [] # Empty means all chats allowed
maxMessageLength: 4096 # Telegram's max is 4096 charsFeatures
- Text messages — all text messages are forwarded to the agent as user turns
- File uploads — documents, images, and audio files are extracted and provided to the agent as context
- Streaming responses — long responses are delivered progressively by editing the bot's message as tokens arrive
- Markdown rendering — agent responses with markdown are converted to Telegram's MarkdownV2 format
- Group chats — the bot responds when mentioned with
@botnamein a group
Telegram slash commands
Register these with BotFather using /setcommands for autocomplete support:
text
start - Start a new session
reset - Clear conversation history
agents - List available agents
switch - Switch to a different agent
memory - Search your memory
usage - Show token usage
help - Show this help message💡Set your bot's privacy mode to disabled in BotFather if you want it to receive all messages in group chats, not just messages that start with a slash command or mention.