Webhooks
Webhook integration

Telegram Bot Webhooks: Send Bot Updates to Sazabi

By Sazabi Team

Webhook facts checked on the platform’s docs on Nov 8, 2026.

A Telegram bot can receive updates in two ways: your code polls getUpdates, or Telegram pushes each update to a URL you register with setWebhook. This page covers the push method and sending those updates to Sazabi.

What Telegram sends

Each request is an HTTPS POST whose body is a JSON-serialized Update. An Update has an update_id and at most one of the optional fields: message, edited_message, channel_post, edited_channel_post, callback_query, inline_query, my_chat_member and others.

By default a bot receives every update type except chat_member, message_reaction and message_reaction_count. Pass allowed_updates to setWebhook to narrow or widen that list. The update_id increases sequentially, which lets you drop repeats and restore order.

Why send it to Sazabi

Bots are small programs that talk to real people, and their traffic is easy to lose. Sazabi's Webhook Events source stores each JSON payload as a searchable log record, with the payload under webhook.* attributes. For a bot that raises alerts, takes commands or collects replies, that gives you a searchable history of what users sent and when.

One constraint matters before you start. A bot has one webhook URL, and no getUpdates while it's set. If you point your production bot at Sazabi, your bot's own server stops receiving updates. Use a dedicated bot for observation, or keep your server as the webhook target and log from there.

Add a path suffix such as /telegram to the intake URL. Sazabi stores it as webhook.path.

Set it up with the Bot API

You register the webhook with an API call that uses your bot token, which BotFather gave you. Keep the token in an environment variable, not in shell history.

curl -sS "https://api.telegram.org/bot${BOT_TOKEN}/setWebhook" \
  --data-urlencode "url=<your intake URL>/telegram" \
  --data-urlencode 'allowed_updates=["message","callback_query"]'

A successful call returns ok set to true. Then send your bot a message and call getWebhookInfo:

curl -sS "https://api.telegram.org/bot${BOT_TOKEN}/getWebhookInfo"

Look at pending_update_count, last_error_date and last_error_message. To undo it, call deleteWebhook, with drop_pending_updates if you want to discard queued updates.

Telegram's webhook guide lists what the receiving server needs: HTTPS on port 443, 80, 88 or 8443, TLS 1.2 or later, a certificate whose name matches the host, and IPv4 support. Check last_error_message after your first message to confirm Telegram can reach the intake URL.

Example payload

An abbreviated Update for a text message, using field names from the Bot API docs. It is an example, not a captured delivery.

{
  "update_id": 100200301,
  "message": {
    "message_id": 77,
    "from": { "id": 424242, "is_bot": false, "first_name": "Sam", "username": "sam_r" },
    "chat": { "id": 424242, "type": "private" },
    "date": 1762560000,
    "text": "/status"
  }
}

In a Sazabi thread, search for a top-level field such as webhook.update_id, or for a command string, to find a conversation.

Updates include names, usernames, chat IDs and message text. Use allowed_updates to keep only the types you need.

What to watch for

  • Pending updates. A rising pending_update_count in getWebhookInfo means Telegram is holding updates it couldn't deliver.
  • Last error. last_error_message is the quickest explanation for a stop, such as a certificate or connection problem.
  • Duplicates and order. Use update_id to ignore repeats and restore order.
  • Connection limits. max_connections defaults to 40 simultaneous HTTPS connections, from 1 to 100. A chatty bot can open many.
  • Gaps. If updates stop while users are still messaging the bot, check getWebhookInfo before anything else. Anyone holding the bot token can set a different webhook on the same bot.

The Intake page in the Sazabi dashboard shows ingestion volume per source, so a flat line is easy to see.

Retries

When a request gets a response other than 2XX, Telegram repeats it and gives up after what the docs call a reasonable amount of attempts. The docs give no exact count or schedule, so don't plan around one. Pending updates show up in pending_update_count.

Telegram can send a secret_token header with each request. It's a plain value, not a signature. If your bot answers form-style questions, Typeform covers a similar event stream, and SendGrid covers email events.

Telegram webhook facts

Signatures: Sazabi doesn’t verify Telegram requests and doesn’t reject unsigned ones. Telegram’s secret token is a plain value in the X-Telegram-Bot-Api-Secret-Token header, not a signature. The Webhook Events source accepts any JSON POST to your intake URL, so the intake URL is the only credential. It’s hard to guess, so keep it private, and rotate the project’s public key if it leaks.

  • Events: An Update carries at most one of fields such as message, edited_message, channel_post, callback_query, inline_query and my_chat_member, and allowed_updates selects which types the bot receives. (Telegram docs, accessed Nov 8, 2026)
  • Payload: Whenever there is an update for the bot, Telegram sends an HTTPS POST request to the specified URL containing a JSON-serialized Update. (Telegram docs, accessed Nov 8, 2026)
  • Signing: If you pass secret_token to setWebhook, every webhook request carries it in the X-Telegram-Bot-Api-Secret-Token header so you can confirm the webhook was set by you. (Telegram docs, accessed Nov 8, 2026)
  • Retries: On an unsuccessful request, meaning a response status other than 2XY, Telegram repeats the request and gives up after a reasonable amount of attempts. (Telegram docs, accessed Nov 8, 2026)

Frequently Asked Questions

How do I set a Telegram webhook?

Call the Bot API method setWebhook with the url parameter. Telegram then sends an HTTPS POST with a JSON Update for each event to that URL.

Can I use getUpdates and a webhook at the same time?

No. The Bot API says you will not receive updates through getUpdates for as long as an outgoing webhook is set. Call deleteWebhook to switch back.

How do I check why Telegram deliveries are failing?

Call getWebhookInfo. It returns pending_update_count, last_error_date and last_error_message for the most recent delivery error.

Does Sazabi verify Telegram signatures?

No. Telegram’s secret token is a plain value in the X-Telegram-Bot-Api-Secret-Token header, not a signature. Sazabi doesn’t reject unsigned requests, so keep the intake URL private: it’s the only credential.

Sources

  1. setWebhook parameters: url, max_connections, allowed_updates, drop_pending_updates and secret_token, the HTTPS POST of a JSON-serialized Update and the retry statement (accessed Nov 8, 2026)
  2. WebhookInfo fields: url, pending_update_count, last_error_date, last_error_message and allowed_updates (accessed Nov 8, 2026)
  3. Update object: update_id and the optional fields such as message, edited_message, channel_post and callback_query (accessed Nov 8, 2026)
  4. Webhook requirements: supported ports 443, 80, 88 and 8443, TLS 1.2 or later, a certificate matching the host and IPv4 support (accessed Nov 8, 2026)
  5. Webhook Events source: JSON only, payload under webhook.* attributes, path suffix stored as webhook.path; signature verification with the Standard Webhooks and Custom HMAC options, and rejected deliveries (accessed Nov 8, 2026)