How to send postback call with intent and slot values as payload on click of button in facebook messenger

Hi Everyone,

I am trying to send post back call on click of button in facebook messenger with payload as intent name and a slot with the value through custom actions but it’s not working.

I have implemented the same in domain.yml and works fine.

Can anyone help on this?

Domain.yml (working for facebook):

>   utter_product_info:
>   - buttons:
>     - payload: /product_gallery{{"product_category":"prod_categ1"}}
>       title: Pro1
>     - payload: /product_gallery{{"product_category":"prod_categ2"}}
>       title: Pro2
>     - payload: /product_gallery{{"product_category":"prod_categ3"}}
>       title: Pror3
>     text: Please select a category.

actions.py(Logic is same as above but its not working):

> class SampleGallery(Action):
>     def name(self):
>         return "action_gallery_options"
> 
>     def run(self, dispatcher, tracker, domain)
>         if tracker.get_latest_input_channel() == 'facebook':
>             message = {
>                 "text": "Please select a category.",
>                 "buttons": [
>                     {
>                         "type":"postback",
>                         "title": "Pro1",
>                         "payload": "/product_gallery{\"product_category\":\"prod_categ1\"}",
>                     }, 
>                     {
>                         "type":"postback",
>                         "title": "Pro2",
>                         "payload": "/product_gallery{\"product_category\":\"prod_categ2\"}",
>                     }, 
>                     {
>                         "type":"postback",
>                         "title": "Pro3",
>                         "payload": "/product_gallery{\"product_category\":\"prod_categ3\"}",
>                     }, 
>                 ]
>             }
>             dispatcher.utter_message(json_message=message) 
>         else:
>             dispatcher.utter_message(template="utter_product_info")        
>         return []

One clarification, you can’t directly set slots with that format, you’re setting entities that could fill slots.

Which part isn’t working? Is it not displaying right? Not setting the intent/entity correctly?