Buda LogoBuda

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

  1. Open Telegram and search for @BotFather, or click the link directly.
  2. Send the command /newbot.
  3. Follow the prompts: enter a display name (e.g., Buda Assistant), then a username ending in bot (e.g., buda_assistant_bot).
  4. BotFather will reply with your Bot Token — a string like 1234567890:AAFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
  5. 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

  1. Open Channels Settings in Buda (Settings → Channels).
  2. Click Add Channel and select Telegram.
  3. Paste the Bot Token you copied from BotFather.
  4. Optionally set a Label and select a Target Agent.
  5. 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 @mention it with your message (e.g., @buda_assistant_bot What is the weather today?).

Available commands:

CommandDescription
/start or /helpShow welcome message and usage instructions
/newStart 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 allowedSenderIds in the channel credentials (comma-separated numeric IDs).
  • Groups: the bot only responds when directly @mentioned in group chats. In direct messages, all messages are processed.
  • Reconnection: if the network connection drops, Buda will automatically retry with exponential backoff.

On this page