Carousel doesn't work in facebook

Hello!

I am trying to show carousel in facebook messager. I tried two ways:

  1. Define utter in template:
utter_show_carousel:
  - text: there are two options!
    channel: "facebook"
    elements:
      - title: title 1
        subtitle: subtitle 1
      - title: title 2
        subtitle: subtitle 2

And then show it with dispatcher.utter_message(template=‘utter_show_carousel’). The carousel shows perfectly.

  1. Define payload in the code:
dispatcher.utter_message({
    "attachment": {
        "type": "template",
        "payload": {
            "template_type": "generic",
            "elements": [
                {
                    "title": "title1",
                    "subtitle": "subtitle1"
                },
                {
                    "title": "title2",
                    "subtitle": "subtitle2"
                }
            ]
        }
    }
})

But the carousel doesn’t show. I tried the following solutions mentioned in the forum, but none of them works for me. Caraousel widget with Facebook messenger and Custom Rasa/webchat and facebook messenger carousel

I am using Rasa 1.10.0. Since I need to build elements dynamically, I can’t use template way. Any idea will be welcomed. Thanks!