The SendGrid Event Webhook sends email event data as SendGrid processes it. This means you can receive data in nearly real-time, making it ideal to integrate with logging or monitoring systems.
Because the Event Webhook delivers data to your systems, it is also well-suited to backing up and storing event data within your infrastructure to meet your own data access and retention needs.
You can think about the types of events provided by the Event Webhook in two categories: deliverability events and engagement events.
Both types of events are important and should be monitored to understand the overall health of your email program. The Webhooks API allows you to configure your Event Webhook configurations.
Currently, data staged to be be posted through the webhooks is stored in the US.
This endpoint allows you to retrieve all of your Event Webhooks.
Each webhook will be returned as an object in the webhooks
array with the webhook's configuration details and ID. You can use a webhook's ID to update the webhook's settings, delete the webhook, enable or disable signature verification for the webhook, and, if signature verification is enabled, retrieve the webhook's public key when signature verification is enabled.
Each webhook's settings determine which events will be included in the POST request by the webhook and the URL where the request will be sent. See the Event Webhook Reference for details about each event type.
The public_key
property will be returned only for webhooks with signature verification enabled.
You may share one OAuth configuration across all your webhooks or create unique credentials for each. The OAuth properties will be returned only for webhooks with OAuth configured.
Bearer <<YOUR_API_KEY_HERE>>
The on-behalf-of
header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be "account-id" followed by the customer account's ID (e.g., on-behalf-of: account-id <account-id>
). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., on-behalf-of: <subuser-username>
). See On Behalf Of for more information.
Use this to include optional fields in the response payload. When this is set to include=account_status_change
, the account_status_change
field will be part of the response payload and set to false
by default. See Update an event webhook for enabling this webhook notification which lets you subscribe to account status change events related to compliance action taken by SendGrid.
Success
The maximum number of Event Webhooks you can have enabled under your current Twilio SendGrid plan. See the Twilio SendGrid pricing page for more information about the features available with each plan.
An array of Event Webhook objects. Each object represents one of your webhooks and contains its configuration settings, including which events it is set to send in the POST request, the URL where it will send those events, and the webhook's ID.
1const client = require('@sendgrid/client');2client.setApiKey(process.env.SENDGRID_API_KEY);345const request = {6url: `/v3/user/webhooks/event/settings/all`,7method: 'GET',89}1011client.request(request)12.then(([response, body]) => {13console.log(response.statusCode);14console.log(response.body);15})16.catch(error => {17console.error(error);18});
1const client = require('@sendgrid/client');2client.setApiKey(process.env.SENDGRID_API_KEY);34const queryParams = {5"include": "account_status_change"6};78const request = {9url: `/v3/user/webhooks/event/settings/all`,10method: 'GET',11qs: queryParams12}1314client.request(request)15.then(([response, body]) => {16console.log(response.statusCode);17console.log(response.body);18})19.catch(error => {20console.error(error);21});