Receive Gmail push notification only when a new message arrives -
i trying make app find out if recipient replied email using gmail's push notification. working well, problem is, receiving notification changes on gmail.
here code used
request = { 'labelids': ['unread'], 'topicname': topic, 'labelfilteraction': 'include' } service.users().watch(userid=user.google_id, body=request).execute()
then tried using 'labelfilteraction': 'exclude'
system_labels = ['category_updates', 'unread', 'draft', 'category_promotions', 'inbox', 'category_social', 'category_personal', 'category_forums', 'trash', 'chat', 'important', 'sent', 'starred', 'spam'] system_labels.remove('unread') request = { 'labelids': system_labels, 'topicname': topic, 'labelfilteraction': 'exclude' } service.users().watch(userid=user.google_id, body=request).execute()
with one, not receiving notification @ all. suggestion?
working python code
credentials = get_credentials(email) http = credentials.authorize(httplib2.http()) service = discovery.build('gmail', 'v1', http=http) request = { 'labelids': ['category_personal'], 'topicname': 'projects/myproject/topics/getnotification', 'labelfilteraction': 'exclude' } service.users().watch(userid='me',body=request).execute()
Comments
Post a Comment