I am trying to make an application that will find out if the recipient answered my email address with a GMAIL push notification. It works well, but the problem is that I am notified of any changes in my gmail.
Here is the code I used
request = { 'labelIds': ['UNREAD'], 'topicName': topic, 'labelFilterAction': 'include' } service.users().watch(userId=user.google_id, body=request).execute()
then I tried to use '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 this, I do not receive any notice at all. any suggestion?
gmail gmail api
khulas15
source share