From 89a6704ca5c3b1cf13b4d3d694f1366ec590d6b3 Mon Sep 17 00:00:00 2001 From: alliance-techfunctionals Date: Tue, 24 Dec 2024 10:57:42 +0000 Subject: [PATCH] skip for reaction type and log error for any other message type --- waba_integration/api/webhook.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/waba_integration/api/webhook.py b/waba_integration/api/webhook.py index d89db7d..4639994 100644 --- a/waba_integration/api/webhook.py +++ b/waba_integration/api/webhook.py @@ -31,7 +31,9 @@ def handle(): continue elif message.get("errors") and message.get("errors")[0].get("code") == 131051: # if got an error code 131051, then skip the message continue - elif message.get("type") not in ['text', 'image', 'audio', 'video', 'system', 'document']: # if got a reaction or any unsupported message type, then skip the message + elif message.get("type") == 'reaction': # if got a reaction, then skip the message + continue + elif message.get("type") not in ['text', 'image', 'audio', 'video', 'system', 'document']: # if any unsupported message type, then skip the message frappe.log_error("Log From IDML,Ignoring this Message Because Unsupported Message Type", frappe.as_json(message)) continue else: # else create a new WABA WhatsApp Message