In this section we will talk about how to send/receive messages from a Chatbot, the first step is the creation of the conversation, once you have the conversationId you will be able to send a message to the Chatbot through a POST and to receive the message through A GET, while having the capacity to send context information through the body of the POST request as well.
Important: EDDI has a great feature for conversations with chatbots, it's the possibility to go back in time by using the two API endpoints : /undo and /redo !
Creating/initiating a conversation :
Create a Conversation with a Chatbot REST API Endpoint
NoteconversationProperties can also be used in output templating e.g: [[${properties.city}]].
Sample Response
{"botId": "5bf5418c46e0fb000b7636d0","botVersion": 10,"userId": "anonymous-zj1p1GDtM5","environment": "unrestricted","conversationState": "READY","redoCacheSize": 0,"conversationOutputs": [ {"input":"madrid","expressions":"unknown(madrid)","intents": ["unknown" ],"actions": ["current_weather_in_city" ],"httpCalls": {"currentWeather": {"coord": {"lon":-3.7,"lat":40.42 },"weather": [ {"id":800,"main":"Clear","description":"clear sky","icon":"01n" } ],"base":"stations","main": {"temp":10.86,"pressure":1019,"humidity":66,"temp_min":8.33,"temp_max":13.33 },"visibility":10000,"wind": {"speed":5.7,"deg":240 },"clouds": {"all":0 },"dt":1551735805,"sys": {"type":1,"id":6443,"message":0.0049,"country":"ES","sunrise":1551681788,"sunset":1551723011 },"id":3117735,"name":"Madrid","cod":200 } },"properties": {"currentWeather": {"coord": {"lon":-3.7,"lat":40.42 },"weather": [ {"id":800,"main":"Clear","description":"clear sky","icon":"01n" } ],"base":"stations","main": {"temp":10.86,"pressure":1019,"humidity":66,"temp_min":8.33,"temp_max":13.33 },"visibility":10000,"wind": {"speed":5.7,"deg":240 },"clouds": {"all":0 },"dt":1551735805,"sys": {"type":1,"id":6443,"message":0.0049,"country":"ES","sunrise":1551681788,"sunset":1551723011 },"id":3117735,"name":"Madrid","cod":200 },"city":"madrid" },"output": ["The current weather situation of madrid is clear sky at 10.86 °C" ] } ],"conversationProperties": {"city": {"name":"city","value":"madrid","scope":"conversation" } },"conversationSteps": [ {"conversationStep": [ {"key":"input:initial","value":"madrid" }, {"key":"actions","value": ["current_weather_in_city" ] }, {"key":"output:text:current_weather_in_city","value":"The current weather situation of madrid is clear sky at 10.86 °C" } ],"timestamp":1551736024776 } ]}
The conversationId will be provided through the locationHTTP Header of the response, you will use that later to submit messages to the Chabot to maintain a conversation.
The undo and redo methods basically allow you to return a step back in a conversation, this is done by sending a POST along with bot and conversation ids to /bots/{environment}/{botId}/redo/{conversationId} endpoint, the GET call of the same endpoint with the same parameters will allow you to see if the last submitted undo/redo was successful by receiving a true or false in the response body.