Skip to main content

Overview

The Telegram integration lets you deploy Nadoo AI agents as Telegram bots. Users interact through private chats, group chats, and inline commands. The integration supports inline keyboards, file attachments, location sharing, and rich media messages.

Setup

1

Create a Bot via BotFather

  1. Open Telegram and search for @BotFather.
  2. Send the /newbot command.
  3. Follow the prompts:
    • Enter a display name for your bot (e.g., “Nadoo AI Agent”)
    • Enter a username for your bot (must end in bot, e.g., nadoo_ai_agent_bot)
  4. BotFather will reply with your Bot Token (a string like 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11). Copy and save it securely.
2

Configure Bot Settings (Optional)

While still in the BotFather chat, you can configure additional settings:
CommandPurpose
/setdescriptionSet the bot’s description shown in its profile
/setabouttextSet the “About” text shown when users view bot info
/setuserpicUpload a profile picture for the bot
/setcommandsDefine the command menu (see below)
Setting bot commands:Send /setcommands to BotFather, select your bot, and enter commands in this format:
start - Start a conversation with the agent
ask - Ask a question
search - Search the knowledge base
help - Show available commands
3

Configure in Nadoo AI

In the Nadoo AI platform:
  1. Navigate to your workspace and open Channels.
  2. Click Add Channel and select Telegram.
  3. Enter the following:
FieldValue
Bot TokenThe token from BotFather
WorkflowSelect the workflow to handle Telegram messages
  1. Click Save and toggle the channel to Active.
Nadoo AI automatically registers the webhook URL with Telegram using the Bot API’s setWebhook method. No manual webhook configuration is required.
4

Test the Integration

Open Telegram, search for your bot by its username, and send /start or a test message. The bot should respond using the configured workflow.

Webhook Configuration

When you activate the Telegram channel in Nadoo AI, the platform automatically calls the Telegram setWebhook API to register the webhook URL:
POST https://api.telegram.org/bot{token}/setWebhook
{
  "url": "https://your-instance.example.com/api/v1/webhooks/handle/telegram",
  "allowed_updates": ["message", "callback_query", "inline_query"]
}

Webhook Details

SettingValue
EndpointPOST /api/v1/webhooks/handle/telegram
VerificationTelegram sends updates only to the registered URL. Nadoo AI validates the request source.
Secret TokenAn optional secret token is set during webhook registration and verified in the X-Telegram-Bot-Api-Secret-Token header.
Auto-registrationWebhook is registered automatically when the channel is activated.
If you need to change the webhook URL (e.g., after a domain change), deactivate and reactivate the Telegram channel in Nadoo AI. The platform will re-register the webhook with the new URL.

Supported Features

Message Types

FeatureDescription
Text messagesStandard text messages in private and group chats
Bot commandsMessages starting with / (e.g., /ask, /search)
RepliesUsers can reply to bot messages to continue a conversation thread
Group chatsThe bot responds when mentioned or when commands are used in group chats
Forwarded messagesUsers can forward messages to the bot for processing

Interactive Keyboards

Telegram supports two types of keyboards for interactive responses.
Inline keyboards appear directly below a bot message and allow users to interact without typing.
{
  "reply_markup": {
    "inline_keyboard": [
      [
        { "text": "Yes", "callback_data": "confirm_yes" },
        { "text": "No", "callback_data": "confirm_no" }
      ],
      [
        { "text": "Learn More", "url": "https://docs.example.com" }
      ]
    ]
  }
}
When a user clicks a button, Telegram sends a callback_query update to the webhook. The workflow receives the callback_data value and can branch accordingly.

File Attachments

FeatureDescription
Photo messagesUsers can send photos. The bot can process images using multimodal AI models.
Document messagesUsers can send files (PDF, DOCX, etc.) for processing by the knowledge base.
Voice messagesUsers can send voice recordings. The bot can transcribe audio using STT.
Location sharingUsers can share their location. The bot receives coordinates.
Contact sharingUsers can share contact cards.

Bot Responses

FeatureDescription
Text with MarkdownResponses support Telegram’s MarkdownV2 formatting
PhotosThe bot can send images as responses
DocumentsThe bot can send files (reports, exports)
Typing indicatorThe bot shows “typing…” while processing the request

Bot Commands

Define the commands that appear in Telegram’s command menu. Users can tap the / button to see available commands.
CommandDescription
/startBegin a conversation with the bot
/helpShow available commands and usage instructions
/ask [question]Ask the AI agent a question
/search [query]Search the knowledge base
/resetClear conversation history and start fresh

Command Handling

Commands are detected by the Telegram adapter and routed to the configured workflow. The command name and arguments are passed as structured input:
{
  "command": "ask",
  "arguments": "How does the refund policy work?",
  "user_id": "123456789",
  "chat_id": "987654321",
  "chat_type": "private"
}

Group Chat Configuration

When used in group chats, the bot can be configured to respond only to specific triggers.
ModeBehavior
Mention onlyBot responds only when mentioned by @username
Command onlyBot responds only to / commands
All messagesBot responds to every message in the group (use with caution)
Configure the group mode in the Nadoo AI channel settings:
{
  "group_mode": "mention_only",
  "privacy_mode": true
}
Set privacy_mode: true (the default) so the bot only receives messages that are directly addressed to it in group chats. This reduces unnecessary processing and respects user privacy.

Troubleshooting

IssueSolution
Bot does not respondVerify the bot token is correct and the channel is Active in Nadoo AI
Webhook registration failedCheck that your Nadoo AI instance is accessible via HTTPS with a valid SSL certificate. Telegram requires HTTPS for webhooks.
Bot responds in private but not in groupsEnable group mode and ensure the bot has been added to the group. Check privacy_mode settings.
Keyboard buttons not workingVerify that callback_data values are being handled in your workflow’s condition nodes

Next Steps