0
votes

Is it possible to do this without storing state? I see that it's possible to watch for all labels except DRAFT, but when you fetch the history, it's impossible to filter by more than a label (at least according to the documentation: https://developers.google.com/gmail/api/v1/reference/users/history/list).

Backstory: when you type something in a message, upon draft saving you get a spam of messageAdded and messageDeleted for the draft. The first one is okay, since you can almost safely assume that if it's not there when you try to fetch it, it's a draft, if you're fast enough. For the latter, it's impossible to figure out if the message was a draft or not without storing that in advance.

1

1 Answers

1
votes

Gmail API now returns the (full set of) labelIds as part of the messageAdded and messageDeleted in the history.list() response: https://developers.google.com/gmail/api/release-notes#2015-06-22

So at least you can use that to ignore DRAFTs from the reply.