# Rule Execution webhook

The Rule Execution webhook sends language operator results to your webhook endpoint as an HTTP `POST` request when they're generated.

Each webhook payload includes all language operator results generated by the rule execution.

To receive this webhook, you must [define a rule](/docs/conversations/intelligence/define-rules) with a valid action (`type: webhook`) in your intelligence configuration.

## Rule Execution webhook payload properties

| Property                    | Type              | Description                                                                                                |
| --------------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------- |
| `accountId`                 | string (Sid\<AC>) | The SID of the account that generated the webhook.                                                         |
| `conversationId`            | string            | The ID of the Conversation associated with the rule execution that produced the language operator results. |
| `intelligenceConfiguration` | object            | The metadata for the intelligence configuration that generated the language operator results.              |
| `operatorResults`           | array of objects  | The list of language operator results generated by the intelligence configuration.                         |

### intelligenceConfiguration

| Property      | Type    | Description                                                                                   |
| ------------- | ------- | --------------------------------------------------------------------------------------------- |
| `id`          | string  | The ID of the intelligence configuration.                                                     |
| `displayName` | string  | The display name of the intelligence configuration describing its purpose.                    |
| `version`     | integer | The version of the intelligence configuration used to generate the language operator results. |
| `ruleId`      | string  | The ID of the intelligence configuration rule used to generate the language operator results. |

### operatorResults

| Property           | Type             | Description                                                                                                                                                                                                 |
| ------------------ | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`               | string           | The ID of the language operator result.                                                                                                                                                                     |
| `operator`         | object           | The metadata for the language operator that generated the result.                                                                                                                                           |
| `outputFormat`     | string           | The structure of the result returned by the language operator. Possible values are: <ul><li>`TEXT`: Plain text</li><li>`JSON`: Structured JSON object</li><li>`CLASSIFICATION`: Classifier string</li></ul> |
| `result`           | object           | The output from the language operator execution. The structure of the object varies based on `outputFormat`.                                                                                                |
| `dateCreated`      | string           | The date and time when the language operator result was created, in ISO 8601 format.                                                                                                                        |
| `referenceIds`     | array of strings | The IDs of objects related to the language operator result.                                                                                                                                                 |
| `executionDetails` | object           | The details about the conditions under which the language operator executed.                                                                                                                                |
| `metadata`         | object           | System metadata about the language operator execution, including latency and character counts.                                                                                                              |

#### operatorResults.operator

| Property      | Type           | Description                                                                                             |
| ------------- | -------------- | ------------------------------------------------------------------------------------------------------- |
| `id`          | string         | The ID of the language operator.                                                                        |
| `displayName` | string         | The display name of the language operator describing its purpose.                                       |
| `version`     | integer        | The version of the language operator.                                                                   |
| `parameters`  | object or null | The parameter keys and values passed to the language operator at execution time. Null if not specified. |

#### operatorResults.executionDetails

| Property          | Type             | Description                                                                                                                                                     |
| ----------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `trigger`         | object           | The metadata for the trigger used to execute the rule.                                                                                                          |
| `communications`  | object           | The range of first and last communications in the Conversation that were processed by the rule execution.                                                       |
| `channels`        | array of strings | The communication channels included in the Conversation during the rule execution. Possible values include: `SMS`, `VOICE`, `WHATSAPP`, `RCS`, `CHAT`, `EMAIL`. |
| `participants`    | array of objects | The metadata for the participants included in the Conversation during the rule execution.                                                                       |
| `resolvedContext` | object           | The contextual data that was resolved and used during the rule execution.                                                                                       |

#### operatorResults.executionDetails.trigger

| Property    | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ----------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `on`        | string | The conversational lifecycle event that triggered execution of the rule. Possible values are: <ul><li>`COMMUNICATION`: Trigger the rule on each communication (or every *n*th communication) within the Conversation.</li><li>`CONVERSATION_INACTIVE`: Trigger the rule when the Conversation moves to the `inactive` state.</li><li>`CONVERSATION_END`: Trigger the rule when the Conversation moves to the `closed` state.</li></ul> |
| `timestamp` | string | The date and time when the trigger was activated, in ISO 8601 format.                                                                                                                                                                                                                                                                                                                                                                  |

#### operatorResults.executionDetails.communications

| Property | Type           | Description                                                        |
| -------- | -------------- | ------------------------------------------------------------------ |
| `first`  | string or null | The ID of the first communication processed by the rule execution. |
| `last`   | string or null | The ID of the last communication processed by the rule execution.  |

#### operatorResults.executionDetails.participants

| Property    | Type           | Description                                                                          |
| ----------- | -------------- | ------------------------------------------------------------------------------------ |
| `id`        | string or null | The ID of the participant.                                                           |
| `profileId` | string or null | The profile ID associated with Conversation Memory.                                  |
| `type`      | string or null | The type of participant. Possible values are: `HUMAN_AGENT`, `CUSTOMER`, `AI_AGENT`. |

#### operatorResults.executionDetails.resolvedContext

| Property    | Type           | Description                                                              |
| ----------- | -------------- | ------------------------------------------------------------------------ |
| `memory`    | object or null | The Conversation Memory information resolved during the rule execution.  |
| `knowledge` | object or null | The Enterprise Knowledge information resolved during the rule execution. |

#### operatorResults.executionDetails.resolvedContext.memory

| Property        | Type   | Description                                              |
| --------------- | ------ | -------------------------------------------------------- |
| `profileId`     | string | The profile ID associated with Conversation Memory.      |
| `memoryStoreId` | string | The memory store ID associated with Conversation Memory. |

#### operatorResults.executionDetails.resolvedContext.knowledge

| Property  | Type             | Description                                                       |
| --------- | ---------------- | ----------------------------------------------------------------- |
| `sources` | array of objects | The list of knowledge sources resolved during the rule execution. |

#### operatorResults.executionDetails.resolvedContext.knowledge.sources

| Property   | Type   | Description                     |
| ---------- | ------ | ------------------------------- |
| `baseId`   | string | The ID of the knowledge base.   |
| `sourceId` | string | The ID of the knowledge source. |

#### operatorResults.metadata

| Property | Type   | Description                                                  |
| -------- | ------ | ------------------------------------------------------------ |
| `system` | object | System-level metadata about the language operator execution. |

#### operatorResults.metadata.system

| Property           | Type    | Description                                                                                                                                                 |
| ------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `latencyMs`        | integer | The execution latency in milliseconds.                                                                                                                      |
| `resolvedModel`    | string  | The AI model used for this execution.                                                                                                                       |
| `inputCharacters`  | integer | The total number of input characters sent to the AI model. See [Understanding billing](/docs/conversations/intelligence/understanding-billing) for details. |
| `outputCharacters` | integer | The total number of output characters generated by the AI model.                                                                                            |
| `inputTruncated`   | boolean | Whether the input was truncated to fit within model context limits.                                                                                         |

## Rule Execution webhook payload example

The following is an example of a Rule Execution webhook payload:

```json title="Example: Rule Execution webhook payload"
{
  "accountId": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "conversationId": "conv_conversation_772a49ae-48e7-4d18-9db5-a40f6203de01",
  "intelligenceConfiguration": {
    "id": "intelligence_configuration_0hcq1h4zbqcpr8ceyyk4cde7kr",
    "displayName": "Real-time Sentiment Analyzer",
    "version": 1,
    "ruleId": "intelligence_configurationrule_01kc6nrdc4f509sgccvd8hc27c"
  },
  "operatorResults": [
    {
      "id": "intelligence_operatorresult_01kc6nrdc4f9vrt6t2ypcy8b75",
      "operator": {
        "id": "intelligence_operator_01kcrvw16kfa88qvgrfmr7y151",
        "displayName": "Sentiment",
        "version": 2,
        "parameters": null
      },
      "outputFormat": "CLASSIFICATION",
      "result": {
        "label": "positive"
      },
      "dateCreated": "2026-03-11T12:33:36.143498Z",
      "referenceIds": [],
      "executionDetails": {
        "trigger": {
          "on": "COMMUNICATION",
          "timestamp": "2026-03-11T12:33:35.987654Z"
        },
        "communications": {
          "first": "conv_communication_00000000000000000000000000",
          "last": "conv_communication_00000000000000000000000001"
        },
        "channels": [
          "SMS"
        ],
        "participants": [
          {
            "id": "conv_participant_00000000000000000000000000",
            "profileId": "mem_profile_00000000000000000000000000",
            "type": "CUSTOMER"
          },
          {
            "id": "conv_participant_00000000000000000000000001",
            "profileId": null,
            "type": "HUMAN_AGENT"
          }
        ],
        "resolvedContext": {
          "memory": {
            "profileId": "mem_profile_00000000000000000000000000",
            "memoryStoreId": "mem_store_00000000000000000000000000"
          },
          "knowledge": {
            "sources": [
              {
                "baseId": "know_knowledgebase_00000000000000000000000000",
                "sourceId": "know_knowledge_00000000000000000000000000"
              }
            ]
          }
        }
      },
      "metadata": {
        "system": {
          "latencyMs": 1842,
          "resolvedModel": "gpt-5.4-mini",
          "inputCharacters": 3830,
          "outputCharacters": 150,
          "inputTruncated": false
        }
      }
    }
  ]
}
```

## Resources

* [Define rules](/docs/conversations/intelligence/define-rules)
* [Explore language operator results](/docs/conversations/intelligence/explore-language-operator-results)
* [Integrate language operator results with your application](/docs/conversations/intelligence/integrate-results-with-application)
