I tried to get notifications using the guide Here. https://developers.google.com/gmail/api/guides/push#gmail_watch
Gmailservice(service) is able to get Labels,Inbox and other api features.
Here is the code.
var service = new GmailService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = ApplicationName,
});
IList<string> label = new List<string>();
label.Add("INBOX");
WatchRequest request2 = new WatchRequest
{
LabelIds = label,
LabelFilterAction = "include",
TopicName = "projects/******/topics/****TestTopic"
};
var x= service.Users.Watch(request2, "me").Execute();
Watch Throws This Exception
Google.Apis.Requests.RequestError
Backend Error [500]
Errors [
Message[Backend Error] Location[ - ] Reason[backendError] Domain[global]
]
OK, mine is solved. Yes, I agree, the error message from gmail API is somewhat obscure, but here is how I have fixed it.
Apparently, I forgot to grant Push permissions to gmail. To do so go here and do the following:
[email protected].Good Luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With