Verify Workable webhooks

Workable signs each request: X-Workable-Signature holds an HMAC-SHA256 of the request body, so you can check it came from Workable and wasn't altered. There's no dedicated webhook secret, because the key is your account token or, for OAuth integrations, the OAuth application secret. Workable doesn't state the digest encoding, so the code here uses hex, as the open-source n8n and Botpress integrations do. Nothing but the body is signed, so the signature gives no replay protection.

The facts

Signature header
X-Workable-Signature

Format: <hex digest> (from third-party integrations; Workable doesn't state the encoding)

Scheme
HMAC-SHA256
Signed material
{raw body}

The request body exactly as sent. Workable names nothing else in the signature.

What to build
Recompute a digest over the raw body and compare
Key
shared secret

Workable webhook secret

There is no dedicated webhook secret. The key is an API credential, the account token or the OAuth application secret, whichever the integration uses. Keep it in an environment variable, not in source code.

  • Account token integrations: the key is the API access token. Generate one under Integrations > Generate new token, and pick its scopes there. Subscribing needs r_candidates or r_employees.
  • OAuth integrations: the key is the OAuth application secret.
  • The token is displayed only once, when you generate it, so store a copy then.
  • Use the token you created the subscription with. An account can have several tokens, and Workable doesn't say how it picks one if they differ.
  • Workable documents no webhook-specific rotation. Revoking a token stops everything that uses it, and it doesn't say what happens to subscriptions made with that token.

Source: Workable docs ↗

Code

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

const app = express();

// Workable signs the raw body with HMAC-SHA256 (hex) in X-Workable-Signature.
// The key is the API token that created the subscription (or the OAuth app secret).
function verifySignature(rawBody, signatureHeader, key) {
  if (!signatureHeader || !key) return false;
  const expected = crypto.createHmac('sha256', key).update(rawBody).digest('hex');
  try {
    return crypto.timingSafeEqual(Buffer.from(signatureHeader.toLowerCase()), Buffer.from(expected));
  } catch {
    return false; // different lengths
  }
}

// Read the raw body for any content type so verification never depends on Content-Type.
app.post('/webhooks/workable', express.raw({ type: '*/*' }), (req, res) => {
  const rawBody = req.body;
  if (!Buffer.isBuffer(rawBody)) {
    return res.status(400).send('Missing body');
  }

  const signature = req.get('X-Workable-Signature');
  if (!signature) {
    return res.status(400).send('Missing X-Workable-Signature header');
  }
  if (!verifySignature(rawBody, signature, process.env.WORKABLE_SIGNING_KEY)) {
    return res.status(400).send('Invalid signature');
  }

  let payload;
  try {
    payload = JSON.parse(rawBody.toString('utf8'));
  } catch {
    return res.status(400).send('Invalid JSON');
  }

  const eventType = payload.event_type;
  switch (eventType) {
    case 'candidate_created':
      console.log('Candidate created:', payload.id);
      break;
    case 'candidate_moved':
      console.log('Candidate moved:', payload.id);
      break;
    case 'employee_created':
      console.log('Employee created:', payload.id);
      break;
    case 'employee_updated':
      console.log('Employee updated:', payload.id);
      break;
    case 'employee_published':
      console.log('Employee published:', payload.id);
      break;
    default:
      console.log('Unhandled event:', eventType);
  }

  // Workable replays the request unless the response is 200.
  res.status(200).json({ received: true });
});

if (require.main === module) {
  const port = process.env.PORT || 3000;
  app.listen(port, () => console.log(`Listening on http://localhost:${port}`));
}

module.exports = app;
nextjs/app/webhooks/workable/route.ts
typescript
// Generated with: workable-webhooks skill
// https://github.com/hookdeck/webhook-skills
import { NextRequest, NextResponse } from 'next/server';
import crypto from 'crypto';

// Workable signs the raw body with HMAC-SHA256 (hex) in X-Workable-Signature.
// The key is the API token that created the subscription (or the OAuth app secret).
function verifySignature(rawBody: string, signatureHeader: string | null, key: string | undefined): boolean {
  if (!signatureHeader || !key) return false;
  const expected = crypto.createHmac('sha256', key).update(rawBody).digest('hex');
  try {
    return crypto.timingSafeEqual(Buffer.from(signatureHeader.toLowerCase()), Buffer.from(expected));
  } catch {
    return false; // different lengths
  }
}

export async function POST(request: NextRequest) {
  // text() returns the raw body regardless of Content-Type
  const rawBody = await request.text();

  const signature = request.headers.get('x-workable-signature');
  if (!signature) {
    return NextResponse.json({ error: 'Missing X-Workable-Signature header' }, { status: 400 });
  }
  if (!verifySignature(rawBody, signature, process.env.WORKABLE_SIGNING_KEY)) {
    return NextResponse.json({ error: 'Invalid signature' }, { status: 400 });
  }

  let payload: { id?: string; event_type?: string };
  try {
    payload = JSON.parse(rawBody);
  } catch {
    return NextResponse.json({ error: 'Invalid JSON' }, { status: 400 });
  }

  const eventType = payload.event_type;
  switch (eventType) {
    case 'candidate_created':
      console.log('Candidate created:', payload.id);
      break;
    case 'candidate_moved':
      console.log('Candidate moved:', payload.id);
      break;
    case 'employee_created':
      console.log('Employee created:', payload.id);
      break;
    case 'employee_updated':
      console.log('Employee updated:', payload.id);
      break;
    case 'employee_published':
      console.log('Employee published:', payload.id);
      break;
    default:
      console.log('Unhandled event:', eventType);
  }

  // Workable replays the request unless the response is 200.
  return NextResponse.json({ received: true });
}
fastapi/main.py
python
# Generated with: workable-webhooks skill
# https://github.com/hookdeck/webhook-skills
import hashlib
import hmac
import json
import os

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

load_dotenv()

app = FastAPI()


def verify_signature(raw_body: bytes, signature_header: str | None, key: str | None) -> bool:
    """Workable signs the raw body with HMAC-SHA256 (hex) in X-Workable-Signature.

    The key is the API token that created the subscription (or the OAuth app secret).
    """
    if not signature_header or not key:
        return False
    expected = hmac.new(key.encode(), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(signature_header.lower().encode(), expected.encode())


@app.post("/webhooks/workable")
async def workable_webhook(request: Request):
    # Raw bytes, whatever the Content-Type
    raw_body = await request.body()

    signature = request.headers.get("x-workable-signature")
    if not signature:
        raise HTTPException(status_code=400, detail="Missing X-Workable-Signature header")
    if not verify_signature(raw_body, signature, os.getenv("WORKABLE_SIGNING_KEY")):
        raise HTTPException(status_code=400, detail="Invalid signature")

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

    event_type = payload.get("event_type")
    if event_type == "candidate_created":
        print("Candidate created:", payload.get("id"))
    elif event_type == "candidate_moved":
        print("Candidate moved:", payload.get("id"))
    elif event_type == "employee_created":
        print("Employee created:", payload.get("id"))
    elif event_type == "employee_updated":
        print("Employee updated:", payload.get("id"))
    elif event_type == "employee_published":
        print("Employee published:", payload.get("id"))
    else:
        print("Unhandled event:", event_type)

    # Workable replays the request unless the response is 200.
    return {"received": True}

From hookdeck/webhook-skills ↗

Or install the Workable webhooks skill:

npx skills add hookdeck/webhook-skills --skill workable-webhooks

Common failures

Wrong key

Use the token you created the subscription with, or the OAuth application secret for OAuth integrations, as a plain string with no Bearer prefix.

Wrong encoding

Workable doesn't state the encoding. If hex never matches with the right key, log the header from one delivery: 64 hex characters is hex, and 44 characters ending in = is base64.

Body parsed before verification

The signature covers the request payload. Read the raw bytes first, with express.raw(), await request.text() or await request.body(), and parse them after the check.

From Hookdeck's Workable guide

Let Event Gateway verify Workable signatures.

Event Gateway verifies the signature on each Workable delivery before it reaches your service, then queues it and retries failures on your schedule.

Not affiliated with Workable. Facts are compiled from public sources and linked inline.