Transfer to agent after 3 failed recognition

Hi Everyone,

Just had an overview of the platform and has not attended any training yet (will attend soon), but I was wondering if its possible to trigger a xfer to agent once the failed to recognize message is given by the bot the 3rd time. If yes, can you point me to the direction on how can this be done.

Hi @mark.ensoy,

You can retrieve the error count of the entity node from context.entityErrorCount..

For your use-case, we suggest you to configure the error prompt of the required entity node and use a small JS snippet to prompt the user with a button template for selecting the Live agent option.

Steps to implement:

  • In the entity node >> Error Prompts >> Manage response >> Add a response for web/mobile client channel.
  • Select “Javascript” >> Choose “Button template”.
  • You can observe the button template code generated in the editor.
  • Now, we will write a JS snippet to display the button template only when the error count is 3.

var x;
if(context.entityErrorCount.Entity0001){
x = context.entityErrorCount.Entity0001;
}
if(x >= 3){
var info = [“Button1”, “Button2”, “Button3”];
var message = {
“type”: “template”,
“payload”: {
“template_type”: “button”,
“text”: “Button Template Label”,
“subText”: “Button Template Description”,
“buttons”: []
}
};
for (i = 0; i < info.length; i++) {
// if the button is to send back text to platform
var button = {
“type”: “postback”,
“title”: info[i],
“payload”: “payload1”
};

message.payload.buttons.push(button);

}
print(JSON.stringify(message));

}

else{
print(“please enter an appropriate value”);
}

Here, you can edit the button template code to display your list of choices.

This will display the button template when the error count reaches 3.
image

Let us know if you need any further clarification.

Regards,
Yoga Ramya