post https://api.clustaar.io/interlocutors//reply
Get answer from a bot
This endpoint is useful to get answers from a bot.
It takes a message or an action in input and sends back actions from the bot.
Request
The request can be a text message, a go_to_action
(in case of a button click) or an event (configured in the webchat channel).
If you sent a text message :
Attribute | Type | Description |
---|---|---|
type | string | must be text |
message | string | the message content (0 < length < 500) |
{
"type": "text",
"message": "hello",
}
If user clicked on a button you must send the go_to_action
associated to that button :
Attribute | Type | Description |
---|---|---|
type | string | must be go_to_action |
target | object | action destination |
target.type | string | can be step or story |
target.id | string | target ID |
{
"type": "go_to_action",
"target": {
"type": "step",
"id": "5a674ade24acbe05a8c9ade0"
}
}
If you want to trigger an event configured in the Webchat channel, you to use a custom_event
Attribute | Type | Description |
---|---|---|
type | string | must be custom_event |
name | string | your event name |
{
"name": "EVENT_NAME",
"type": "custom_event"
}
Response
Attribute | Type | Description |
---|---|---|
fulfillment | object | the bot response |
fulfillment.actions | array<Action> | list of the actions returned by the bot |
fulfillment.source | object | where did these actions come from (can be step_actions , step_fallback_actions or story_fallback_actions ) |
session | object | the interlocutor's session object |
session.values | object | the interlocutor's session values |
interlocutor | object | the interlocutor object |
input | object | input received from interlocutor |
debug | object | filled only if debug parameter is 1 , contains some debug information (webhook calls and intent detections scores) |
debug.intentDetections | array | contains the list of the detections triggered during the call |
debug.intentDetections.query | string | query analyzed by the intent detector |
debug.intentDetections.results | array | results returned for query |
debug.intentDetections.results.intent | object | intent detected for query |
debug.intentDetections.results.score | float | detection score |
debug.intentDetections.results.parameters | array | parameters extracted from query |
debug.webhookCalls | array | webhook calls that happened during call |
debug.webhookCalls.request | object | HTTP request sent to webhook |
debug.webhookCalls.response | object | HTTP response from webhook |
debug.webhookCalls.error | string | error while processing the webhook response |
{
"data": {
"fulfillment": {
"actions": [
{
"type": "send_text_action",
"alternatives": [
"Hi!"
]
}
],
"source": {
"type": "step_actions",
"step": {
"type": "step",
"id": "5a674ade24acbe05a8c9ade0",
"name": "First step"
}
}
},
"session": {
"values": {}
},
"interlocutor": {
"type": "interlocutor",
"id": "5a674af524acbe7f2cb0d31a"
},
"input": {
"type": "text",
"message": "hello"
},
"debug": {
"intentDetections": [
{
"type": "intent_detection",
"query": "hello",
"results": [
{
"type": "intent_matching",
"intent": {
"id": "5a675cf724acbe4147b8e499",
"name": "bonjour"
},
"score": 1,
"parameters": [
{
"name": "bonjour",
"value": "bonjour"
}
]
}
]
}
],
"webhookCalls": [
{
"request": {
"method": "POST",
"url": "https://example.com",
"body": "{}"
},
"response": {
"status": 200,
"body": "{"
},
"error": "RequestFailed: Invalid JSON document (JSON document from response is invalid)"
}
]
}
}
}