> For the complete documentation index, see [llms.txt](https://mind-expression-docs.gitbook.io/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mind-expression-docs.gitbook.io/home/concepts/webhooks-and-escalation.md).

# Webhooks and escalation

### Webhooks

The way your AI communicates with external enterprise systems is using webhooks. A webhook is a way for a system or app to provide another system or platform with real-time data in JSON, XML, or form-encoded serialization. Mind Expression is currently only allowing JSON as a standard data interchange format. The main purpose of a webhook is for data integration between our platform and the enterprise's backend system using a service URL.

Webhooks pertaining to a Scope require configuration to become available to a Subject. Preconfigured webhooks will be used when configuring a Subject for response message manipulation. Currently, Mind Expression supports both HTTP and HTTPS protocols, and Basic Authentication for security authentication mechanisms. You can also manipulate the HTTP headers of the webhook. [Mustache template](https://mustache.github.io/) will be used to manipulate a JSON template in the form of a DSL (Domain Specific Language), or to build a GET URL (query Parameter or resource URI). [JSONPath](https://jsonpath.com/) will be used to parse data from the JSON payload.

### Escalation

Using an escalation URL, which is an optional webhook, you can send the entire chat script to your enterprise backend system to the human agent on the escalation in case of unsuccessful session termination.

On escalation, Mind Expression sends the entire chat script to the escalation webhook endpoint. The sample JSON schema is as follows.

### **Subjects**

**Name**

* What subject the escalation happens

**HTTP-headers**

* The same HTTP header that was sent on conversation API from the enterprise system

**Conversation-id**

* A unique identifier to distinguish between conversations for your reference

### **Conversations**

**User**

* A query from the customer

**AI**

* The response from Mind Expression

```
{
  "subject": {
    "id": "7805b4a9-7128-462b-a7c1-5c04cbb2643b",
    "name": "Change Mobile Package",
    "logical-form": "User wants to change the mobile package"
  },
  "http-headers": [
    {
      "name": "uuid",
      "value": "2826452c-ce7e-4f59-9e14-105a489909f4"
    }
  ],
  "conversation-id": "b8103db7-d31d-4c1a-a6c2-3bf6958fa254",
  "conversations": [
    {
      "timestamp": 1615861988000,
      "user": null,
      "ai": [
        "Welcome to Mind Expression. How can I help you?"
      ]
    },
    {
      "timestamp": 1615861999000,
      "user": "I want to change my mobile package",
      "ai": [
        "These are the Mobile Phone numbers you have. 0101002000 0101012001 0101022002 Which Mobile Phone Number do you want to change package?"
      ]
    }
  ]
}

```

* To learn more about how to set up webhook and escalation, see [How-to Guides: Set up webhook and escalation](/home/how-to-guides/set-up-webhooks-and-escalation.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mind-expression-docs.gitbook.io/home/concepts/webhooks-and-escalation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
