Skip to main content
View source

Telegram Bot

View as Markdown

A RocketRide source node that connects a Telegram bot to a pipeline; choose it when a bot’s messages and media should initiate pipeline work and receive a reply.

About Telegram

Telegram is a messaging service with a Bot API. This node uses that API to receive updates, download attached files, and send text replies to the originating chat.

What it does

Telegram receives text or supported attachments, sends each item to the matching pipeline lane, and returns the first pipeline answer to the sender. Choose it instead of a generic webhook when the input and response should follow Telegram’s bot update and reply flow. It supports polling for outgoing connections to the Bot API and webhook delivery for a publicly reachable callback.

Lanes

Lane inLane outDescription
_sourcetextText messages are written as text.
_sourceimagePhotos are downloaded and written as JPEG image data.
_sourceaudioAudio files and voice messages are written as audio data.
_sourcevideoVideos are written as video data.
_sourcetagsDocuments are written as tagged data for a downstream parser.

Configuration

Set a bot token, then choose the delivery mode that your deployment can support. Polling is the default and needs no public callback. Webhook mode additionally needs a reachable callback URL.

Connection Mode

polling is the default. It clears any previously registered webhook, repeatedly calls Telegram’s update endpoint with a 30-second server timeout and up to 100 updates, and retries after errors; use it where the pipeline process can make outbound requests but cannot expose a public route.

Choose webhook only when Telegram can POST to a public HTTPS URL that reaches this pipeline. The node registers that URL and derives its local POST route from its path (or /telegram/webhook when the URL has no path). In webhook mode, incoming requests without the generated secret header are rejected with HTTP 403; malformed request bodies return HTTP 500.

Webhook URL

This value is used only in webhook mode. Provide the complete public URL, including the path your reverse proxy or tunnel forwards to the pipeline’s shared web-server port. Leaving it empty makes webhook registration fail; use polling when a public route is unavailable.

Authentication

Set Bot Token to the token for the bot that should receive updates. The node uses it in its Bot API requests and displays only its final six characters in the monitor information. A missing token aborts startup after publishing a missing-token status.

Notes

Message handling and replies

Both new and edited messages are considered. Unsupported updates are ignored. Files reported larger than 20 MiB are skipped before download, and download or pipeline failures return no reply while recording failed bytes in the monitor.

Only the first answer in the pipeline response is sent back. Replies longer than 4,096 characters are truncated with an ellipsis; errors from Telegram’s send operation are logged and do not crash the update handler.

Webhook reachability

Webhook delivery uses the pipeline’s shared web server and requires the process entry point to provide it. The implementation notes that a multi-tenant cloud engine cannot expose an individual pipeline subprocess port to Telegram, so use polling there; the local POST route can still be used by a self-hosted deployment that forwards it publicly.

Upstream docs

Schema

FieldTypeDescriptionDefault
Pipe.source.parametersBot Configuration
telegram.botTokenstringBot Token
Telegram bot token from @BotFather (e.g. 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11)
telegram.modestringConnection Mode
Polling works anywhere without a public URL. Webhook requires a public HTTPS endpoint.
"polling"
telegram.webhookUrlstringWebhook URL
Public HTTPS URL Telegram will POST updates to (e.g. https://your-server.com/telegram/webhook). Required for webhook mode.

Dependencies

  • aiohttp >=3.14.1
  • requests
  • fastapi