Skip to content

Telegram

Each tenant can register their own Telegram bot. Messages are sent via the Telegram Bot API, and incoming messages are received through per-bot webhooks.

  1. Create a Telegram bot via @BotFather

    • Send /newbot to BotFather
    • Follow prompts to get your bot_token
  2. Register the bot in Jina Connect

    Terminal window
    curl -X POST http://localhost:8000/telegram/v1/bots/ \
    -H "Authorization: Bearer <token>" \
    -H "Content-Type: application/json" \
    -d '{
    "name": "My Support Bot",
    "bot_token": "123456:ABC-DEF1234...",
    "daily_limit": 1000
    }'

    The response includes a bot_app_id (UUID).

  3. Webhook is auto-registered

    On creation, Jina Connect sets the Telegram webhook to:

    https://your-domain.com/telegram/v1/webhooks/{bot_app_id}/
MethodEndpointDescription
GET/telegram/v1/bots/List all tenant bots
POST/telegram/v1/bots/Register a new bot
GET/telegram/v1/bots/{id}/Get bot details
PUT/telegram/v1/bots/{id}/Update bot config
DELETE/telegram/v1/bots/{id}/Remove bot
GET/telegram/v1/webhook-events/List webhook events
POST/telegram/v1/webhooks/{bot_app_id}/Webhook endpoint (Telegram calls this)

Messages are sent through the message sender service (telegram/services/message_sender.py):

Terminal window
# Via MCP tool (simplest)
# Use the send_message tool with channel="TELEGRAM"
# Via broadcast
curl -X POST http://localhost:8000/broadcast/ \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Telegram Announcement",
"platform": "TELEGRAM",
"message_text": "Hello from Jina Connect!",
"recipients": ["contact-uuid-1", "contact-uuid-2"]
}'
SettingDefaultDescription
TELEGRAM_RATE_LIMIT30/minGlobal rate limit
TELEGRAM_MAX_RETRIES3Max retry attempts
TELEGRAM_REQUEST_TIMEOUT30Request timeout in seconds
daily_limit (per bot)ConfigurableMax messages per day per bot

When a Telegram user messages your bot, their telegram_chat_id and telegram_username are automatically stored on the TenantContact record. This enables:

  • Sending messages to known Telegram contacts
  • Cross-channel contact identity (same contact across WhatsApp + Telegram)
  • Team inbox conversations across channels