Dialog Webhooks
Dialog webhooks are triggered as dialog actions within your AI Agent conversations. Moveo.AI sends information to your custom endpoint using simple HTTP POST calls whenever a webhook action is triggered within your dialog.
You can use dialog webhooks to perform the following actions:
- Validate information collected from the user.
- Send requests to an external application, such as checking the application status of a customer or accessing your inventory to see if a product is available for shipping.
- Trigger an SMS notification or OTP verification.
For common webhook configurations like verifying origin and IP whitelisting, see the Webhooks Overview.
Receiving calls
Whenever a dialog webhook is triggered, Moveo.AI sends a payload of the following format (JSON) to your webhook URL.
Example
{
"channel": "web",
"session_id": "00d2ff33-706e-4a2c-8544-df6c9d0c1ecf",
"brain_id": "d3d08940-f0ef-42e0-993c-1bea065dcqwe",
"lang": "en",
"context": {
"total_months": 3,
"destination": "England",
"sys-unknown_counter": 0,
"sys-channel": "web",
"sys-user_message_counter": 1,
"total_expenses": 500
},
"input": {
"text": "Hello, my name is George and I would like to go for erasmus"
},
"intents": [
{
"intent": "erasmus",
"confidence": 0.89
}
],
"entities": [
{
"entity": "firstname",
"value": "George",
"start": 18,
"end": 36,
"confidence": 1,
"type": "user"
}
],
"tags": ["erasmus", "destination"],
"debug": {
"dialog_stack": [
{
"node_id": "35411a26-cff7-4fb3-a2e9-0e8e6ada048a",
"name": "greetings"
},
{
"node_id": "a85b10e8-e7f3-40df-9715-196c4eae5f14",
"name": "plan_erasmus"
}
]
}
}
Reference
Outer level
| Property | Type | Description |
|---|---|---|
| channel | string | Channel name the message is coming from ("viber", "web" etc.) |
| session_id | string | The ID representing the user that triggered the webhook call |
| brain_id | string | The ID representing the AI Agent for the webhook call |
| verify_token | string | The verify token you specified in the webhook configuration |
| context | Context | Context variables that have been collected for that user so far |
| input | Input | The user input that triggered the dialog node |
| intents | Intent | List of intents recognized, sorted by confidence |
| entities | Entity | List of entities recognized in the user input |
| debug | Debug | Information related to debugging the Moveo.AI dialog state |
Context
Context consists of key-value pairs with the keys representing context variables names and values capturing the user input.
Input
| Property | Type | Description |
|---|---|---|
| text | string | The text that was typed by the user |
Intent
| Property | Type | Description |
|---|---|---|
| intent | string | The intent name |
| confidence | float | The confidence for that intent (between 0 and 1) |
Entity
| Property | Type | Description |
|---|---|---|
| entity | string | The entity type |
| value | string | The entity value from the user's input |
| start | integer | Start index of the value within the user's text |
| end | integer | End index of the value within the user's text |
| confidence | float | Entity detection confidence |
| type | string | Type of entity (ie. "user", "system" etc.) |
Debug/Dialog stack
| Property | Type | Description |
|---|---|---|
| node_id | string | The node id as defined in the dialog |
| name | string | The node name as defined in the dialog |
Sending replies
The webhook expects a JSON response with a specific structure. The response must be a JSON object containing either a context dictionary or a responses array, or both.
context: An object containing key-value pairs for session-specific data.responses: An array of response objects, each specifying a particular type of response.
Context object
The context object is used to store session-specific data that can be passed between requests to maintain state.
Requirements:
- Must be a JSON object.
- Cannot include the following reserved keywords:
"global""channels"
Example:
{
"context": {
"selected_product": "apples",
"amount": "6"
}
}
Responses array
The responses array contains response objects that define how the AI Agent should respond to the user.
Requirements:
- Must be a JSON array.
- Each element must be a JSON object.
- Each response object must have a
"type"field.
Supported response types:
"text""image""video""audio""file""event""carousel""webview""reset"