Telegram Trigger

trigger.telegram Input v0.1.0

Starts the workflow for every Telegram bot update — long-polls getUpdates (default) or serves a secret-token-validated webhook. Each update (message, edited message, channel post, callback query, inline query, …) becomes one run with the update object as input.

Ports

DirectionPortLabel
InputinputTelegram update
OutputoutputUpdate

Properties

PropertyTypeDefaultDescription
Credential
credentialId
credential "" Use a stored credential for this connection — its fields are filled in at run start. Pick "None" to enter the connection details manually.
accepts credential templates: telegram-bot
Bot token
token
string "" Telegram bot token — use ${credential.telegram-bot.botToken}. Empty is allowed here; it must resolve by run time.
Mode
mode
select "polling" Polling long-polls getUpdates (works anywhere, no public URL needed). Webhook serves a route Telegram POSTs updates to and registers it with setWebhook at start.
pollingwebhook
Allowed updates
allowedUpdates
multiselect [] Update kinds to receive. Empty = Telegram's default set (every kind except chat_member).
messageedited_messagechannel_postedited_channel_postcallback_queryinline_querychosen_inline_resultmy_chat_memberchat_memberchat_join_requestpollpoll_answer
Poll timeout (s)
pollTimeoutSeconds
int 50 getUpdates long-poll timeout in seconds (0 = short polling; Telegram caps at 50).
Shown when (mode ?? "polling") === "polling"
Webhook path
path
string "/telegram/webhook" The local route Telegram POSTs updates to, e.g. /telegram/webhook.
Shown when mode === "webhook"
Secret token
secretToken
string "" Sent to setWebhook and validated on every update POST (X-Telegram-Bot-Api-Secret-Token). Strongly recommended — without it anyone who finds the URL can forge updates.
Shown when mode === "webhook"
Public URL
publicUrl
string "" The public base URL Telegram can reach, e.g. https://bots.example.com — setWebhook registers {publicUrl}{path}. Blank = the NINER_PUBLIC_URL env at serve start; with neither, the route still serves but setWebhook is skipped (register it out-of-band).
Shown when mode === "webhook"
Base URL
baseUrl
string "https://api.telegram.org" Telegram API base URL (override for testing).
API timeout (ms)
timeoutMs
int 15000 Abort each Bot API management call (setWebhook/deleteWebhook; polling adds the long-poll window on top) after this many milliseconds.

Examples

Polling — no public URL required

The trigger half of the shipped Telegram Echo demo. Long-polling works from behind any NAT:

{
  "id": "tg-in",
  "type": "trigger.telegram",
  "config": {
    "token": "${credential.telegram-bot.botToken}",
    "mode": "polling",
    "pollTimeoutSeconds": 25,
    "allowedUpdates": []
  }
}

Every Telegram update starts a run whose payload is the update object — inspect one run and you have the full field map for expressions ($json.message.text, $json.message.chat.id, $json.callback_query.data, …).

Tips

  • Polling vs webhook. Polling needs only outbound internet. Webhook mode binds path on the app’s server and requires a reachable HTTPS publicUrl — set secretToken so the node can verify Telegram’s X-Telegram-Bot-Api-Secret-Token header.
  • Filter updates at the source. allowedUpdates (e.g. ["message", "callback_query"]) keeps button-clicks and channel noise from starting runs you don’t want.
  • In the editor vs deployed. Test runs poll the same Bot API; deployed apps serve the trigger continuously per the production trigger model.
  • One bot token should drive one consumer at a time in polling mode — Telegram delivers each update to a single getUpdates caller.

This page is generated from the node registry by gen-node-docs.mjs on every site build — ports, properties, defaults and visibility rules cannot drift from the code. The examples above are hand-authored and merged in.