> ## 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.

# Chat Resolved by Bot

> Fires when the bot resolves a chat automatically

ubscribe to receive a notification when a chat is resolved **automatically by the bot** (no human agent assigned). The subscription filters on `chat.agent.uid` being null or missing.

**Event name:** `chatResolvedByBot`\\

**Required token scopes:**

* `Create scenarios`
* `Manage scenarios on behalf of user`

see [Authentication](/api-reference/authentication)

## Subscribe

Send the body below to [Import Subscription](/api-reference/subscribe-to-events/import-subscription-subscribe-to-an-event). You only need to change:

* **`url`** *(required)* - Located under `data.actions[0].params.url`. Replace `{{yourWebhookURL}}` with the destination URL that should receive the events.
* **`asStatus`** - Keep `"active"` to enable the subscription immediately, or `"inactive"` to save it as an inactive revision.

```json Import body [expandable]  theme={null}
{
  "data": {
    "version": "v1",
    "name": "(SUB) Chat Resolved by Bot",
    "description": "Sends a webhook when a chat is resolved automatically by the bot (no human agent assigned).",
    "triggerEvents": [
      "domain.chat.resolved"
    ],
    "loaders": {},
    "conditions": [
      [
        {
          "name": "filtrex",
          "params": {
            "expression": "not exists(agent.uid)",
            "value": "%chat:chat%"
          },
          "confidentialData": false
        }
      ]
    ],
    "actions": [
      {
        "name": "request",
        "params": {
          "url": "{{yourWebhookURL}}",
          "method": "post",
          "json": true,
          "data": {
            "eventName": "chatResolvedByBot",
            "eventData": {
              "chat": {
                "##provide": {
                  "provider": "chat",
                  "key": "chat"
                }
              }
            }
          }
        },
        "confidentialData": false
      }
    ],
    "options": {
      "unorderedActions": false
    }
  },
  "asStatus": "active"
}
```

<Note>
  A `201` response returns your new subscription - save its `_id` to manage it later. You can also add an optional `authorUid` root field (a Texter user UID) to attribute the subscription to a specific user.
</Note>

## Payload

When the event fires, your URL receives an HTTP `POST` with `eventName: "chatResolvedByBot"` and the following `eventData`:

<ResponseField name="chat" type="Chat">
  The resolved chat, with no `agent.uid`. See the [Chat object](/api-reference/objects/chat) for all fields.
</ResponseField>

```json Example payload  theme={null}
{
  "eventName": "chatResolvedByBot",
  "eventData": {
    "chat": {
      "_id": "69062b15262e17ab3033f886",
      "displayName": "Tyler Joseph",
      "status": 3,
      "resolvedUpdateTime": 1761664598,
      "agent": {
        "uid": null
      },
      "...": "..."
    }
  }
}
```

## Manage this subscription

| Action             | Endpoint                                                                              |
| ------------------ | ------------------------------------------------------------------------------------- |
| List subscriptions | [List All Subscriptions](/api-reference/subscribe-to-events/list-all-subscriptions)   |
| Pause              | [Inactivate Subscription](/api-reference/subscribe-to-events/inactivate-subscription) |
| Resume             | [Activate Subscription](/api-reference/subscribe-to-events/activate-subscription)     |
| Delete             | [Delete Subscription](/api-reference/subscribe-to-events/delete-subscription)         |
| Debug executions   | [List Scenario Runs](/api-reference/scenarios-advanced/list-scenario-runs)            |
