Dispatcher.utter_message(attachment=message) is not working

def run( self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any], ) -> List[Dict[Text, Any]]: intent = tracker.latest_message[“intent”].get(“name”)

    logger.debug("Detected FAQ intent: {}".format(intent))

    if intent in ["faq_spread"]:
        message = {
            "type": "video",
            "payload": {
                "title": "6 Steps to Prevent COVID-19",
                "src": "https://www.youtube.com/embed/9Ay4u7OYOhA",
            },
        }
        dispatcher.utter_message(
            text="Take steps to lower your risk of getting sick with COVID-19. Here are some things you should do.",
            attachment=json.dumps(message)
        )

Am running this custom action but am getting following error asyncio - Task exception was never retrieved future: <Task finished coro=<configure_app..run_cmdline_io() done, defined at c:\users\bg347848\desktop\covid-chatbot\nora-covid-19-bot\env\lib\site-packages\rasa\core\run.py:128> exception=TypeError(‘must be str, not dict’,)> Traceback (most recent call last): File “c:\users\bg347848\desktop\covid-chatbot\nora-covid-19-bot\env\lib\site-packages\rasa\core\run.py”, line 134, in run_cmdline_io sender_id=conversation_id, File “c:\users\bg347848\desktop\covid-chatbot\nora-covid-19-bot\env\lib\site-packages\rasa\core\channels\console.py”, line 140, in record_messages button_question = print_bot_output(response) File “c:\users\bg347848\desktop\covid-chatbot\nora-covid-19-bot\env\lib\site-packages\rasa\core\channels\console.py”, line 35, in print_bot_output cli_utils.print_color("Attachment: " + message.get(“attachment”), color=color) TypeError: must be str, not dict

rasa version- 1.10

Hey @bot_bot, welcome to the forum :blush:

Can you tell me which chatbot UI are you using to the render the bot message.

Right now I have tested with rasa shell and got error which I’ve given And also I’ve tested with rasa x but still it’s not worked

Any one know what exactly am missing I tried with my html as well still video is not playing

try with this!!

I tried with this as well…but still not working

provide your action.py fie for better understanding

Hello, any news for this problem? I’m tryining to send to facebook with:

dispatcher.utter_message(attachment=json.dumps(attachment))

and

dispatcher.utter_message(attachment=attachment)

and in facebook i see like a plain string message both ways

attachment: { “type”:“template”, “payload”:{ “template_type”:“generic”, “elements”:[ { “title”:“GUARDABARRO UNIVERSAL MOD. CRF-BLANCO”, “image_url”:image_1, “subtitle”:“PRO-TORK”, “default_action”: { “type”: “web_url”, “url”: link_1, “messenger_extensions”: “false”, “webview_height_ratio”: “tall”, “fallback_url”: “https://wwww.mercadolibre.com.ar/” }, “buttons”:[ { “type”:“postback”, “title”:“Mostrar” },{ “type”:“postback”, “title”:“Comprar”, }
]
} ] } }

Hi @ClaudioSpinelli!

Did you manage to solve this?

Thanks! Mark