Caraousel widget with Facebook messenger - Rasa Open Source - Rasa Community Forum

Caraousel widget with Facebook messenger

post by dummyali on Sep 12, 2021

Hello, I have been trying to use carousels in one of my rasa bots, channeled to Facebook messenger, I have tried several ways but couldn’t make it work. This is what I get:

Here is my actions.py:

class ActionCarousel(Action):
    def name(self) -> Text:
        return "action_products_carousels"

def run(self, dispatcher, tracker: Tracker, domain: "DomainDict") -> List[Dict[Text, Any]]:
        message = {
            "type": "template",
            "payload": {
                "template_type": "generic",
                "elements": [
                    {
                        "title": "Welcome!",
                        "image_url": "https://petersfancybrownhats.com/company_image.png",
                        "subtitle": "We have the right hat for everyone.",
                        "default_action": {
                            "type": "web_url",
                            "url": "https://petersfancybrownhats.com/view?item=103",
                            "webview_height_ratio": "tall",
                        },
                        "buttons": [
                            {
                                "type": "web_url",
                                "url": "https://petersfancybrownhats.com",
                                "title": "View Website"
                            }, {
                                "type": "postback",
                                "title": "Start Chatting",
                                "payload": "DEVELOPER_DEFINED_PAYLOAD"
                            }
                        ]
                    }
                ]
            }
        }

dispatcher.utter_message(attachment=message)

return []

post by nik202 on Sep 13, 2021

Hi @dummyali! Please see this link for your reference I know you already are but check the syntax for the same: Generic Template - Messenger Platform - Documentation - Facebook for Developers
Try implement small template first and then go add the carousel, it will help you to find the issue more easily.

post by dummyali on Sep 14, 2021

Hello nik, thanks for replying but it's still the same, and I referred to that doc only, I would really appreciate if you could see my code above and point out where I am going wrong, Thanks

post by nik202 on Sep 14, 2021

@dummyali I suggested you please try to use a small template example first so that you will see if it is showing on Facebook messenger or not and then add more syntax, did you try?

post by dummyali on Sep 14, 2021

Yes I did try small template, but that doesn't change anything, I only need FB for integration

post by bharath-madduri on Apr 14, 2022

@dummyali you can refer to this post. I have provided the code to get carousel on fb.