Skip to content

Commit

Permalink
[BASE] add room as context to force close messages.
Browse files Browse the repository at this point in the history
you can now use {{room.room_id}}. Fixes #128
  • Loading branch information
dudanogueira committed Jul 7, 2023
1 parent ba2644f commit f860f1c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion rocket_connect/instance/management/commands/dev_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
6 changes: 6 additions & 0 deletions rocket_connect/plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion rocket_connect/plugins/wppconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f860f1c

Please sign in to comment.