> ## Documentation Index
> Fetch the complete documentation index at: https://help.texterchat.com/llms.txt
> Use this file to discover all available pages before exploring further.

# The Scenario object

> An event subscription (scenario) with its revisions and drafts

scenario is the automation behind every [webhook subscription](/he/api-reference/webhooks-guide): 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.

<Info>
  Returned by: [List All Subscriptions](/he/api-reference/subscribe-to-events/list-all-subscriptions) · [Import Subscription](/he/api-reference/subscribe-to-events/import-subscription-subscribe-to-an-event) · [Activate / Inactivate Subscription](/he/api-reference/subscribe-to-events/activate-subscription)
</Info>

```json Example scenario object [expandable]  theme={null}
{
  "_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

| Field               | Type       | Description                                                                                                                                                   |
| ------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `_id`               | `string`   | Unique identifier of the subscription/scenario - use it in the manage endpoints                                                                               |
| `activeRevision`    | `object`   | The currently running version (see Revision fields below), or absent when paused                                                                              |
| `inactiveRevisions` | `object[]` | Previous/paused revisions. Re-activate one with [Activate Subscription](/he/api-reference/subscribe-to-events/activate-subscription)                          |
| `drafts`            | `object[]` | Draft revisions being edited: same shape as a revision but with `status: "draft"`, no `version`, and metadata limited to `authorUid` / `created` / `modified` |
| `system`            | `string`   | System scenario identifier - present only on built-in scenarios (returned when `includeSystem=true`)                                                          |

## Revision fields

The shape of `activeRevision` and each item of `inactiveRevisions[]`.

| Field                      | Type         | Description                                                                                                                                                              |
| -------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `_id`                      | `string`     | Unique identifier of this revision                                                                                                                                       |
| `scenarioId`               | `string`     | The parent scenario ID                                                                                                                                                   |
| `name`                     | `string`     | Human-readable name. Subscriptions created from our templates start with `(SUB)`                                                                                         |
| `description`              | `string`     | Optional description                                                                                                                                                     |
| `status`                   | `string`     | `active` or `inactive`                                                                                                                                                   |
| `version`                  | `number`     | Version number of this revision                                                                                                                                          |
| `parentVersion`            | `number`     | Version this revision was based on                                                                                                                                       |
| `revisionComment`          | `string`     | Comment explaining the changes in this revision                                                                                                                          |
| `triggerEvents`            | `string[]`   | Internal events that trigger the scenario Example: `["domain.message.created"]`                                                                                          |
| `conditions`               | `object[][]` | Condition **groups**: all conditions inside a group must pass (AND); the scenario fires if **any** group passes (OR). Each condition: `{name, params, confidentialData}` |
| `loaders`                  | `object`     | Data loaders by position: `beforeConditions[]` / `afterConditions[]`, each `{name, alias, params, confidentialData}`                                                     |
| `actions`                  | `object[]`   | Actions to execute: `{name, params, confidentialData}` - e.g. the `request` webhook action                                                                               |
| `loops`                    | `object[]`   | Loop definitions, when iterating: `{loop: {input, as, foreachMode...}, position}`                                                                                        |
| `tags`                     | `string[]`   | Free-form tags                                                                                                                                                           |
| `attachedData`             | `object`     | Free-form data attached when the revision was created                                                                                                                    |
| `options.unorderedActions` | `boolean`    | `true` = actions may run in parallel; `false` = sequentially                                                                                                             |
| `metadata.authorUid`       | `string`     | User who created this revision                                                                                                                                           |
| `metadata.created`         | `number`     | Revision creation time (epoch ms)                                                                                                                                        |
| `metadata.modified`        | `number`     | Last draft modification before publishing (epoch ms)                                                                                                                     |
| `metadata.activated`       | `number`     | Most recent activation (epoch ms)                                                                                                                                        |
| `metadata.activations`     | `object[]`   | Activation history: `{timestamp, userUid}`                                                                                                                               |
