How to send custom carousel with facebook MessengerBot


We are trying to send a carousel built with Facebook elements via the MessengerBot class.

However, I cannot figure out which method of the MessengerBot to use, and what is the exact format these methods expect.

I have tried .send_custom_json(conversation_id, message) and several others. They all fail without any errors. The .send_text_message method works as expect (delivers the message to the specific conversation).

The message variable looks like this:

What’s the expected format for this command?

If you want to send a carousel, you should do it via the send_custom_json method.

You should actually write this code in your custom actions file. And inside your run method, you should use dispatcher.utter_custom_json(payload) # where is carousel in json payload

Check this for implementing custom actions: Actions

Hope that helps.

Thanks for the input.

My problem was that I couldn’t figure out the structure of the object to be sent via the messenger bot. It was failing silently. I then figured out that the messenger bot API simply isn’t returning the error message. I used the debugger and figured it out.

Yeah, working with other APIs can be hard – a lot of them return 200s but don’t render your message if the format is off! Unfortunately not much we can do about that from our side. Good debugging!