I have an app that allows users to run automations similar to zapier.com. We have integrations with most major apps but are actively adding more. One of which is Gmail Triggers. The user will authenticate with their service account or via oauth and then setup a trigger so that any events can be viewed from our platform. Things like New email received will trigger this event with the body of that containing the sender, body of the email, time etc. being sent to the users webhook that was automatically created.
I strongly recommend setting up a gmail trigger on [login to view URL] (takes max of 5 minutes) to grasp the functionality I am after.