Skip to content

Commit

Permalink
add message id in Incoming message and mark mesage type text
Browse files Browse the repository at this point in the history
  • Loading branch information
chechani committed Sep 29, 2023
1 parent 13cfdbb commit c97d9ae
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frappe_whatsapp/utils/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ def post():
"doctype": "WhatsApp Message",
"type": "Incoming",
"from": message['from'],
"message": message['text']['body']
"message": message['text']['body'],
"message_id": message['id'],
"content_type":message_type
}).insert(ignore_permissions=True)
elif message_type in ["image", "audio", "video", "document"]:
media_id = message[message_type]["id"]
Expand Down Expand Up @@ -92,6 +94,7 @@ def post():
"doctype": "WhatsApp Message",
"type": "Incoming",
"from": message['from'],
"message_id": message['id'],
"message": f"/files/{file_name}",
"attach" : f"/files/{file_name}",
"content_type" : message_type
Expand Down Expand Up @@ -136,4 +139,4 @@ def update_message_status(data):
doc.status = status
if conversation:
doc.conversation_id = conversation
doc.save(ignore_permissions=True)
doc.save(ignore_permissions=True)

0 comments on commit c97d9ae

Please sign in to comment.