Ending conversations
Functions which are declared in the JSON files will be defined in the respective *Impl.js files. conversations.done(uuid);
must be called in these functions if the function does not respond with microbot
or transition
in the replyCallback
of these function. This must be done to answer the next query of the user to your bot.
Examples
Consider a function in one of the *Imp.js files as shown
function test(uuid, store, replyCallback) {
replyCallback('text', 'searching');
// do some network call
if(success) {
replyCallback('microbot', 'confirm');
}
else {
replyCallback('text', 'Operation failed');
conversation.done(uuid);
}
}
Here conversation.done()
was called in the else block because there were no calls to transition
or microbot
in this path of the code.
It was not called in the if block because we are replying with microbot
.