Post 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 :

AttributeTypeDescription
typestringmust be text
messagestringthe 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 :

AttributeTypeDescription
typestringmust be go_to_action
targetobjectaction destination
target.typestringcan be step or story
target.idstringtarget 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

AttributeTypeDescription
typestringmust be custom_event
namestringyour event name
{
    "name": "EVENT_NAME",
    "type": "custom_event"
}

Response

AttributeTypeDescription
fulfillmentobjectthe bot response
fulfillment.actionsarray<Action>list of the actions returned by the bot
fulfillment.sourceobjectwhere did these actions come from (can be step_actions, step_fallback_actions or story_fallback_actions)
sessionobjectthe interlocutor's session object
session.valuesobjectthe interlocutor's session values
interlocutorobjectthe interlocutor object
inputobjectinput received from interlocutor
debugobjectfilled only if debug parameter is 1, contains some debug information (webhook calls and intent detections scores)
debug.intentDetectionsarraycontains the list of the detections triggered during the call
debug.intentDetections.querystringquery analyzed by the intent detector
debug.intentDetections.resultsarrayresults returned for query
debug.intentDetections.results.intentobjectintent detected for query
debug.intentDetections.results.scorefloatdetection score
debug.intentDetections.results.parametersarrayparameters extracted from query
debug.webhookCallsarraywebhook calls that happened during call
debug.webhookCalls.requestobjectHTTP request sent to webhook
debug.webhookCalls.responseobjectHTTP response from webhook
debug.webhookCalls.errorstringerror 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)"
               }
           ]
       }
   }
}
Language