From 05a3493598c199e4932bbeda825fad27f8ef7531 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Sun, 21 Apr 2024 14:15:51 +0530 Subject: [PATCH] feat: update api to allow replying on message --- crm/api/whatsapp.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crm/api/whatsapp.py b/crm/api/whatsapp.py index cbda59a0..f0bd57a2 100644 --- a/crm/api/whatsapp.py +++ b/crm/api/whatsapp.py @@ -41,8 +41,16 @@ def parse_mobile_no(mobile_no: str): return ''.join([c for c in mobile_no if c.isdigit() or c == '+']) @frappe.whitelist() -def create_whatsapp_message(reference_doctype, reference_name, message, to, attach, content_type="text"): +def create_whatsapp_message(reference_doctype, reference_name, message, to, attach, reply_to, content_type="text"): doc = frappe.new_doc("WhatsApp Message") + + if reply_to: + reply_doc = frappe.get_doc("WhatsApp Message", reply_to) + doc.update({ + "is_reply": True, + "reply_to_message_id": reply_doc.message_id, + }) + doc.update({ "reference_doctype": reference_doctype, "reference_name": reference_name,