telegram.bot.set-webhook
Register a public HTTPS URL as the Telegram webhook for a bot identified by bot_uuid, or pass webhook_url='' to clear Telegram's current webhook. Wraps a single setWebhook API call; no DB writes. The bot token is resolved from the TelegramBot row internally.
Call Telegram setWebhook for a bot identified by bot_uuid.
PENDING (auto_advance=execute) → COMPLETED with ok + webhook_url echo ↘ FAILED on any error
Single-responsibility: one API call, no DB writes. The wrapping DAG (telegram.bot.enable-webhook) is responsible for persisting the webhook URL, updating the bot record, and composing the result.
Overview
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | App-telegram |
| Version | 1.0 |
Input Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
bot_uuid | uuid | Yes | — | UUID of the TelegramBot row whose token will be used to call setWebhook. The workflow resolves bot_uuid → bot_token internally. |
webhook_url | string | Yes | — | Public HTTPS URL where Telegram will POST update events, e.g. https://orkestia.ltinteg.local/api/telegram/webhook/<signed_bot_uuid>. Pass the empty string to clear the current Telegram webhook without persisting local bot configuration. |
secret_token | string | No | — | Optional secret token (1–256 chars, [A-Za-z0-9_-]) that Telegram will include in the X-Telegram-Bot-Api-Secret-Token header on every webhook request so the receiver can verify the call's origin. Recommended. |
allowed_updates | json | No | — | Optional list of update types to receive, e.g. ['message', 'callback_query']. If null or empty, Telegram sends all types except chat_member and chat_join_request. |
drop_pending_updates | boolean | No | — | If true, Telegram drops any queued updates from the polling era before activating webhook mode. Useful when switching from long-polling. Defaults to false. |
max_connections | integer | No | — | Maximum number of parallel HTTPS connections Telegram will open to the webhook endpoint (1–100, Telegram default 40). |
workflow_run_id | string | No | — | Engine-stamped parent run id (DAG step target) |
Output Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
ok | boolean | Yes | — | True when Telegram accepted the setWebhook call. Telegram's API always returns true on success for this method. |
webhook_url | string | Yes | — | Echo of the URL that was registered as the webhook. |
failure_reason | string | No | — | Engine-stamped human-readable failure reason |
failure_type | string | No | — | Engine-stamped failure category |
failed_action | string | No | — | Engine-stamped action that raised |
failed_at_state | string | No | — | Engine-stamped state when the workflow failed |
failed_step | string | No | — | Engine-stamped step name (DAG path) |
failed_layer | string | No | — | Engine-stamped layer index (DAG path) |
error | string | No | — | Engine-stamped exception message |
error_type | string | No | — | Engine-stamped exception class name |
States
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | execute | Register webhook URL via Telegram Bot API |
completed | No | Yes | Yes | — | Webhook registered; Telegram confirmed ok=true |
failed | No | Yes | No | — | Webhook registration failed |
State Diagram
Transitions
| From | Action | To | Description |
|---|---|---|---|
pending | execute | completed | — |
* (any state) | fail | failed | — |
API Usage
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "telegram.bot.set-webhook",
"initial_data": {
"bot_uuid": "value",
"webhook_url": "value"
}
}