Hello all,
Problem statement: After the chat with an agent is over, how to get the control back to the bot and invoke a specific intent?
Out of scope: This is just a sample implementation and does not guarantee to work with a multi-instance botkit setup. This needs botkit implementation and does not cover any no-code solution.
Solution:
Assume you have a task that triggers agent transfer. And there is a task to trigger when the control is returned to the bot.
Normally for closing an agent session you will be doing something like this.
sdk.clearAgentSession(data);
Along with a close agent session, you will need to pass on the information to the platform that which task needs to be invoked at agent transfer.
sdk.clearAgentSession(data, function(){
data.message = "returnDialogAgentTransfer";
console.log("Attempting to override nlMeta for invoking target intent post agent transfer");
data.metaInfo = {
'nlMeta': {
'intent': 'returnDialogAgentTransfer',
'isRefresh': true
}
}
sdk.sendBotMessage(data, callback);
return callback(null, data);
});
Output:
Credit - @yesu.chiratanagandla