Short answer is, yes! Our API is designed to be used with webhooks.
Webhooks are notifications that send you a callback when a certain event has happened. For our API, this means we can send you a webhook notification when a new email is received, sent, or meets other criteria such as having a certain subject or sender.
Our webhooks allow you to filter messages by any of the following criteria:
- filter by 'to' address (filter_to)
- filter by 'from' address (filter_from)
- filter by 'cc' address (filter_cc)
- filter by subject (filter_subject)
- filter 'to' a specific domain (filter_to_domain)
- filter 'from' a specific domain (filter_from_domain)
- filter by a certain folder (filter_folder_added)
- filter by thread (filter_thread)
- filter by a file (filer_file_name)
The webhook callback by default will include the message ID (for later retrieval), the sender information, addresses cc'ed, if any, recipient information, and whether the message includes a file or not.
Here is what a sample webhook callback includes:
In addition to the default data you get with a callback, you can choose to have us include:
- The body of the message (set include_body=1)
- The headers of the message (set include_headers=1 or include_headers=raw)
We highly recommend you use include_body with your webhooks. This essentially means we do all the work for you in monitoring changes and sending you everything you need in order to process an email message. This also highly reduces your number of calls to the API, which will in turn reduce the chances of you getting throttled by IMAP providers.