From d38f8ad2ec83ade790bd65c5225212e533e2cb68 Mon Sep 17 00:00:00 2001 From: Manvydas Kriauciunas Date: Fri, 6 Oct 2017 16:23:47 +0200 Subject: [PATCH 1/2] new feature eventReminder added --- fbchat/client.py | 31 +++++++++++++++++++++++++++++++ fbchat/utils.py | 1 + 2 files changed, 32 insertions(+) diff --git a/fbchat/client.py b/fbchat/client.py index 110653b..8f341a8 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -1192,6 +1192,37 @@ class Client(object): j = self._post('{}/?{}'.format(self.req_url.MESSAGE_REACTION, url_part), fix_request=True, as_json=True) + def eventReminder(self, thread_id, time, title, location='', location_id=''): + """ + Sets an event reminder + + :param thread_id: :ref:`Thread ID ` to send event to + :param time: Event time + :param title: Event title + :param location: Event location + :param location_ir: Event location ID + :raises: FBchatException if request failed + """ + full_data = { + "event_type": "EVENT", + "dpr": 1, + "event_time" : time, + "title" : title, + "thread_id" : thread_id, + "location_id" : location_id, + "location_name" : location, + "acontext": { + "action_history": [{ + "surface": "messenger_chat_tab", + "mechanism": "messenger_composer" + }] + } + } + url_part = urllib.parse.urlencode(full_data) + + j = self._post('{}/?{}'.format(self.req_url.EVENT_REMINDER, url_part), fix_request=True, as_json=True) + + def setTypingStatus(self, status, thread_id=None, thread_type=None): """ Sets users typing status in a thread diff --git a/fbchat/utils.py b/fbchat/utils.py index 7d3434b..61f0f14 100644 --- a/fbchat/utils.py +++ b/fbchat/utils.py @@ -92,6 +92,7 @@ class ReqUrl(object): MESSAGE_REACTION = "https://www.facebook.com/webgraphql/mutation" TYPING = "https://www.facebook.com/ajax/messaging/typ.php" GRAPHQL = "https://www.facebook.com/api/graphqlbatch/" + EVENT_REMINDER = "https://www.facebook.com/ajax/eventreminder/create" pull_channel = 0 From be6b6909d9836c53cda8033dc4feab1bcca23de9 Mon Sep 17 00:00:00 2001 From: svaikstude Date: Fri, 6 Oct 2017 17:05:09 +0200 Subject: [PATCH 2/2] Update client.py --- fbchat/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fbchat/client.py b/fbchat/client.py index 8f341a8..f1d4c57 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -1197,7 +1197,7 @@ class Client(object): Sets an event reminder :param thread_id: :ref:`Thread ID ` to send event to - :param time: Event time + :param time: Event time (unix time stamp) :param title: Event title :param location: Event location :param location_ir: Event location ID