I have java server application. And I need to monitor a lot of gmail accounts to be able to send push notifications to mobile devices about new Inbox messages. I need to know sender email and message subject to send push notification.
And I tried Gmail push notifications system (webhooks option) If I understood everything correctly in order to get needed info for each new message for each user there is a following scenario:
- Google sends me email and history id via https request.
- I call history API and get new message ids for user
- I request message info by message id
That means that I need 2 additional requests for each new message of each user. And it looks quite hard if server needs to handle several new messages each second. And I still don't see other way.
Is there any way to make it shorter? (e.g. to make google send me not only history id but needed new message details or at least make one additional request, but not two)
Thanks!