In this section we will talk about how to send to and receive messages from a chatbot, the first step is the creation of the conversation, once you have the conversation Id you will be able to send a message to the chatbot through a POST and to receive the message through A GET, while having a the capacity to send context information through the body of the POST request as well.
...
HTTP Method | POST |
---|---|
Api endpoint | /bots/{environment}/{botId} |
{environment} | (Path parameter):String Deployment environment (e.g: |
{botId} | (Path parameter):String Id of the bot that you wish to start conversation with. |
The conversation Id will be provided through the location header, you will use that later to submit messages to the chatbot to maintain a conversation.
Example :
Start conversation with a chatbot.
Code Block | ||
---|---|---|
| ||
Request URL: http://localhost:7070/bots/unrestricted/5ad2ab182de29719b44a792a Response Body no content Response Code 201 Response Headers { "access-control-allow-origin": "*", "date": "Sun, 15 Apr 2018 01:45:09 GMT", "access-control-allow-headers": "authorization, Content-Type", "content-length": "0", "location": "eddi://ai.labs.conversation/conversationstore/conversations/5ad2aea52de29719b44a792c", "access-control-allow-methods": "GET, PUT, POST, DELETE, PATCH, OPTIONS", "access-control-expose-headers": "location", "content-type": null } |
2 - Send and receive messages:
Send :
HTTP Method | POST |
---|---|
Api endpoint | /bots/{environment}/{botId}/{conversationId} |
{environment} | (Path parameter):String Deployment environment (e.g: |
{botId} | (Path parameter):String Id of the bot that you wish tosend a message to. |
{conversationId} | (Path parameter):String id of the conversation that you wish to add the message to. |
returnDetailed | (Query parameter):Boolean - Default : false |
returnCurrentStepOnly | (Query parameter):Boolean - Default : true |
Request Body | { |
...
HTTP Method | GET |
---|---|
Api endpoint | /bots/{environment}/{botId}/{conversationId} |
{environment} | (Path parameter):String Deployment environment (e.g: |
{conversationId} | (Path parameter):String id of the conversation that you wish to add the message to. |
returnDetailed | (Query parameter):Boolean - Default : true |
...
HTTP Method | POST |
---|---|
Api endpoint | /bots/{environment}/{botId}/[undo/redo]/{conversationId} |
{environment} | (Path parameter):String Deployment environment (e.g: |
{conversationId} | (Path parameter):String id of the conversation that you wish to undo the last conversation step. |
Example undo
...
POST:
Code Block | ||||
---|---|---|---|---|
| ||||
Request URL: http://localhost:7070/bots/restricted/5aaf98e19f7dd421ac3c7de9/undo/5ade58dda081a23418503d6f Response Body no content Response Code 200 Response Headers { "access-control-allow-origin": "*", "date": "Mon, 23 Apr 2018 22:20:57 GMT", "access-control-allow-headers": "authorization, Content-Type", "content-length": "0", "access-control-allow-methods": "GET, PUT, POST, DELETE, PATCH, OPTIONS", "content-type": null } |
...