Skip to content
Proud to collaborate with Microsoft for Startups

data.telegram.update-event.persist ​

Idempotently insert a TelegramWebhookEvent row keyed on (bot_uuid, update_ref); returns the event_uuid and an already_exists flag

Idempotently insert a TelegramWebhookEvent row for a single Telegram update.

Keyed on (telegram_bot_id, update_id). Two cases:

  • not found → INSERT new row, already_exists=False
  • found → return existing event_uuid, already_exists=True (no mutation)

Accepts bot_uuid and resolves it to the internal integer FK before any DB operation, following the platform UUID-only surface rule.

The organization_id for the new row is sourced from the resolved bot's own organization_id so the caller does not need to supply it.

Overview ​

PropertyValue
Workflow typeAtomic
LibraryApp-telegram
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
bot_uuiduuidYes—UUID of the TelegramBot that received the update
update_refintegerYes—Telegram integer update_ref (monotonically increasing per bot)
update_typestringYes—Type of the update: 'message', 'callback_query', 'inline_query', 'channel_post', 'edited_message', etc.
chat_refintegerNo—Telegram chat_ref the update is from, when applicable. Null for update types that are not chat-scoped (e.g. inline_query).
payloadjsonYes—Raw Telegram update payload as a JSON dict

Output Schema ​

FieldTypeRequiredDefaultDescription
event_uuidstringYes—UUID of the persisted TelegramWebhookEvent row
already_existsbooleanYes—True when the (bot, update_id) pair was already persisted. Callers should treat this as an idempotent no-op — the original row is returned unchanged.
failure_reasonstringNo—Human-readable reason the workflow failed
errorstringNo—Engine-captured exception message
error_typestringNo—Exception class name
failed_at_statestringNo—State name where the failure was recorded
failed_layerstringNo—DAG layer name (N/A for linear workflows)
failed_stepstringNo—DAG step name (N/A for linear workflows)
failed_actionstringNo—Name of the action method that raised
failure_typestringNo—Failure category (e.g. 'not_found')

States ​

StateInitialTerminalSuccessAuto-advanceDescription
pendingYesNo—completePersist Telegram webhook event row
completedNoYesYes—Event row persisted or already existed
failedNoYesNo—Persist failed

State Diagram ​

Transitions ​

FromActionToDescription
pendingcompletecompleted—
pendingfailfailed—

API Usage ​

bash
POST /api/workflows/start
Content-Type: application/json

{
  "workflow_type": "data.telegram.update-event.persist",
  "initial_data": {
    "bot_uuid": "value",
    "update_ref": 123,
    "update_type": "value",
    "payload": "value"
  }
}