Response types
Text
Type of response should be "text" in the JSON when the bot should respond with static text to the incoming event. Value should be a string.
"state":
{
"response": {
"type": "text",
"value": "Your static response"
}
}
Microbot
Type of response should be "mb" in the JSON when bot should spawn another state machine (Micro bot) as a response to the current event. Value should be the name of the microbot.
"order":
{
"response": {
"type": "mb",
"value": "menu"
}
}
Function
Type of response should be "function" in the JSON when bot should call a function which then accesses Data store, to use the data (entities) collected during the conversation and can do further processing which might be an API call or any other function. Value should be the function name. Function signature should be function handle(uuid, store, replyCallback)
. replyCallback
takes a string
argument which is sent as a response to the event. These functions will be available in the impl.js
file which can be implemented as per the requirements.
"confirmOrder":
{
"response": {
"type": "function",
"value": "uploadOrder"
}
}
different ways to use replyCallback
replyCallback('text', 'This is text reply');
replyCallback('microbot', 'microbotName');
// Use this to spawn another microbot as a response to the current user intent
replyCallback('transition', 'otherState');
// Use this to transit to other state in the same microbot