# Verify Omnisend webhooks

Omnisend doesn't sign these requests, so there's no signature to check and no SDK to verify one. You add a secret as a custom header on the Webhook block, and your endpoint compares the whole value in constant time. That authenticates the sender, but it doesn't protect the body or stop a replay, so Omnisend's seven static IP addresses are worth allowlisting as a second check.

Agent skill: `npx skills add hookdeck/webhook-skills --skill omnisend-webhooks` ([details](https://hookdeck.com/webhooks/omnisend/skill))

> Independent reference generated from hookdeck/webhook-registry (commit ff7f882, 20 Nov 2026). [Omnisend's official docs](https://api-docs.omnisend.com/docs/how-to-send-webhooks-from-automations).

[Overview](https://hookdeck.com/webhooks/omnisend) · [MCP events](https://hookdeck.com/webhooks/omnisend/mcp-events) · [Verify signatures](https://hookdeck.com/webhooks/omnisend/verify) · [Production guide](https://hookdeck.com/webhooks/omnisend/guide-duplicates-ordering-retries-timeouts) · [Agent skill](https://hookdeck.com/webhooks/omnisend/skill)

## The facts

| Fact | Value | Source |
|---|---|---|
| Signature header | `None (unsigned)` | [Omnisend docs](https://api-docs.omnisend.com/docs/how-to-send-webhooks-from-automations) |
| What to build | `Compare the secret header you chose with your stored value` | [Omnisend docs](https://api-docs.omnisend.com/docs/how-to-send-webhooks-from-automations) |
| Key | `shared secret` | [Omnisend docs](https://api-docs.omnisend.com/docs/how-to-send-webhooks-from-automations) |

## Omnisend webhook secret

Omnisend issues no secret. You generate a value and add it as a custom header on the Webhook block. Keep it in an environment variable, not in source code.

- Add it in the block's headers in the automation editor, or in the `sendWebhook` action's `headers` array through the API
- You choose the header name, such as `X-Webhook-Secret`. Keys are case-insensitive and must be unique
- A key can be up to 256 characters and a value up to 10,000, and a block can have up to 15 headers
- Omnisend sends the value as you configured it, so a prefix such as `Bearer ` is part of what you compare
- The Automations API returns the value verbatim to anyone with the `automations.read` scope
- To rotate it, disable the automation first, because changing an enabled one returns `409`

Source: [Omnisend docs](https://api-docs.omnisend.com/docs/how-to-send-webhooks-from-automations)

## Code

### Express

From [webhook-skills: skills/omnisend-webhooks/examples/express/src/index.js](https://github.com/hookdeck/webhook-skills/blob/556a89753e3e66e85d2a3ce50558e95b96c08571/skills/omnisend-webhooks/examples/express/src/index.js)

```javascript
// Generated with: omnisend-webhooks skill
// https://github.com/hookdeck/webhook-skills
require('dotenv').config({ quiet: true });
const crypto = require('crypto');
const express = require('express');

const app = express();

/**
 * Constant-time string comparison. Hashing both sides first gives equal-length
 * buffers, so timingSafeEqual never throws and the secret's length isn't leaked.
 */
function safeEqual(a, b) {
  const ha = crypto.createHash('sha256').update(String(a)).digest();
  const hb = crypto.createHash('sha256').update(String(b)).digest();
  return crypto.timingSafeEqual(ha, hb);
}

/**
 * Omnisend does not sign webhooks. Authenticate with a shared secret header you add to the
 * automation's send webhook action. The header name is user-chosen, so it comes from
 * OMNISEND_WEBHOOK_HEADER; the whole header value must equal OMNISEND_WEBHOOK_SECRET
 * (no Bearer parsing). This authenticates the sender, not the body, and gives no replay protection.
 */
function verifyOmnisendRequest(headers, {
  headerName = process.env.OMNISEND_WEBHOOK_HEADER || 'X-Webhook-Secret',
  secret = process.env.OMNISEND_WEBHOOK_SECRET,
} = {}) {
  if (!secret) return false; // never accept when unconfigured
  const received = headers[headerName.toLowerCase()]; // Node lowercases header names
  return typeof received === 'string' && safeEqual(received, secret);
}

// The body is the author's JSON template, so `event` is whatever the template sets.
function handleEvent(payload) {
  const { event } = payload;

  switch (event) {
    case 'subscribed':
      console.log(`Contact subscribed: ${payload.contactEmail}`);
      // Your code: add the contact to your CRM or messaging tool
      break;

    case 'placed order':
      console.log(`Order placed by: ${payload.contactEmail}`);
      // Your code: sync the order (use [[event.raw.<property>]] tags for order data)
      break;

    default:
      console.log(`Unhandled event: ${event}`);
  }
}

// Read the body raw (any content type) so the request is authenticated before parsing.
app.post('/webhooks/omnisend', express.raw({ type: '*/*' }), (req, res) => {
  if (!verifyOmnisendRequest(req.headers)) {
    return res.status(401).json({ error: 'Invalid or missing webhook secret header' });
  }

  let payload;
  try {
    const raw = Buffer.isBuffer(req.body) ? req.body.toString('utf8') : '';
    payload = JSON.parse(raw);
  } catch {
    return res.status(400).json({ error: 'Invalid JSON body' });
  }

  if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
    return res.status(400).json({ error: 'Expected a JSON object' });
  }

  try {
    handleEvent(payload);
  } catch (err) {
    console.error('Error handling Omnisend event:', err);
    return res.status(500).json({ error: 'Handler error' });
  }

  res.status(200).json({ received: true });
});

app.get('/health', (req, res) => {
  res.json({ status: 'ok' });
});

module.exports = app;
module.exports.verifyOmnisendRequest = verifyOmnisendRequest;

if (require.main === module) {
  const PORT = process.env.PORT || 3000;
  app.listen(PORT, () => {
    console.log(`Server running on http://localhost:${PORT}`);
    console.log(`Webhook endpoint: POST http://localhost:${PORT}/webhooks/omnisend`);
  });
}
```

### Next.js

From [webhook-skills: skills/omnisend-webhooks/examples/nextjs/app/webhooks/omnisend/route.ts](https://github.com/hookdeck/webhook-skills/blob/556a89753e3e66e85d2a3ce50558e95b96c08571/skills/omnisend-webhooks/examples/nextjs/app/webhooks/omnisend/route.ts)

```typescript
// Generated with: omnisend-webhooks skill
// https://github.com/hookdeck/webhook-skills
import { NextRequest, NextResponse } from 'next/server';
import { verifyOmnisendRequest } from '../../../lib/verify-omnisend';

// The body is the author's JSON template, so `event` is whatever the template sets.
interface OmnisendPayload {
  event?: string;
  contactEmail?: string;
  [key: string]: unknown;
}

function handleEvent(payload: OmnisendPayload): void {
  const { event } = payload;

  switch (event) {
    case 'subscribed':
      console.log(`Contact subscribed: ${payload.contactEmail}`);
      // Your code: add the contact to your CRM or messaging tool
      break;

    case 'placed order':
      console.log(`Order placed by: ${payload.contactEmail}`);
      // Your code: sync the order (use [[event.raw.<property>]] tags for order data)
      break;

    default:
      console.log(`Unhandled event: ${event}`);
  }
}

export async function POST(request: NextRequest) {
  // Authenticate before reading or parsing the body.
  if (!verifyOmnisendRequest(request.headers)) {
    return NextResponse.json({ error: 'Invalid or missing webhook secret header' }, { status: 401 });
  }

  let payload: unknown;
  try {
    // Read as text so any content type is accepted.
    payload = JSON.parse(await request.text());
  } catch {
    return NextResponse.json({ error: 'Invalid JSON body' }, { status: 400 });
  }

  if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
    return NextResponse.json({ error: 'Expected a JSON object' }, { status: 400 });
  }

  try {
    handleEvent(payload as OmnisendPayload);
  } catch (err) {
    console.error('Error handling Omnisend event:', err);
    return NextResponse.json({ error: 'Handler error' }, { status: 500 });
  }

  return NextResponse.json({ received: true });
}
```

### FastAPI

From [webhook-skills: skills/omnisend-webhooks/examples/fastapi/main.py](https://github.com/hookdeck/webhook-skills/blob/556a89753e3e66e85d2a3ce50558e95b96c08571/skills/omnisend-webhooks/examples/fastapi/main.py)

```python
# Generated with: omnisend-webhooks skill
# https://github.com/hookdeck/webhook-skills
import hashlib
import hmac
import json
import os

from dotenv import load_dotenv
from fastapi import Depends, FastAPI, HTTPException, Request

load_dotenv()

app = FastAPI()


def safe_equal(a: str, b: str) -> bool:
    """Constant-time comparison. Both sides are encoded and hashed, so compare_digest
    never sees a str (which raises on non-ASCII) or unequal lengths."""
    return hmac.compare_digest(
        hashlib.sha256(a.encode("utf-8")).digest(),
        hashlib.sha256(b.encode("utf-8")).digest(),
    )


def verify_omnisend_request(headers, header_name=None, secret=None) -> bool:
    """Omnisend does not sign webhooks. Authenticate with a shared secret header you add to
    the automation's send webhook action. The header name is user-chosen
    (OMNISEND_WEBHOOK_HEADER, default X-Webhook-Secret); the whole header value must equal
    OMNISEND_WEBHOOK_SECRET (no Bearer parsing). This authenticates the sender, not the body,
    and gives no replay protection.
    """
    header_name = header_name or os.environ.get("OMNISEND_WEBHOOK_HEADER") or "X-Webhook-Secret"
    secret = secret if secret is not None else os.environ.get("OMNISEND_WEBHOOK_SECRET")
    if not secret:
        return False  # never accept when unconfigured
    # Case-insensitive lookup that works for Starlette headers and plain dicts alike.
    wanted = header_name.lower()
    received = next((v for k, v in headers.items() if k.lower() == wanted), None)
    return bool(received) and safe_equal(received, secret)


async def require_omnisend_secret(request: Request) -> None:
    """FastAPI dependency: reject the request before the body is parsed."""
    if not verify_omnisend_request(request.headers):
        raise HTTPException(status_code=401, detail="Invalid or missing webhook secret header")


# The body is the author's JSON template, so `event` is whatever the template sets.
def handle_event(payload: dict) -> None:
    event = payload.get("event")

    if event == "subscribed":
        print(f"Contact subscribed: {payload.get('contactEmail')}")
        # Your code: add the contact to your CRM or messaging tool

    elif event == "placed order":
        print(f"Order placed by: {payload.get('contactEmail')}")
        # Your code: sync the order (use [[event.raw.<property>]] tags for order data)

    else:
        print(f"Unhandled event: {event}")


@app.post("/webhooks/omnisend", dependencies=[Depends(require_omnisend_secret)])
async def omnisend_webhook(request: Request):
    # Read the raw body so any content type is accepted.
    raw_body = await request.body()

    try:
        payload = json.loads(raw_body)
    except (json.JSONDecodeError, UnicodeDecodeError):
        raise HTTPException(status_code=400, detail="Invalid JSON body")

    if not isinstance(payload, dict):
        raise HTTPException(status_code=400, detail="Expected a JSON object")

    try:
        handle_event(payload)
    except Exception as err:  # noqa: BLE001
        print(f"Error handling Omnisend event: {err}")
        raise HTTPException(status_code=500, detail="Handler error")

    return {"received": True}


@app.get("/health")
async def health():
    return {"status": "ok"}


if __name__ == "__main__":
    import uvicorn

    uvicorn.run(app, host="0.0.0.0", port=8000)
```

Or install the Omnisend webhooks skill: `npx skills add hookdeck/webhook-skills --skill omnisend-webhooks`

## Common failures

- **Prefix left out of the comparison.** Omnisend sends the header as you configured it. If you typed `Bearer abc`, the value to compare is `Bearer abc`, not `abc`.
- **Header name mismatch.** You choose the name on the block, and your endpoint has to read the same one. Header names are case-insensitive.
- **Secret rotated in one place.** Changing the header on an enabled automation returns `409`, so a new secret on your server can go live before the block has it. Accept both values until the automation is updated and re-enabled.

From [Hookdeck's Omnisend guide](https://hookdeck.com/webhooks/omnisend/guide-duplicates-ordering-retries-timeouts).

---

Not affiliated with Omnisend. Facts are compiled from public sources and linked inline. [View as JSON](https://hookdeck.com/webhooks/omnisend.json) · [Report a correction](https://hookdeck.com/contact)
