Manage the end-of-conversation trigger

Good morning,

I would like to know if there was a way to handle exactly which tasks should trigger the End Of Conversation event.

I expose you my case, at this moment in my Bot the End Of Conversation event is triggered when an intent is not recognized. I would like to avoid this behavior. It’s possible to do it? How?

Is there a way to handle when the End Of Conversation event should actually be triggered?

Thank you very much!

1 Like

@lbellanova
You may have gone through end of conversation. End of conversation is triggered when there is a logical end of dialog flow and the bot is idle (Note - waiting for an entity is not being idle). So, on answering a FAQ, on completion of a task, the ‘end of conversation’ event is triggered. For small-talk, ‘end of conversation’ is not triggered. You cannot stop it. But what you can still do is check for the following context objects in a script node to make a decision for routing the bot flow. Say - for end of conversation resulting from canceling of a dialog, you can show some message, for end of conversation resulting from an FAQ you can show a different message, or call a different sub-dialog, etc.

context.invocationSource. It is set as

"invocationSource": {
    "type": "endConversationEvent"
  }

There can be more values like -

  "invocationSource": {
    "type": "transitionBased"
  }

Also refer to some objects like context.endOfTask.endOfTaskReason, context.endOfTask.intentType. Below are a couple of examples but the documentation link above will give you more reasons with which you can handle the bot flow according to your needs.

  "endOfTask": {
    "endOfTaskReason": "Fulfilled",
    "intentType": "FAQ",
    "primaryQuestion": "What is the definition of severities",
    "matchedQuestion": "severity of tickets",
    "pathTraversed": [
      "operation",
      "ticket",
      "definition",
      "severity"
    ]
  }

Or

  "endOfTask": {
    "endOfTaskReason": "Fulfilled",
    "intentType": "dialog",
    "taskName": "feedback",
    "lastNode": "message8"
  }

You can check for more values and more useful context objects under debug log window

When an intent is not recognized, default dialog (if you have configured it) is triggered and not end of the conversation. If you have somehow configured the same dialog task, you may get confused.

I hope this helps.

1 Like

Hi Swagata, we’ve also encountered this issue and following your suggestion, we configured “end of task event” as "running a script“ to realize the function: when the ending task is FAQ and it is completed, the bot says “anything else” and in other condition, the bot says “goodbye”. However, the message cannot be sent to the user and the bot does not have any response. Could you please help to check that, thank you!

var message;
if (context.endOfTask.intentType === “FAQ” && context.endOfTask.endOfTaskReason === “Fulfilled”){
message = “Is there anything else I can help you with?”
} else{
message = “Thanks for calling. Have a nice day.”
}
// BotUserSession.put(‘message’, message)
// BotUserSession.get(message)
message;