diff --git a/rasa_addons/core/channels/rest.py b/rasa_addons/core/channels/rest.py index fa6bd24777..e1519d4132 100644 --- a/rasa_addons/core/channels/rest.py +++ b/rasa_addons/core/channels/rest.py @@ -36,10 +36,11 @@ def _message( "quick_replies": quick_replies, "buttons": buttons, "attachment": attachment, - "custom": custom, "metadata": metadata, } + if custom: obj.update(custom) + # filter out any values that are `None` return utils.remove_none_values(obj) diff --git a/rasa_addons/core/channels/webchat.py b/rasa_addons/core/channels/webchat.py index ae60560d97..751a004cc8 100644 --- a/rasa_addons/core/channels/webchat.py +++ b/rasa_addons/core/channels/webchat.py @@ -110,11 +110,11 @@ async def send_custom_json( ) -> None: """Sends custom json to the output""" - json_message.setdefault("room", recipient_id) - - await self.sio.emit( - self.bot_message_evt, **json_message, metadata=kwargs.get("metadata", {}) - ) + message = { + **json_message, + "metadata": kwargs.get("metadata", {}), + } + await self._send_message(recipient_id, message) async def send_attachment( self, recipient_id: Text, attachment: Dict[Text, Any], **kwargs: Any