SP

Sumitkumar Pandit

BlogTutorials

Tutorials

Brevo Webhooks + Event Tracking - Wiring Real-Time Email Data Into Your App

Delivered, opened, clicked, bounced, spam - how to wire Brevo webhooks into a Next.js API route, idempotency tips, and the automations they unlock.

SP
Sumitkumar Pandit
Jun 25, 2026 8 min

The killer feature nobody talks about in Brevo is the webhook system. When set up correctly, you can react to opens, clicks, bounces and unsubscribes in real time — inside your own product. Here is how I wire it up in a Next.js app.

Which events matter?

  • delivered — email accepted by the recipient server.
  • opened — the recipient loaded the tracking pixel.
  • clicked — a link in the email was clicked.
  • hard_bounce / soft_bounce — permanent or temporary delivery failure.
  • unsubscribed — the recipient opted out.
  • spam — recipient marked the email as spam (fix your list immediately).

Step 1 — Create the webhook endpoint

js
// /app/api/brevo-webhook/route.js import { NextResponse } from "next/server"; export async function POST(req) { const events = await req.json(); // Brevo posts JSON array for (const e of events) { // e.event: "delivered" | "opened" | "click" | "bounce" | "unsubscribed" | "spam" // e.email: recipient // e.message-id: your message id await recordEvent(e); } return NextResponse.json({ ok: true }); }

Step 2 — Register the URL in Brevo

Dashboard → Transactional → Settings → Webhook. Add https://yourdomain.com/api/brevo-webhook and tick the events you care about. Save.

Step 3 — Idempotency (do this)

Brevo occasionally retries a webhook. Use the message-id + event type as an idempotency key and skip duplicates. Otherwise you will double-count opens and confuse your analytics.

Step 4 — Wire it into your product

  • Update user records — mark "email_verified" on first successful delivered event.
  • Suppress future sends automatically on hard_bounce.
  • Trigger a follow-up campaign after a specific click.
  • Alert your team in Slack when spam rate crosses 0.1%.

The compound effect

Once webhooks feed your product database, your onboarding, retention and reactivation campaigns get 3-5× smarter. This is the single biggest lever in modern email — and Brevo gives it away for free.

Useful Free Tools

Improve your email deliverability, authentication, and campaign performance using these free tools.

BrevoWebhooksNext.jsAPI

Keep reading