ParshvaShah
ParshvaShah

Reputation: 115

Dialogflow - Calling an intent on a button click

I have two buttons ('Category A' and 'Category B') created through custom payload in the 'Dialogflow Messenger' Integration. Once I click any category I want another intent to be triggered which would show the user few other buttons (sub-categories). I tried putting the welcome event name in the event section of the the code but that did not work for me (there were no changes at all). Could someone help me with this please?

I also do not know how to create new events. (I could not understand much from the 'events' documentation.) The style section does not work too. I want to change the layout of the buttons too. I do not have the knowledge of web-hook and fulfillment too.

  "richContent": [
    [
      {
        "icon": {
          "color": "#FF9800",
          "type": "chevron_right"
        },
        "event": {
          "languageCode": "",
          "name": "WELCOME",
          "parameters": {}
        },
        "link": "https://google.com",
        "text": "Career",
        "type": "button",
        "style": {
          "background-color": "blue"
        }
      },
      {
        "type": "divider"
      },
      {
        "icon": {
          "type": "chevron_right",
          "color": "#FF9800"
        },
        "link": "https://google.com",
        "text": "Sales Inquiry",
        "event": {
          "languageCode": "",
          "name": "",
          "parameters": {}
        },
        "type": "button"
      }
    ]
  ]
} ```

Upvotes: 1

Views: 2405

Answers (2)

Cha Pladin
Cha Pladin

Reputation: 11

I got this method worked for me.

  1. Create intent and indicate matched event name on your button payload to event name created in intent.

    "event": { "name": "event_name_you_indicate", },

  2. In the same intent, provide action name.

  3. Map your function once action name request received.

TLDR; You can check if this works out for you: https://medium.com/@varungoyal311213/dialogflow-rich-responses-click-event-438b984466ec

Upvotes: 1

Sankul Garg
Sankul Garg

Reputation: 26

You need to enter language code as well. "event": { "languageCode": "en", "name": "login-event", "parameters": {} }

Upvotes: 1

Related Questions