Skip to content Skip to sidebar Skip to footer

Get Google Group Emails With Gmail Api

I am working on getting large text corpus of the email. There is no API that allows reading a message in Google Group. So the alternative way is to use a Gmail account which is a m

Solution 1:

For the first part, your query is backward: email messages are sent to groups, from users. This query should return all messages sent to the group:

to:support-dev-group@wso2.com

(You can easily test this in Gmail, since it uses the same query specification in the search box).

Next, to get the full message given the message id, use users.messages.get with the format 'full' option, see: https://developers.google.com/gmail/api/v1/reference/users/messages/get

You do have to call it once for each message, but you can submit a batch of get requests to do it efficiently, once. And then you can use history ids to only fetch new messages:

From "Synchronizing Clients with Gmail" https://developers.google.com/gmail/api/guides/sync

Call messages.list to retrieve the first page of message IDs.

Create a batch request of messages.get requests for each of the messages returned by the list request. If your application displays message contents, you should use format=FULL or format=RAW the first time your application retrieves a message and cache the results to avoid additional retrieval operations. If you are retrieving a previously cached message, you should use format=MINIMAL to reduce the size of the response as only the labelIds may change.

Merge the updates into your cached results. Your application should store the historyId of the most recent message (the first message in the list response) for future partial synchronization.

See: https://developers.google.com/gmail/api/guides/batch

Post a Comment for "Get Google Group Emails With Gmail Api"