Guide
MOI
Initialization
3 min
initializing a session when a shopper starts a chat session the first time, he or she will not have any sessionid assigned to him/her at this time, a message with the klevu api key should be sent to the moi backend if the api key is valid, the backend in its response will return a sessionid for this shopper and a welcome message to be shown to the shopper request { 	"context" { 	 "klevuapikey" "\<store's api key>" 	} } response { "data" \[{ "context" { "sessionid" "\<some session id>", "klevuapikey" "\<store's api key>" } }, { "message" { "id" "6aed823a 1ecc 457a 8d60 d32972408d78", "type" "text", "value" "i am your shopping assistant how can i help you?", "note" null, "explain" null, "collectfeedback" false } }, ] } json response contents the initialization respose contains the following datapoints context parameter description sessionid the sessionid assigned to the current user and should be used for any subsequent interactions by this user klevuapikey the klevu api key used for the session message there can be one or more of this in a single request when rendering messages on the front, please show them in the order they are provided in the response every message has the following members parameter description id every message is assigned a unique id this is used when submitting shopper’s feedback for this particular message we will see an example of the same a bit later in the document type in the current version, the value of this remains as "text" value the message you want to show to the shopper the value here is usually a plain text but can also contain urls and therefore the respective html anchors in it note this is like a fine print or an instruction or a general note that you may want to show as a fine print to the current message explain why the system has produced the answer it has, the explanation of the same is provided in this element it details the reasoning the backend system has followed in our uis we show them behind the info icon collectfeedback if set to "true", this is an instruction to the frontend that feedback should be collected for this particular message