-1

I am trying to trigger an event on button click in dialogflow using Python inside of a dialogflow console

message={"fulfillmentMessages":
         [{"text": {"text":
           ["Please choose one of the options below"]}
          },
          {"card":{
               "buttons": [
        
                 {
                    "text": "Make A Reservation",
                    "event": {
                            "name": "makereservation",
                            "languageCode": "en-US"

                            }
                 },
                  {
                    "text": "Cancel Reservation",
                    "event": {
                            "name": "cancelreservation",
                            "languageCode": "en-US"

                            }
                 },
                ]
            }}
           ]
          }

This is just a sample. I would like to trigger events with name makereservation and cancelreservation but they don't get triggered in the dialogflow console. Also I am using python for the same. I am unable to fix the bug even after spending lot of time.

Harpreet
  • 165
  • 1
  • 8

1 Answers1

1

Above code does not work in dialogflow messenger nor am I sure if it will work in your own chat window. So a better approach would be to use below code

message= {"fulfillmentMessages":
            [{"payload":
                { "richContent":  [[ 
                    {'type': 'button', 
                    'icon': 
                        {'type': 'chevron_right', 
                         'color': '#FF8500'}, 
                    'text': 'Make Reservation', 
                    'event': {
                         'name': 'makereservation', 
                        'languageCode': 'en-US'
                        }
                     }
                ]]}
            }]
         }

PS Note: This will not work in console (since there are some issues with the dialogflow console) but it will work in dialoflow messenger and should also work in your own custom chat window

Harpreet
  • 165
  • 1
  • 8