data.telegram.message.persist
Insert a TelegramMessage row recording one outbound message dispatch. Non-idempotent — each call creates a new row.
Insert a new TelegramMessage row recording one outbound dispatch.
Non-idempotent INSERT: every call creates a fresh row. The caller (typically a business workflow) is responsible for not calling this twice for the same send event.
Resolution chain: bot_uuid → TelegramBot (must exist, not deleted) chat_uuid → TelegramChat (must exist, not deleted, must belong to same bot) organization_id comes from bot.organization_id — not taken as input.
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 that sent the message |
chat_uuid | uuid | Yes | — | UUID of the TelegramChat the message was dispatched to |
telegram_message_ref | integer | No | — | Telegram integer message reference returned by sendMessage; null when status='failed' or message not yet sent |
text | string | No | — | Message text body |
parse_mode | string | No | — | Telegram parse mode, e.g. 'MarkdownV2' or 'HTML' |
status | string | Yes | — | Dispatch status: 'pending' |
error_reason | string | No | — | Human-readable error description when status='failed' |
workflow_run_id | string | No | — | Engine-stamped parent run id (DAG step target) |
Output Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
message_uuid | string | Yes | — | UUID of the newly inserted TelegramMessage row |
status | string | Yes | — | Echo of the input status |
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 |
bot_uuid | uuid | No | — | bot_uuid echoed from input for diagnostics |
chat_uuid | uuid | No | — | chat_uuid echoed from input for diagnostics |
States
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | complete | Insert TelegramMessage row |
completed | No | Yes | Yes | — | Message row inserted |
failed | No | Yes | No | — | Persist failed |
State Diagram
Transitions
| From | Action | To | Description |
|---|---|---|---|
pending | complete | completed | — |
pending | fail | failed | — |
API Usage
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "data.telegram.message.persist",
"initial_data": {
"bot_uuid": "value",
"chat_uuid": "value",
"status": "value"
}
}