In API v2.x, we were able to provide view=count
by querying the Nylas database directly. However, in API v3, for Google and Microsoft grants, Nylas no longer stores provider data. This offers several benefits, e.g. removing the need to synchronize the state we have in the DB with the provider, removing historic sync delay found in v2.x, etc. But this also means that we are limited by what the provider supports in terms of querying. Unfortunately, Google/Microsoft don't provide an equivalent to view=count in their respective APIs.
To accomplish this in v3, you would need to:
- Subscribe to message.created webhooks.
- After a grant is connected, page through the grant's existing threads recording the timestamp of each thread (assuming you need to be able to get a count based on a dynamic date range).
- Given a message.created webhook, check if the thread is new (e.g. not previously counted), if so, record the timestamp.
Depending on the specific details of your use case, the above workflow may need to be adjusted.
References:
Updated
Comments
0 comments
Please sign in to leave a comment.