The SparkPost webhooks interface allows you to push web hook events of your choice to your own endpoint for processing. You can also retrieve event level data through the Message Events API.
There are three (3) main categories of webhook events in SparkPost:
- Message Events: Describe the lifecycle of a message (transmission), including: injection, delivery, and disposition
- Generation Events: Provide insight into message creation failures or rejections (by SparkPost)
- Engagement Events: Describe what recipients "do" with your email, such as: opens (renders) and clicks
Each of the above categories have a variety of event types, each with a unique set of fields that will provide information to your webhook event consumer. Read the full list of event-to-field mappings in SparkPost webhooks.
How to define a Webhook in SparkPost
There are two ways to create a webhook in SparkPost: Using the SparkPost Webhook API or using the SparkPost UI (directions below).
- Login to SparkPost
- Navigate to Webhooks
- Click on the "New Webhook" button
- Set the following values:
- Webhook Name: human friendly name for your webhook
- Target URL : The URL where your webhook event consumer resides and the path to the event handler. Example: http[s]://your.domain.tld/webhook/event/handler
- Basic Auth or OAuth [OPTIONAL]: The Authentication Token is still there for existing webhooks, but has been deprecated for new ones.
- All: The webhook will receive ALL events from ALL webhook categories
- Select: You can choose which events you want to be sent to your webhook consumer
- Click the Add Webhook button, and your webhook will be saved.
- If you want to test that the webhook is working, click the "Test" tab.
- If you want to modify your webhook, click the "Setting" tab.
- If you want to delete this webook, click Delete.