1

I'm developing node application, that needs to process some data when new email appears in GMAIL. I know how setup pub/sub messaging for all actions on INBOX, but i wonder whether there is a possibility to only get notifications about new emails.

Don't want to have additional requests checking whether we have new email or user removed email or did any other changes.

Any info will be very appreciated.

Rantiev
  • 2,121
  • 2
  • 32
  • 56
  • You could just [watch](https://developers.google.com/gmail/api/v1/reference/users/watch#request-body) the `UNREAD`-label :) This way you will only get notifications for new messages and messages the user marks as unread themselves. Then you can just filter out the new ones by looking at `internalDate` to see if it is new or old. – Tholle Mar 10 '16 at 19:20
  • Hi, yep was considering UNREAD but didn't think about internalDate, thanks it might be right answer for my question. – Rantiev Mar 10 '16 at 21:08
  • But it's not obvious what kind of notifications i would get even if i use UNREAD label. Because user will delete email and i believe i'm getting notification, instead i want to get notifications only when new email appears. I just can't believe API developers didn't provide this possibility. Or i can't find it. – Rantiev Mar 10 '16 at 21:16
  • @Rantiev Did you use `watch` on `UNREAD` label in the end? Or did you figure out another way? – gdvalderrama Sep 13 '17 at 15:30
  • @guival don't remember exactly, and can't check now. But most likely i did watch on UNREAD, because i remember only i wasn't able to get UNREAD only in INBOX or any really NEW emails. – Rantiev Sep 15 '17 at 08:36

0 Answers0