How to Debug SendGrid Webhooks

SendGrid's Event Webhook sends real-time notifications about your email delivery events, including deliveries, opens, clicks, bounces, and spam reports. These webhooks are crucial for email deliverability monitoring.

What are SendGrid Webhooks?

SendGrid webhooks are HTTP POST requests that SendGrid sends to your server when specific events occur in your account. Rather than continuously polling the SendGrid API for updates, webhooks deliver real-time notifications the moment something happens — a payment completes, a user signs up, a deployment finishes, or any other tracked event.

Debugging these webhooks can be challenging because they originate from SendGrid's servers, not your browser. You can't simply open DevTools to inspect them. That's where WebhookVault comes in — capture every SendGrid webhook, inspect the full payload and headers, and replay them to your local development server.

Common SendGrid Webhook Events

EventDescription
deliveredFired when the receiving server accepts your email
bounceFired when the receiving server rejects your email
openFired when a recipient opens your email (if tracking is enabled)
clickFired when a recipient clicks a link in your email

Setting Up SendGrid Webhooks with WebhookVault

Follow these steps to start capturing and debugging SendGrid webhooks using WebhookVault.

1Create a WebhookVault endpoint

Sign up for a free WebhookVault API key and create an endpoint to capture SendGrid webhooks.

curl -X POST https://webhookvault.anethoth.com/api/v1/endpoints \
  -H "Authorization: Bearer wv_your_key" \
  -H "Content-Type: application/json" \
  -d '{"name": "SendGrid Webhooks"}'

# Response:
# {"url": "https://webhookvault.anethoth.com/hook/abc123", "inspect_url": "https://webhookvault.anethoth.com/inspect/abc123"}

2Configure SendGrid to send webhooks

Go to SendGrid Dashboard > Settings > Mail Settings > Event Webhook Enter your WebhookVault endpoint URL Select the events you want to receive (delivered, bounced, opened, etc.) Enable the Event Webhook and save

3Inspect captured requests

Once SendGrid sends a webhook, you can inspect every detail through the WebhookVault API or web inspector.

curl https://webhookvault.anethoth.com/api/v1/endpoints/abc123/requests \
  -H "Authorization: Bearer wv_your_key"

# Returns all captured SendGrid webhook requests with full headers, body, and metadata

4Replay to your local server

Replay any captured SendGrid webhook to your local development server for testing.

curl -X POST https://webhookvault.anethoth.com/api/v1/endpoints/abc123/requests/1/replay \
  -H "Authorization: Bearer wv_your_key" \
  -H "Content-Type: application/json" \
  -d '{"url": "http://localhost:3000/webhook"}'

# The original SendGrid webhook is replayed to your local server

Sample SendGrid Webhook Payload

Here is an example of a typical SendGrid webhook payload. Use WebhookVault to capture real payloads from your SendGrid account for accurate testing.

[
  {
    "email": "[email protected]",
    "event": "delivered",
    "sg_event_id": "ZHJvcC0xMDk5NDkxOS1MUnpYb",
    "sg_message_id": "14c5d75ce93.dfd.64b469.filter0001",
    "smtp-id": "<14c5d75ce93.dfd.64b469@ismtpd-555>",
    "timestamp": 1706000000,
    "response": "250 OK"
  }
]

Common SendGrid Webhook Issues

Here are the most common issues developers encounter when working with SendGrid webhooks, and how to resolve them.

Events arrive in batches

SendGrid batches events and sends them as a JSON array. Your handler must parse an array, not a single object.

Signed webhook verification

Enable Signed Event Webhook Requests in SendGrid settings and verify the X-Twilio-Email-Event-Webhook-Signature header.

Duplicate events

SendGrid may send duplicate events. Use the sg_event_id field for deduplication.

Missing open/click events

Open and click tracking must be enabled in SendGrid settings. Open tracking uses a pixel and may not fire for all email clients.

Frequently Asked Questions

What are SendGrid webhooks?

SendGrid webhooks are HTTP callbacks that SendGrid sends to your server when specific events occur. Instead of polling the SendGrid API for changes, webhooks push real-time notifications to your application, making your integration more efficient and responsive.

How do I test SendGrid webhooks locally?

Use WebhookVault to capture SendGrid webhooks in the cloud, then replay them to your localhost. Create a WebhookVault endpoint, configure SendGrid to send webhooks to it, and use the replay API to forward captured requests to http://localhost:3000/webhook (or your local port).

How do I verify SendGrid webhook signatures?

Most webhook providers, including SendGrid, sign their webhook payloads to prove authenticity. Check the SendGrid documentation for the specific signature header and verification algorithm. Use WebhookVault to capture and inspect the raw headers to debug signature verification issues.

Why is WebhookVault better than ngrok for SendGrid webhook testing?

Unlike ngrok, WebhookVault captures and stores every webhook request with full headers and payloads. You can replay any SendGrid webhook to your local server as many times as needed, inspect historical requests, and share webhook data with your team. No tunnel to maintain or port to expose.

Start debugging SendGrid webhooks now

Create a free WebhookVault endpoint in seconds. Capture, inspect, and replay SendGrid webhooks with zero configuration.

Get Free API Key