Sai
Sai

Reputation: 2109

actions_intent_CANCEL not working as expected

I am trying to follow this great article on Medium written by Jessica Dene. When users say a global cancel command such as "quit", I want my action to respond with a "goodbye" message. I have tried to follow the instructions provided by Jessica as illustrated below:

Add the actions_intent_CANCEL event to my end intent

Know More - no - no is my end intent. As you can see below, when I try to add "actions_intent_CANCEL" under Events, I can't see it as a suggestion in the drop down

enter image description here

But given that actions_intent_CANCEL does exist according to docs, I added it

enter image description here

Error I saved the intent and tried in the web simulator, I see the below error

enter image description here

Any idea why I am getting this error?

Upvotes: 2

Views: 1196

Answers (2)

nikhilesh_koshti
nikhilesh_koshti

Reputation: 403

Yes, the actions_intent_CANCEL is removed from the docs and also from the dropdown list of events in Dialogflow. So for exiting the conversation, you can try the following:--

(1) make an entity entry having all quotes for exiting the conversation e.g:-- bye, goodbye, bbye, talk to you later.

(2) make an intent having examples of the users leaving the conversation e.g:- I have some work, bye for now.

(3) And select the end conversation tap at the bottom of the intent so that conversation ends with the sample response.

(4) Also make a suggestion example for BYE/CANCEL with all the intents for better conversation flow

Using the above steps, you can mimic the actions_intent_CANCEL event

Upvotes: -2

Prisoner
Prisoner

Reputation: 50731

Typing actions_intent_CANCEL in directly was completely appropriate. Most of the ones in the dropdown are for Welcome-like intents rather that in-conversation events that can occur. You have the right action name.

It sounds like you're handling it mostly correctly. The only additional thing you need to do is to explicitly close the conversation.

If you are using a webhook for fulfillment, how you do this depends on the library you're using (assuming you're using a library).

If you're using the actions-on-google library you would use the conv.close() function:

conv.close(`Okay, let's try this again later.`);

With the dialogflow-fulfillment library, it would be agent.end():

agent.end(`Okay, let's try this again later.`);

If you're using multivocal, you can either set the environment setting ShouldClose to true, or set it to true in a Response.

  Response: {
    "Action.multivocal.welcome": [
      {
        Template: {
          Text: "Hello world."
        },
        ShouldClose: true
      }
    ]
  }

If you are using JSON, you can set payload.data.expectUserResponse to false.

Finally, if you are not using a webhook for fulfillment, but are just using the Responses section of Dialogflow, you would turn "Set this intent as end of conversation" on.

enter image description here

Upvotes: 3

Related Questions