Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Gmail API History List does not return MessagesAdded

I'm connecting my .NET application to the Google PubSub subscription where I've configured my Gmail API to send watch notifications to. Handling received messages on the topic works just fine, I'm receiving messages with an email address and history id.

However, when I try to retrieve the history entry using the Gmail API (GmailService.Users.History.List()), I'm receiving only responses where the MessagesAdded is always null, for all history entries. I am however receiving a message in the Messages property, but from this I can not determine whether the message was added, deleted or if any of the labels was changed. I'd like to be able to just check if a history entry has MessagesAdded values to process received email messages, but this makes that impossible. Chances are I'm doing something wrong, probably, but I can not figure out based on the documentation why MessagesAdded is always null (in all received messages from the PubSub topic, for all history entries I'm retrieving). Can anyone tell me why?

0 1 775
1 REPLY 1

Hi petersaighlee,

Thanks for reaching out! The question seems related to the Gmail API. Please note that the tag `Application Integration` is specifically for App Integration product. If it's not for it, please use the proper tag for faster routing. Otherwise, if this is about App Integration, kindly ask which task did you use for it? 

Thanks!