Verify Outreach webhooks
Signing is opt-in. If the webhook has a secret, each delivery carries Outreach-Webhook-Signature, a hex HMAC-SHA256 of the raw body, so you can check it came from Outreach and wasn't changed. Outreach publishes no fixed IP list and no signed timestamp, so this signature is your only check of a delivery's origin, and it doesn't protect against replays.
The facts
Outreach-Webhook-Signature Not every delivery is signed: check your setup.
{raw body} The request body exactly as sent. No timestamp or other value is signed.
Outreach webhook secret
You set the secret yourself, as the secret attribute on each webhook. Outreach redacts it from regular users and from other applications, so keep your own copy. Keep it in an environment variable, not in source code.
- Send your secret as
secretinPOST /api/v2/webhooks, or add it to an existing webhook withPATCH /api/v2/webhooks/{id}. The API reference allows up to 255 characters. - Each webhook has its own
secret. - Admin users, outside an application, can see it. An application sees it only on webhooks it created, and regular users see it redacted.
- Outreach doesn't document a rotation window.
Source: Outreach docs ↗
Code
// Generated with: outreach-webhooks skill
// https://github.com/hookdeck/webhook-skills
const express = require('express');
const crypto = require('crypto');
require('dotenv').config({ quiet: true });
const app = express();
const PORT = process.env.PORT || 3000;
// Outreach sends Outreach-Webhook-Signature (bare hex HMAC-SHA256 of the raw
// body, keyed with the webhook's secret) only when the webhook has a secret.
// https://developers.outreach.io/api/webhooks#authenticity-validation
function verifyOutreachSignature(rawBody, signatureHeader, secret) {
if (!signatureHeader || !secret) {
return false;
}
const expected = crypto.createHmac('sha256', secret).update(rawBody).digest('hex');
const received = Buffer.from(signatureHeader.trim().toLowerCase());
const expectedBuf = Buffer.from(expected);
// timingSafeEqual throws on length mismatch, so check length first
return received.length === expectedBuf.length && crypto.timingSafeEqual(received, expectedBuf);
}
app.get('/health', (req, res) => {
res.json({ status: 'ok' });
});
app.post('/webhooks/outreach',
// Raw body for all content types (Outreach may send application/vnd.api+json)
express.raw({ type: '*/*', limit: '5mb' }),
(req, res) => {
const secret = process.env.OUTREACH_WEBHOOK_SECRET;
if (!secret) {
console.error('OUTREACH_WEBHOOK_SECRET is not set');
return res.status(500).send('Webhook secret not configured');
}
const rawBody = Buffer.isBuffer(req.body) ? req.body : Buffer.alloc(0);
const signature = req.headers['outreach-webhook-signature'];
if (!signature) {
// Usually means the webhook was created without a `secret` attribute
return res.status(400).send('Missing Outreach-Webhook-Signature header');
}
if (!verifyOutreachSignature(rawBody, signature, secret)) {
console.error('Outreach webhook signature verification failed');
return res.status(400).send('Invalid signature');
}
let payload;
try {
payload = JSON.parse(rawBody.toString('utf8'));
} catch {
return res.status(400).send('Invalid JSON');
}
// JSON:API payload: data {type, id, attributes}, meta {deliveredAt, eventName}
const eventName = payload.meta && payload.meta.eventName;
const data = payload.data || {};
switch (eventName) {
case 'prospect.created':
console.log(`Prospect created: ${data.id}`);
break;
case 'prospect.updated':
console.log(`Prospect updated: ${data.id}`);
break;
case 'sequenceState.created':
console.log(`Prospect added to a sequence (sequenceState ${data.id})`);
break;
case 'call.created':
console.log(`Call logged: ${data.id}`);
break;
case 'task.completed':
console.log(`Task completed: ${data.id}`);
break;
case 'mailing.replied':
console.log(`Mailing replied: ${data.id}`);
break;
default:
console.log(`Unhandled event: ${eventName}`);
}
// Respond fast: Outreach times out after 5 seconds and never retries on a status code
res.json({ received: true });
}
);
app.use((req, res) => {
res.status(404).json({ error: 'Not found' });
});
app.use((err, req, res, next) => {
console.error('Error:', err);
res.status(500).json({ error: 'Internal server error' });
});
const server = app.listen(PORT, () => {
console.log(`Outreach webhook server listening on port ${PORT}`);
console.log(`Webhook endpoint: POST http://localhost:${PORT}/webhooks/outreach`);
});
// For testing
module.exports = { app, server, verifyOutreachSignature }; // Generated with: outreach-webhooks skill
// https://github.com/hookdeck/webhook-skills
import { NextRequest, NextResponse } from 'next/server';
import crypto from 'crypto';
// Outreach sends Outreach-Webhook-Signature (bare hex HMAC-SHA256 of the raw
// body, keyed with the webhook's secret) only when the webhook has a secret.
// https://developers.outreach.io/api/webhooks#authenticity-validation
function verifyOutreachSignature(rawBody: string, signatureHeader: string | null, secret: string | undefined): boolean {
if (!signatureHeader || !secret) {
return false;
}
const expected = crypto.createHmac('sha256', secret).update(rawBody).digest('hex');
const received = Buffer.from(signatureHeader.trim().toLowerCase());
const expectedBuf = Buffer.from(expected);
// timingSafeEqual throws on length mismatch, so check length first
return received.length === expectedBuf.length && crypto.timingSafeEqual(received, expectedBuf);
}
export async function POST(request: NextRequest) {
const secret = process.env.OUTREACH_WEBHOOK_SECRET;
if (!secret) {
console.error('OUTREACH_WEBHOOK_SECRET is not set');
return NextResponse.json({ error: 'Webhook secret not configured' }, { status: 500 });
}
// Read the raw body as text; never rely on parsed JSON for verification
const rawBody = await request.text();
const signature = request.headers.get('outreach-webhook-signature');
if (!signature) {
// Usually means the webhook was created without a `secret` attribute
return NextResponse.json({ error: 'Missing Outreach-Webhook-Signature header' }, { status: 400 });
}
if (!verifyOutreachSignature(rawBody, signature, secret)) {
console.error('Outreach webhook signature verification failed');
return NextResponse.json({ error: 'Invalid signature' }, { status: 400 });
}
let payload: { data?: { id?: number | string }; meta?: { eventName?: string } };
try {
payload = JSON.parse(rawBody);
} catch {
return NextResponse.json({ error: 'Invalid JSON' }, { status: 400 });
}
// JSON:API payload: data {type, id, attributes}, meta {deliveredAt, eventName}
const eventName = payload.meta?.eventName;
const id = payload.data?.id;
switch (eventName) {
case 'prospect.created':
console.log(`Prospect created: ${id}`);
break;
case 'prospect.updated':
console.log(`Prospect updated: ${id}`);
break;
case 'sequenceState.created':
console.log(`Prospect added to a sequence (sequenceState ${id})`);
break;
case 'call.created':
console.log(`Call logged: ${id}`);
break;
case 'task.completed':
console.log(`Task completed: ${id}`);
break;
case 'mailing.replied':
console.log(`Mailing replied: ${id}`);
break;
default:
console.log(`Unhandled event: ${eventName}`);
}
// Respond fast: Outreach times out after 5 seconds and never retries on a status code
return NextResponse.json({ received: true });
} # Generated with: outreach-webhooks skill
# https://github.com/hookdeck/webhook-skills
import hashlib
import hmac
import json
import logging
import os
from dotenv import load_dotenv
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
load_dotenv()
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
app = FastAPI(title="Outreach Webhook Handler")
def verify_outreach_signature(raw_body: bytes, signature_header, secret) -> bool:
"""Outreach sends Outreach-Webhook-Signature (bare hex HMAC-SHA256 of the raw
body, keyed with the webhook's secret) only when the webhook has a secret.
https://developers.outreach.io/api/webhooks#authenticity-validation"""
if not signature_header or not secret:
return False
expected = hmac.new(secret.encode("utf-8"), raw_body, hashlib.sha256).hexdigest()
# Constant-time compare on bytes so non-ASCII input can't raise
return hmac.compare_digest(signature_header.strip().lower().encode("utf-8"), expected.encode("utf-8"))
@app.get("/health")
async def health():
return {"status": "ok"}
@app.post("/webhooks/outreach")
async def outreach_webhook(request: Request):
secret = os.getenv("OUTREACH_WEBHOOK_SECRET")
if not secret:
logger.error("OUTREACH_WEBHOOK_SECRET is not set")
return JSONResponse(status_code=500, content={"error": "Webhook secret not configured"})
# Raw body: read bytes first, parse only after verification
raw_body = await request.body()
signature = request.headers.get("outreach-webhook-signature")
if not signature:
# Usually means the webhook was created without a `secret` attribute
return JSONResponse(status_code=400, content={"error": "Missing Outreach-Webhook-Signature header"})
if not verify_outreach_signature(raw_body, signature, secret):
logger.error("Outreach webhook signature verification failed")
return JSONResponse(status_code=400, content={"error": "Invalid signature"})
try:
payload = json.loads(raw_body)
except ValueError:
return JSONResponse(status_code=400, content={"error": "Invalid JSON"})
# JSON:API payload: data {type, id, attributes}, meta {deliveredAt, eventName}
meta = payload.get("meta") or {} if isinstance(payload, dict) else {}
data = payload.get("data") or {} if isinstance(payload, dict) else {}
event_name = meta.get("eventName")
record_id = data.get("id") if isinstance(data, dict) else None
if event_name == "prospect.created":
logger.info("Prospect created: %s", record_id)
elif event_name == "prospect.updated":
logger.info("Prospect updated: %s", record_id)
elif event_name == "sequenceState.created":
logger.info("Prospect added to a sequence (sequenceState %s)", record_id)
elif event_name == "call.created":
logger.info("Call logged: %s", record_id)
elif event_name == "task.completed":
logger.info("Task completed: %s", record_id)
elif event_name == "mailing.replied":
logger.info("Mailing replied: %s", record_id)
else:
logger.info("Unhandled event: %s", event_name)
# Respond fast: Outreach times out after 5 seconds and never retries on a status code
return {"received": True} Or install the Outreach webhooks skill:
npx skills add hookdeck/webhook-skills --skill outreach-webhooks
Common failures
Webhook has no secret
Outreach sends no signature header without a secret. Add one with PATCH /api/v2/webhooks/{id}, then trigger another event.
Body parsed before verification
The HMAC covers the exact bytes Outreach sent. Verify against the raw request body, before any parsing.
Secrets don't match
Your copy must match the secret on the webhook. Regular users and other applications see it redacted, so set a new one if yours is lost.
Hex compared with another encoding
The header is a bare hex digest with no prefix, so comparing it with a base64 digest always fails.
Let Event Gateway verify Outreach's signatures.
Set the same secret on your Outreach webhook and your Event Gateway source. Event Gateway verifies each delivery before it reaches your service, then queues it and retries failures on your schedule.