דלג לתוכן הראשי
A scenario is the automation behind every webhook subscription: trigger events, optional conditions and loaders, and the actions to run (e.g. the request webhook action). A scenario holds one optional active revision (currently running), any number of inactive revisions (history you can re-activate), and drafts being edited.
Example scenario object
{
  "_id": "6970b3c1d2e3f40123456789",
  "drafts": [],
  "inactiveRevisions": [],
  "activeRevision": {
    "_id": "6970b3c1d2e3f4012345678a",
    "scenarioId": "6970b3c1d2e3f40123456789",
    "name": "(SUB) New Incoming Messages",
    "description": "Sends a webhook for each new incoming message",
    "status": "active",
    "version": 1,
    "triggerEvents": [
      "domain.message.created"
    ],
    "conditions": [
      [
        {
          "name": "filtrex",
          "params": {
            "expression": "direction == \"incoming\""
          },
          "confidentialData": false
        }
      ]
    ],
    "loaders": {
      "afterConditions": [
        {
          "name": "chat",
          "alias": "chat",
          "params": {},
          "confidentialData": false
        }
      ]
    },
    "actions": [
      {
        "name": "request",
        "params": {
          "url": "https://example.com/hook",
          "method": "post",
          "json": true
        },
        "confidentialData": false
      }
    ],
    "options": {
      "unorderedActions": false
    },
    "metadata": {
      "authorUid": "4d170fc7-5cd6-4496-98e4-f4f03a11456e",
      "created": 1768314807488,
      "activated": 1768314808000
    }
  }
}

Top-level

FieldTypeDescription
_idstringUnique identifier of the subscription/scenario - use it in the manage endpoints
activeRevisionobjectThe currently running version (see Revision fields below), or absent when paused
inactiveRevisionsobject[]Previous/paused revisions. Re-activate one with Activate Subscription
draftsobject[]Draft revisions being edited: same shape as a revision but with status: "draft", no version, and metadata limited to authorUid / created / modified
systemstringSystem scenario identifier - present only on built-in scenarios (returned when includeSystem=true)

Revision fields

The shape of activeRevision and each item of inactiveRevisions[].
FieldTypeDescription
_idstringUnique identifier of this revision
scenarioIdstringThe parent scenario ID
namestringHuman-readable name. Subscriptions created from our templates start with (SUB)
descriptionstringOptional description
statusstringactive or inactive
versionnumberVersion number of this revision
parentVersionnumberVersion this revision was based on
revisionCommentstringComment explaining the changes in this revision
triggerEventsstring[]Internal events that trigger the scenario Example: ["domain.message.created"]
conditionsobject[][]Condition groups: all conditions inside a group must pass (AND); the scenario fires if any group passes (OR). Each condition: {name, params, confidentialData}
loadersobjectData loaders by position: beforeConditions[] / afterConditions[], each {name, alias, params, confidentialData}
actionsobject[]Actions to execute: {name, params, confidentialData} - e.g. the request webhook action
loopsobject[]Loop definitions, when iterating: {loop: {input, as, foreachMode...}, position}
tagsstring[]Free-form tags
attachedDataobjectFree-form data attached when the revision was created
options.unorderedActionsbooleantrue = actions may run in parallel; false = sequentially
metadata.authorUidstringUser who created this revision
metadata.creatednumberRevision creation time (epoch ms)
metadata.modifiednumberLast draft modification before publishing (epoch ms)
metadata.activatednumberMost recent activation (epoch ms)
metadata.activationsobject[]Activation history: {timestamp, userUid}