Connect Telegram Bot
How to configure and connect a Telegram bot to Buda via long-polling for two-way AI conversations.
Connect Telegram Bot
Buda connects to Telegram via long-polling — the bot actively pulls updates from Telegram's servers. This means you do not need a public HTTPS endpoint or any webhook configuration. By simply providing a Bot Token, Buda will automatically maintain the connection in the background.
Step 1: Create a Bot via BotFather
- Open Telegram and search for @BotFather, or click the link directly.
- Send the command
/newbot. - Follow the prompts: enter a display name (e.g.,
Buda Assistant), then a username ending inbot(e.g.,buda_assistant_bot). - BotFather will reply with your Bot Token — a string like
1234567890:AAFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. - Copy and save this token — you will paste it into Buda shortly.
Step 2: (Optional) Configure Bot Settings
You can optionally configure the bot's description and commands via BotFather:
/setdescription— set a description shown on the bot's profile page/setcommands— register command hints shown in the chat input. Suggested commands:start - Start or resume the current session help - Show help information new - Start a new session
Step 3: Configure the Channel in Buda
- Open Channels Settings in Buda (Settings → Channels).
- Click Add Channel and select Telegram.
- Paste the Bot Token you copied from BotFather.
- Optionally set a Label and select a Target Agent.
- Click Connect.
Once saved, Buda will immediately start polling Telegram for new messages in the background. You will see the following in the server logs:
[telegram-bot] Connected polling gateway for channel <id>Step 4: Start Chatting
- Direct message: search for your bot by username in Telegram and send it any message.
- In a group: add the bot to a group, then
@mentionit with your message (e.g.,@buda_assistant_bot What is the weather today?).
Available commands:
| Command | Description |
|---|---|
/start or /help | Show welcome message and usage instructions |
/new | Start a new session (clears conversation context) |
/new <message> | Start a new session and immediately send a message |
Notes
- No HTTPS required: unlike webhook mode, long-polling works in local development without ngrok or a public URL.
- Allowed senders: you can restrict which Telegram user IDs can interact with the bot by setting
allowedSenderIdsin the channel credentials (comma-separated numeric IDs). - Groups: the bot only responds when directly
@mentionedin group chats. In direct messages, all messages are processed. - Reconnection: if the network connection drops, Buda will automatically retry with exponential backoff.