diff --git a/rocket_connect/instance/management/commands/dev_settings.py b/rocket_connect/instance/management/commands/dev_settings.py index 81e47b9..79f6a4f 100644 --- a/rocket_connect/instance/management/commands/dev_settings.py +++ b/rocket_connect/instance/management/commands/dev_settings.py @@ -74,7 +74,8 @@ def handle_django(self): "outcome_attachment_description_as_new_message": True, "active_chat_webhook_integration_token": "WPP_ZAPIT_TOKEN", "session_management_token": "session_management_secret_token", - "force_close_message": "Thanks for Contacting us. Agent has closed the conversation.", + "force_close_message": "Thanks for Contacting us." + + "Agent has closed the conversation at the room {{room.room_id}}", "department_triage_payload": { "message": "Message for your buttons", "options": { diff --git a/rocket_connect/plugins/base.py b/rocket_connect/plugins/base.py index 50a7328..77696b8 100644 --- a/rocket_connect/plugins/base.py +++ b/rocket_connect/plugins/base.py @@ -1274,6 +1274,12 @@ def get_close_message(self, department=None): ).get(department, None) except KeyError: close_message = None + # pass room as context for close_message as template + if self.room: + template = Template(close_message) + context = Context({"room": self.room}) + close_message = template.render(context) + self.logger_info(f"GOT CLOSE MESSAGE: {close_message}") return close_message diff --git a/rocket_connect/plugins/wppconnect.py b/rocket_connect/plugins/wppconnect.py index 200dd92..f169b43 100644 --- a/rocket_connect/plugins/wppconnect.py +++ b/rocket_connect/plugins/wppconnect.py @@ -69,7 +69,7 @@ def status_session(self): self.config.get("instance_name"), ) host_device = session.get(endpoint, timeout=1).json() - status["host_device"] = host_device["response"] + status["host_device"] = host_device.get("response") else: status = {"success": False, **status_req.json()} except urllib3.exceptions.ReadTimeoutError as e: