# Verify Hightouch webhooks

Hightouch doesn't sign HTTP Request destination requests, so there's no signature to check. Add a secret header to the destination and compare its whole value on your endpoint in constant time. That shows the sender knows the secret, but it doesn't cover the body or stop a replayed request.

These pages cover the requests a Hightouch sync sends to your endpoint. To send events into Hightouch, see its [webhook event source](https://docs.hightouch.com/events/sources/webhook). Sync alerts use a separate [webhook channel with a fixed payload](https://docs.hightouch.com/syncs/alerting#send-alerts-to-a-webhook).

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

> Independent reference generated from hookdeck/webhook-registry (commit ff7f882, 20 Nov 2026). [Hightouch's official docs](https://docs.hightouch.com/destinations/http-request).

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

## The facts

| Fact | Value | Source |
|---|---|---|
| Signature header | `None (unsigned)` | [Hightouch docs](https://docs.hightouch.com/destinations/http-request) |
| What to build | `Compare the header you added with your stored value, byte for byte` | [Hightouch docs](https://docs.hightouch.com/destinations/http-request) |
| Key | `shared secret` | [Hightouch docs](https://docs.hightouch.com/destinations/http-request) |

## Hightouch webhook secret

There's no Hightouch-issued secret. You choose the header and its value in the destination's HTTP headers step. Keep it in an environment variable, not in source code.

- Generate a long random value yourself, for example with `openssl rand -hex 32`.
- Set on the destination, so every request it makes carries the same header, across all its syncs.
- Tick Secret on the header to obscure it in the UI and encrypt it in storage.
- The whole value is what's sent, so include any prefix such as `Bearer ` in what you compare.
- Hightouch documents no separate rotation flow or test and live values.

Source: [Hightouch docs](https://docs.hightouch.com/destinations/http-request)

## Code

### Express

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

```javascript
// Generated with: hightouch-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);
}

/**
 * Hightouch does not sign requests. The HTTP Request destination sends the header you
 * configured (name is your choice), so authenticate by comparing that header's WHOLE value
 * with HIGHTOUCH_WEBHOOK_SECRET. Do not strip or parse a "Bearer " prefix: the secret is
 * whatever exact value you typed. Node lowercases header names, so the lookup is
 * case-insensitive.
 *
 * A static shared credential authenticates the sender, not the body, and gives no replay
 * protection. Use HTTPS and rotate the credential if it leaks.
 */
function verifyHightouchRequest(
  headers,
  secret = process.env.HIGHTOUCH_WEBHOOK_SECRET,
  headerName = process.env.HIGHTOUCH_WEBHOOK_HEADER || 'Authorization'
) {
  if (!secret) return false; // never accept when unconfigured
  const received = headers[headerName.toLowerCase()];
  return typeof received === 'string' && received !== '' && safeEqual(received, secret);
}

// Each sync trigger (rows added / changed / removed) picks its own method and payload,
// and the trigger is not written into the request. A common convention maps the method
// back to the trigger; adjust it to match how you configured the sync.
const TRIGGERS = {
  POST: 'row_added',
  PUT: 'row_changed',
  PATCH: 'row_changed',
  DELETE: 'row_removed',
};

function handleRequest(method, payload) {
  // With batching enabled the body is an array of rows (or an object wrapping one).
  const trigger = TRIGGERS[method] || 'unmapped';

  switch (trigger) {
    case 'row_added':
      console.log('Rows added:', JSON.stringify(payload));
      // Your code: create the record(s) in your system
      break;

    case 'row_changed':
      console.log('Rows changed:', JSON.stringify(payload));
      // Your code: update the record(s)
      break;

    case 'row_removed':
      console.log('Rows removed:', JSON.stringify(payload));
      // Your code: delete the record(s)
      break;

    default:
      console.log(`Unmapped ${method} request:`, JSON.stringify(payload));
  }

  return trigger;
}

// Read the body raw (any content type) so the request is authenticated before parsing.
app.all('/webhooks/hightouch', express.raw({ type: '*/*' }), (req, res) => {
  if (!['GET', 'POST', 'PUT', 'PATCH', 'DELETE'].includes(req.method)) {
    return res.status(405).set('Allow', 'GET, POST, PUT, PATCH, DELETE').json({ error: 'Method not allowed' });
  }

  if (!verifyHightouchRequest(req.headers)) {
    return res.status(401).json({ error: 'Invalid or missing credential header' });
  }

  // Body may legitimately be empty (e.g. GET, or an empty-body sync).
  const raw = Buffer.isBuffer(req.body) ? req.body.toString('utf8') : '';
  let payload = null;
  if (raw.trim() !== '') {
    try {
      payload = JSON.parse(raw);
    } catch {
      return res.status(400).json({ error: 'Invalid JSON body' });
    }
  }

  try {
    const trigger = handleRequest(req.method, payload);
    res.status(200).json({ received: true, trigger });
  } catch (err) {
    console.error('Error handling Hightouch request:', err);
    res.status(500).json({ error: 'Handler error' });
  }
});

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

module.exports = app;
module.exports.verifyHightouchRequest = verifyHightouchRequest;

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: http://localhost:${PORT}/webhooks/hightouch (POST, PUT, PATCH, DELETE, GET)`);
  });
}
```

### Next.js

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

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

// Each sync trigger (rows added / changed / removed) picks its own method and payload,
// and the trigger is not written into the request. A common convention maps the method
// back to the trigger; adjust it to match how you configured the sync.
const TRIGGERS: Record<string, string> = {
  POST: 'row_added',
  PUT: 'row_changed',
  PATCH: 'row_changed',
  DELETE: 'row_removed',
};

function handleRequest(method: string, payload: unknown): string {
  // With batching enabled the body is an array of rows (or an object wrapping one).
  const trigger = TRIGGERS[method] ?? 'unmapped';

  switch (trigger) {
    case 'row_added':
      console.log('Rows added:', JSON.stringify(payload));
      // Your code: create the record(s) in your system
      break;

    case 'row_changed':
      console.log('Rows changed:', JSON.stringify(payload));
      // Your code: update the record(s)
      break;

    case 'row_removed':
      console.log('Rows removed:', JSON.stringify(payload));
      // Your code: delete the record(s)
      break;

    default:
      console.log(`Unmapped ${method} request:`, JSON.stringify(payload));
  }

  return trigger;
}

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

  // Read as text so any content type is accepted; an empty body (e.g. GET) is fine.
  const raw = await request.text();
  let payload: unknown = null;
  if (raw.trim() !== '') {
    try {
      payload = JSON.parse(raw);
    } catch {
      return NextResponse.json({ error: 'Invalid JSON body' }, { status: 400 });
    }
  }

  try {
    const trigger = handleRequest(request.method, payload);
    return NextResponse.json({ received: true, trigger });
  } catch (err) {
    console.error('Error handling Hightouch request:', err);
    return NextResponse.json({ error: 'Handler error' }, { status: 500 });
  }
}

// The HTTP Request destination supports GET, POST, PUT, PATCH and DELETE.
export const GET = handle;
export const POST = handle;
export const PUT = handle;
export const PATCH = handle;
export const DELETE = handle;
```

### FastAPI

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

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

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

load_dotenv()

app = FastAPI()

# Each sync trigger (rows added / changed / removed) picks its own method and payload,
# and the trigger is not written into the request. A common convention maps the method
# back to the trigger; adjust it to match how you configured the sync.
TRIGGERS = {
    "POST": "row_added",
    "PUT": "row_changed",
    "PATCH": "row_changed",
    "DELETE": "row_removed",
}


def safe_equal(a: str, b: str) -> bool:
    """Constant-time comparison. Encode both sides to bytes: compare_digest raises on
    non-ASCII str."""
    return hmac.compare_digest(a.encode("utf-8"), b.encode("utf-8"))


def verify_hightouch_request(headers, secret=None, header_name=None) -> bool:
    """Hightouch does not sign requests. The HTTP Request destination sends the header you
    configured (name is your choice), so authenticate by comparing that header's WHOLE
    value with HIGHTOUCH_WEBHOOK_SECRET. Do not strip or parse a "Bearer " prefix: the
    secret is whatever exact value you typed. Starlette headers are case-insensitive.

    A static shared credential authenticates the sender, not the body, and gives no replay
    protection. Use HTTPS and rotate the credential if it leaks.
    """
    secret = secret if secret is not None else os.environ.get("HIGHTOUCH_WEBHOOK_SECRET")
    header_name = header_name or os.environ.get("HIGHTOUCH_WEBHOOK_HEADER") or "Authorization"
    if not secret:
        return False  # never accept when unconfigured
    # Lower-case both sides so the lookup is case-insensitive for any mapping type.
    received = {k.lower(): v for k, v in headers.items()}.get(header_name.lower())
    return bool(received) and safe_equal(received, secret)


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


def handle_request(method: str, payload) -> str:
    # With batching enabled the body is a list of rows (or a dict wrapping one).
    trigger = TRIGGERS.get(method, "unmapped")

    if trigger == "row_added":
        print(f"Rows added: {json.dumps(payload)}")
        # Your code: create the record(s) in your system

    elif trigger == "row_changed":
        print(f"Rows changed: {json.dumps(payload)}")
        # Your code: update the record(s)

    elif trigger == "row_removed":
        print(f"Rows removed: {json.dumps(payload)}")
        # Your code: delete the record(s)

    else:
        print(f"Unmapped {method} request: {json.dumps(payload)}")

    return trigger


# The HTTP Request destination supports GET, POST, PUT, PATCH and DELETE.
@app.api_route(
    "/webhooks/hightouch",
    methods=["GET", "POST", "PUT", "PATCH", "DELETE"],
    dependencies=[Depends(require_hightouch_credential)],
)
async def hightouch_webhook(request: Request):
    # Read the raw body so any content type is accepted; it may be empty (e.g. GET).
    raw_body = await request.body()

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

    try:
        trigger = handle_request(request.method, payload)
    except Exception as err:  # noqa: BLE001
        print(f"Error handling Hightouch request: {err}")
        raise HTTPException(status_code=500, detail="Handler error")

    return {"received": True, "trigger": trigger}


@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 Hightouch webhooks skill: `npx skills add hookdeck/webhook-skills --skill hightouch-webhooks`

## Common failures

- **The compared value is missing a prefix.** Hightouch sends the header value as you entered it. If you entered `Bearer abc123`, compare the whole string, prefix included.
- **The destination uses OAuth.** With OAuth, Hightouch fetches access tokens from your provider, so there's no fixed value to compare. Use a static header, or validate the token with that provider.
- **The header is on a different destination.** Headers belong to the destination, so a second destination pointing at the same endpoint needs the header added too.

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

---

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