Skip to content

Commit

Permalink
Merge pull request #102 from HarryPaulo/new-message-type
Browse files Browse the repository at this point in the history
New 'button' message type
  • Loading branch information
shridarpatil authored Sep 9, 2024
2 parents c5c8b9f + 6fd9d79 commit 78b3d7d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
{
Expand Down Expand Up @@ -179,7 +179,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-09-02 04:37:50.937855",
"modified": "2024-09-02 04:45:50.937855",
"modified_by": "Administrator",
"module": "Frappe Whatsapp",
"name": "WhatsApp Message",
Expand Down
11 changes: 11 additions & 0 deletions frappe_whatsapp/utils/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 78b3d7d

Please sign in to comment.