From 786a3d90b858eb6f63aa758dcc535d3d26119f52 Mon Sep 17 00:00:00 2001 From: Joseph Martin Date: Wed, 20 May 2020 17:17:19 +0100 Subject: [PATCH 1/2] Added support for sending custom payload to messenger --- pymessenger/bot.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pymessenger/bot.py b/pymessenger/bot.py index 5a7311c..eaba465 100644 --- a/pymessenger/bot.py +++ b/pymessenger/bot.py @@ -160,6 +160,18 @@ def send_button_message(self, recipient_id, text, buttons, notification_type=Not } }, notification_type) + def send_custom_payload(self, recipient_id, payload, notification_type=NotificationType.regular): + """This allows users send custom data to the Messenger API. + This is best for cases where Messenger releases new features + And the PyMessenger team hasn't specifically implemented that feature + Input: + recipient_id: recipient id to send to + payload: dictionary containing raw request payload (requested by Messenger) + Output: + Response from API as + """ + return self.send_message(recipient_id, payload, notification_type) + def send_action(self, recipient_id, action, notification_type=NotificationType.regular): """Send typing indicators or send read receipts to the specified recipient. https://developers.facebook.com/docs/messenger-platform/send-api-reference/sender-actions From 90ffcb9ceb92151195fc81e07d8a7317fd014b8f Mon Sep 17 00:00:00 2001 From: Joseph Martin Date: Wed, 20 May 2020 17:20:38 +0100 Subject: [PATCH 2/2] Changed function name to send_custom_message --- pymessenger/bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymessenger/bot.py b/pymessenger/bot.py index eaba465..7c659f4 100644 --- a/pymessenger/bot.py +++ b/pymessenger/bot.py @@ -160,7 +160,7 @@ def send_button_message(self, recipient_id, text, buttons, notification_type=Not } }, notification_type) - def send_custom_payload(self, recipient_id, payload, notification_type=NotificationType.regular): + def send_custom_message(self, recipient_id, payload, notification_type=NotificationType.regular): """This allows users send custom data to the Messenger API. This is best for cases where Messenger releases new features And the PyMessenger team hasn't specifically implemented that feature