From 259b1e8a6fe3aa75a7ca24f9074f381810ddc414 Mon Sep 17 00:00:00 2001 From: HarryPaulo Date: Mon, 2 Sep 2024 12:05:41 -0300 Subject: [PATCH 1/2] feat: new messagem type --- .../doctype/whatsapp_message/whatsapp_message.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe_whatsapp/frappe_whatsapp/doctype/whatsapp_message/whatsapp_message.json b/frappe_whatsapp/frappe_whatsapp/doctype/whatsapp_message/whatsapp_message.json index c2a15fc..1008e08 100644 --- a/frappe_whatsapp/frappe_whatsapp/doctype/whatsapp_message/whatsapp_message.json +++ b/frappe_whatsapp/frappe_whatsapp/doctype/whatsapp_message/whatsapp_message.json @@ -131,7 +131,7 @@ "fieldname": "content_type", "fieldtype": "Select", "label": "Content Type", - "options": "\ntext\ndocument\nimage\nvideo\naudio\nflow\nreaction\nlocation\ncontact", + "options": "\ntext\ndocument\nimage\nvideo\naudio\nflow\nreaction\nlocation\ncontact\nbutton", "reqd": 1 }, { @@ -179,7 +179,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2024-05-03 13:22:45.081391", + "modified": "2024-09-02 04:45:50.937855", "modified_by": "Administrator", "module": "Frappe Whatsapp", "name": "WhatsApp Message", From 6a8781a85a0a28808f00a0ac38e4db48690af7af Mon Sep 17 00:00:00 2001 From: HarryPaulo Date: Mon, 2 Sep 2024 12:09:42 -0300 Subject: [PATCH 2/2] feat: webhook button message --- frappe_whatsapp/utils/webhook.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frappe_whatsapp/utils/webhook.py b/frappe_whatsapp/utils/webhook.py index 48e832d..0fe245a 100644 --- a/frappe_whatsapp/utils/webhook.py +++ b/frappe_whatsapp/utils/webhook.py @@ -129,6 +129,17 @@ def post(): message_doc.attach = file.file_url message_doc.save() + elif message_type == "button": + frappe.get_doc({ + "doctype": "WhatsApp Message", + "type": "Incoming", + "from": message['from'], + "message": message['button']['text'], + "message_id": message['id'], + "reply_to_message_id": reply_to_message_id, + "is_reply": is_reply, + "content_type": message_type + }).insert(ignore_permissions=True) else: frappe.get_doc({ "doctype": "WhatsApp Message",