After the chat conversation flow has been initiated, it goes through the WebSocket connection in a simple send-and-receive message fashion.
Below, we will explore the messages interchanged between the different parties:
JS Client 🠒 Certainly
There is one type of message:
{ "error":null, "message":{ "user_profile":{ }, "ref":null, "user_id":"webbot:d0f23640-2dc2-11e8-a182-89f9297141e0", "timestamp":1521717539, "message":"Hello", "attachments":[ ] } }
Certainly 🠒 JS Client
Simple text response:
{ "type":"text", "text":"Hello from Bot!" }
Response with Suggested Replies:
{ "type":"choice", "text":"Example message!", "options_type":"suggested_replies", "options":[ "yes", "no" ] }
Response with Cards:
{ "type":"card", "cards":[ { "text":"google", "title":"Google", "image_source_url":"", "buttons":[ { "is_active":true, "title":"Button 1 label", "options":{ "message":"Hello" }, "type":"postback" } ], "image_destination_url":"http://www.google.es" } ] }
Certainly 🠒 Third-party
The message that comes from the user is sent via a POST Webhook:
{ "interlocutor":"user", "data":{ "error":null, "message":{ "user_profile":{ }, "ref":null, "user_id":"webbot:d0f23640-2dc2-11e8-a182-89f9297141e0", "timestamp":1521717539, "message":"Hello", "attachments":[ ] } } }
The message that comes from the bot is sent via a POST Webhook:
{ "interlocutor":"bot", "data":{ "type":"text", "text":"Hello from Bot!" } }
The structure that comes inside the property "data" can be one of the messages in Certainly 🠒 JS Client.