Facebook Generic Templates

Hello everyone,

I see a lot of people struggling with sending generic templates such as carousels to Facebook channel.

Has anyone successfully done this before?

Here’s what I’m trying to send:

def run(self, dispatcher, tracker, domain):
     elements =  {
           "title": "Name",
           "image_url": "https://website.com/c981291c4cd0.png",
           "subtitle": "Mayor of Beirut.",
           "default_action": {
               "type": "web_url",
               "url": "https://website.com",
               "webview_height_ratio": "tall"
           },
           "buttons": [
               {
               "title": "View Full Profile",
               "type": "web_url",
               "url": "https://website.com"
               },
               
           ]
     }
     dispatcher.utter_custom_json(elements)
     return[]

However, I’m not receiving anything in the chat on Facebook.

I would appreciate every help and input.

Regards.

To use utter_custom_json, you have to include the full payload. According to the API it looks like this:

"payload": {
  "template_type":"generic",
  "elements":[
    <GENERIC_TEMPLATE>,
    <GENERIC_TEMPLATE>,
    ...
  ]
}

So you’ll need to go one step back and make the message that you send { “template_type”:“generic”, “elements”:[ <GENERIC_TEMPLATE>, <GENERIC_TEMPLATE>, … ] }. Did you check to see if your generic templates are also correctly formatted?