Getting historical messages via webhooks
In Context.IO, you can receive callbacks for new messages as they come in via webhooks. In non-technical terms, we send you notifications of new messages as they arrive in an account via our webhooks feature.
Until now, if you wanted to get messages from before the account was added to Context.IO, you would need to perform your own backscan of the account via a series of API calls, iterating over the account until you reached the end. This can be a time consuming process, let alone you could run into API rate limits.
Introducing historical messages via webhooks
We have introduced a feature we are calling “historical webhooks”, which we can perform the backscan of the account for you, and send you the entirety of a user’s mailbox messages via webhooks.
For example, if I add an account and I have webhooks set-up, I will receive webhook callbacks for all messages after the account was added. If I turn on the “receive_historical” option for webhooks, we will send you all messages from before the account was added.
Setting up historical webhooks
Historical webhooks can only be set as application level webhooks. The endpoints you will need are:
You will need to ensure you set the “receive_historical” parameter to “1”.
Additionally, you can set your webhooks to “include_body” and “include_header”. This should get you all the info you need in order to process the messages without making further calls to the API. In other words, we do all the work for you!
The “receive_historical” parameter is only available for application level webhooks, not user level webhooks.
Triggering historical webhooks
Webhooks for historical messages can only be triggered when a new account is added to Context.IO. Historical webhooks are sent only once and cannot be triggered ad-hoc.
Historical webhooks are sent once we finish our initial sync process for the account, so they are not immediate (but should only take a few minutes to complete).
Please note: We do retry missed webhooks (we consider a webhook missed if we receive anything other than a 2xx as an HTTP response code from your server).
Consuming historical webhooks
The response shape of historical webhooks is the same as webhooks for new messages, so you won’t have to change anything on your end to receive them.