Skip to content

Telegram Sink

The Telegram sink allows your workflows to be triggered by messages sent to a Telegram bot. It supports both long polling (local) and webhook (remote) modes.

When running the desktop app, Flow-Like uses Telegram’s getUpdates API to poll for new messages:

┌──────────────┐ getUpdates ┌──────────────┐
│ Flow-Like │◄───────────────────►│ Telegram │
│ Desktop │ (polling) │ Servers │
└──────────────┘ └──────────────┘

Advantages:

  • Works behind firewalls/NAT
  • No public URL required
  • Simple setup

Limitations:

  • Slight delay due to polling interval
  • Must keep the app running

When deployed to a server, Telegram sends updates directly via webhook:

┌──────────────┐ ┌──────────────┐
│ Flow-Like │◄────────────────────│ Telegram │
│ Server │ (webhook) │ Servers │
└──────────────┘ └──────────────┘

Advantages:

  • Instant message delivery
  • More efficient (no polling)
  • Works 24/7
POST /sink/trigger/telegram/{event_id}
FieldTypeDescriptionRequired
tokenstringBot token from @BotFatherYes
webhook_secretstringSecret token for webhook verificationRecommended
bot_namestringDisplay name for the botNo
respond_to_mentionsbooleanRespond to @mentions in groupsNo
respond_to_privatebooleanRespond to private messagesNo
command_prefixstringCommand prefix (default: /)No
chat_whiteliststring[]Only accept from these chat IDsNo
chat_blackliststring[]Ignore these chat IDsNo
  1. Open Telegram and search for @BotFather
  2. Send /newbot and follow the prompts
  3. Copy the bot token (looks like 123456789:ABCdefGHIjklMNOpqrsTUVwxyz)
  4. Paste the token in the Flow-Like configuration

Generate a secret token (64 hex characters recommended):

Terminal window
openssl rand -hex 32

Save this in the webhook_secret field of your event configuration.

The URL format is:

https://your-domain.com/sink/trigger/telegram/{event_id}
Terminal window
curl -X POST "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-domain.com/sink/trigger/telegram/evt_abc123",
"secret_token": "your-webhook-secret"
}'

Check that it’s registered:

Terminal window
curl "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getWebhookInfo"

If you previously set a webhook and want to use local polling:

Terminal window
curl -X POST "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/deleteWebhook"

Set the webhook as described above.

Telegram sends the secret token in the X-Telegram-Bot-Api-Secret-Token header. Flow-Like verifies this header matches your configured secret.

In production, Flow-Like verifies that webhook requests come from Telegram’s IP ranges:

  • 149.154.160.0/20
  • 91.108.4.0/22

This verification is disabled in development mode (when API_BASE_URL contains localhost).

Telegram sends updates in this format:

{
"update_id": 123456789,
"message": {
"message_id": 1,
"from": {
"id": 123456,
"first_name": "John",
"username": "johndoe"
},
"chat": {
"id": 123456,
"type": "private"
},
"date": 1234567890,
"text": "/start hello"
}
}

Only process messages from specific chats:

{
"chat_whitelist": ["123456789", "-100987654321"]
}

Ignore messages from specific chats:

{
"chat_blacklist": ["-100spam_group"]
}

The sink returns a response immediately to acknowledge receipt:

{
"triggered": true,
"run_id": "run_xyz123",
"message": "Webhook received and processing"
}

The actual workflow execution happens asynchronously.

Status CodeDescription
200 OKWebhook received, execution dispatched
401 UnauthorizedInvalid or missing secret token
403 ForbiddenRequest from non-Telegram IP
404 Not FoundNo matching sink found
  1. Always use a webhook secret in production
  2. Set up chat filtering to prevent abuse
  3. Use private groups for sensitive workflows
  4. Monitor bot usage through Telegram’s BotFather stats
  5. Keep the bot token secure - never commit it to version control