Skip to main content
API recipe Webhook Developer integration

How do you receive Rodz leads by webhook and verify their HMAC signature?

Peter Cools · Updated on · 7 min read · View as Markdown

Short answer

Expose an HTTPS POST route, read the raw body, recompute the HMAC-SHA256 of "timestamp + dot + body" with your API key’s webhook secret and compare it in constant time with the X-Webhook-Signature header. Reject stale timestamps, skip an X-Webhook-Id you already processed, answer 200 at once and process the lead afterwards. Test it with the test-webhook endpoint, reserved for partner accounts (without that status it answers 403 PARTNER_ACCESS_REQUIRED: write to support@rodz.io to enable it).

Key facts

  • The signature is a hex HMAC-SHA256 of {X-Webhook-Timestamp}.{raw body}, with a Unix timestamp in seconds computed again on every send.
  • A timeout, a connection error or a 5xx triggers retries: several within about two hours, then at 30 min, 1 h, 2 h, 4 h, then every 6 hours, for up to 14 days after the lead was created; a 4xx is permanent; a 429 asks Rodz to slow down and retry; a receiver whose answer says its credits or quota ran out (402, or 400/429 with that message in the body) gets slow retries instead of losing the leads.
  • The API accepts 9,000 requests per clock minute per key; above that it answers 429 (code RATE_LIMIT_EXCEEDED) with a Retry-After header giving the seconds until the next minute (1 to 60).
  • Rodz identifies 400,000+ signals a month (July to September 2026 average), delivered by webhook or readable through the API.
Setup time : 30 min

Before you start

  • A Rodz API key and its webhook secret: Integrations → API in the dashboard (the secret can be regenerated there).
  • A signal linked to that API key (created with it through the API): with no key linked, deliveries go out unsigned.
  • A public HTTPS URL for your server (a tunnel is enough during development).
  • Node.js 18+ with Express 4, or Python 3.10+ with FastAPI.

Steps

  1. Step 1. Get the webhook secret

    In the Rodz dashboard, open Integrations → API. Each API key has a webhook secret generated automatically. It is shown only when you create the key or after a regeneration: copy it straight away into a RODZ_WEBHOOK_SECRET environment variable, never into the code.

  2. Step 2. Write the receiver in Node.js

    The key point: read the raw body (express.raw), because the signature covers the exact bytes sent. The receiver checks the signature, refuses a timestamp older than 5 minutes, stores the delivery durably, deduplicating on X-Webhook-Id, answers 200, then processes the lead. A 200 closes the delivery on Rodz’s side: if you answer before writing, a crash at that moment loses the lead, because Rodz will not send it again. The examples use local memory in place of your database: replace it with a single write to a database (INSERT ... ON CONFLICT DO NOTHING on X-Webhook-Id).

    node/server.js

    // Rodz webhook receiver (Node.js 18+, Express 4).
    const express = require('express');
    const crypto = require('crypto');
    
    const SECRET = process.env.RODZ_WEBHOOK_SECRET;
    const TOLERANCE_SECONDS = 300;
    const deliveries = new Map(); // in production: a table whose unique key is X-Webhook-Id
    
    // Writes the delivery AND deduplicates it in one operation (SQL: INSERT ... ON CONFLICT DO NOTHING).
    // Returns false when this id is already stored.
    function saveDelivery(deliveryId, rawBody) {
      if (deliveries.has(deliveryId)) return false;
      deliveries.set(deliveryId, { body: rawBody.toString('utf8'), done: false });
      return true;
    }
    
    function isValid(rawBody, signature, timestamp) {
      if (!signature || !timestamp) return false;
      const expected = crypto
        .createHmac('sha256', SECRET)
        .update(Buffer.concat([Buffer.from(`${timestamp}.`, 'utf8'), rawBody]))
        .digest('hex');
      const a = Buffer.from(expected, 'utf8');
      const b = Buffer.from(signature, 'utf8');
      return a.length === b.length && crypto.timingSafeEqual(a, b);
    }
    
    async function handleLead(lead) {
      if (lead.signal && lead.signal.is_test) return console.log('test payload received');
      // Your logic: CRM, message queue, database...
      console.log(lead.signal.type, lead.company && lead.company.name);
    }
    
    // Processes the stored deliveries that are not yet processed. Also run it when the server starts:
    // a crash between storing and processing then loses no lead.
    async function processPending() {
      for (const [id, d] of deliveries) {
        if (d.done) continue;
        await handleLead(JSON.parse(d.body));
        d.done = true; // in production: UPDATE the row
      }
    }
    processPending().catch(console.error);
    
    const app = express();
    app.post('/webhooks/rodz', express.raw({ type: 'application/json', limit: '1mb' }), (req, res) => {
      const signature = req.get('X-Webhook-Signature');
      const timestamp = req.get('X-Webhook-Timestamp');
      if (!isValid(req.body, signature, timestamp)) return res.status(401).send('invalid signature');
      if (Math.abs(Date.now() / 1000 - Number(timestamp)) > TOLERANCE_SECONDS) {
        return res.status(401).send('stale timestamp');
      }
    
      // Store first, durably; answer 200 only after. A 200 closes the delivery on Rodz’s side:
      // answering before the write would lose the lead on a crash.
      const deliveryId = req.get('X-Webhook-Id');
      const isNew = saveDelivery(deliveryId, req.body);
      res.status(200).send(isNew ? 'ok' : 'duplicate');
      if (isNew) setImmediate(() => processPending().catch(console.error)); // then process
    });
    
    app.listen(process.env.PORT || 3000);
  3. Step 3. Or write it in Python

    Same logic with FastAPI: await request.body() gives the raw bytes, hmac.compare_digest compares in constant time, the delivery is stored before the response, and a background task processes it afterwards.

    python/app.py (uvicorn app:app)

    # Rodz webhook receiver (Python 3.10+, FastAPI).
    import hashlib
    import hmac
    import json
    import os
    import time
    
    from fastapi import BackgroundTasks, FastAPI, Request, Response
    
    SECRET = os.environ["RODZ_WEBHOOK_SECRET"].encode("utf-8")
    TOLERANCE_SECONDS = 300
    deliveries: dict[str, dict] = {}  # in production: a table whose unique key is X-Webhook-Id
    
    app = FastAPI()
    
    
    def save_delivery(delivery_id: str, body: bytes) -> bool:
        """Writes the delivery AND deduplicates it in one operation (SQL: INSERT ... ON CONFLICT DO NOTHING)."""
        if delivery_id in deliveries:
            return False
        deliveries[delivery_id] = {"body": body, "done": False}
        return True
    
    
    def is_valid(body: bytes, signature: str, timestamp: str) -> bool:
        if not signature or not timestamp:
            return False
        message = f"{timestamp}.".encode("utf-8") + body
        expected = hmac.new(SECRET, message, hashlib.sha256).hexdigest()
        return hmac.compare_digest(expected, signature)
    
    
    def handle_lead(lead: dict) -> None:
        if lead.get("signal", {}).get("is_test"):
            print("test payload received")
            return
        company = lead.get("company") or {}
        print(lead["signal"]["type"], company.get("name"))
    
    
    def process_pending() -> None:
        """Processes stored deliveries that are not yet processed; also run it when the server starts."""
        for delivery in list(deliveries.values()):
            if not delivery["done"]:
                handle_lead(json.loads(delivery["body"]))
                delivery["done"] = True  # in production: UPDATE the row
    
    
    @app.post("/webhooks/rodz")
    async def rodz_webhook(request: Request, tasks: BackgroundTasks) -> Response:
        body = await request.body()
        signature = request.headers.get("X-Webhook-Signature", "")
        timestamp = request.headers.get("X-Webhook-Timestamp", "")
        if not is_valid(body, signature, timestamp):
            return Response("invalid signature", status_code=401)
        if abs(time.time() - int(timestamp)) > TOLERANCE_SECONDS:
            return Response("stale timestamp", status_code=401)
    
        # Store first, durably; answer 200 only after (a 200 closes the delivery).
        delivery_id = request.headers.get("X-Webhook-Id", "")
        if not save_delivery(delivery_id, body):
            return Response("duplicate", status_code=200)
        tasks.add_task(process_pending)
        return Response("ok", status_code=200)
  4. Step 4. Connect the signal and send a test

    Save your URL as the signal’s webhookUrl (at creation, or with PATCH /api/v1/signals/{signal_id}). Then call POST /api/v1/signals/{signal_id}/test-webhook: with a {"url": "..."} body you test another address before saving it. The response gives success, your server’s statusCode, the payloadSent (with signal.is_test set to true) and signed: false means no API key is linked to the signal. This route is reserved for partner accounts: other accounts get 403 (PARTNER_ACCESS_REQUIRED).

    Test the receiver

    curl -X POST "https://api.rodz.io/api/v1/signals/$SIGNAL_ID/test-webhook" \
      -H "Authorization: Bearer $RODZ_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"url": "https://hooks.example.com/webhooks/rodz"}'
  5. Step 5. Recover from an outage with replay-webhook

    Automatic suspension. If your URL refuses deliveries with a 4xx other than 429 (at least 10 refusals since the last successful delivery, the first more than 24 hours old, with no other answer in between, for example because the URL is not the receiver’s), Rodz stops sending to that URL. The leads stay in the account and the other destinations still receive them. A 5xx or a 429 does not trigger the suspension. The signal’s Integrations tab then shows “Deliveries to this webhook are stopped”: save a corrected URL, or click Resume deliveries, and Rodz sends again the leads the URL did not receive in the last 7 days (2,000 leads at most). Beyond that window or limit, use replay-webhook.

    If your server was down for longer than the retries, POST /api/v1/signals/{signal_id}/replay-webhook resends every delivered lead of the signal (disqualified leads are not resent), with signal.is_replay set to true. The response gives total, sent, failed and skippedDisqualified. A replay resends the leads with their original X-Webhook-Id: your deduplication stops the same lead from being created twice as long as you kept that id. Keep it at least 14 days (the retry window) and, if you may run a replay later, for as long as the lead exists on your side. For a simple catch-up without a webhook, GET /api/v1/signals/{signal_id}/leads?since=... reads the leads directly.

    Resend the signal’s leads

    curl -X POST "https://api.rodz.io/api/v1/signals/$SIGNAL_ID/replay-webhook" \
      -H "Authorization: Bearer $RODZ_API_KEY"

Example payload

Excerpt of a request as your server receives it: headers, then the JSON body. The `signal` fields vary with the signal type: the exact list for each type is in the Callbacks section of the creation route’s page (for example `POST /api/v1/signals/job-changes`); `contact` is `""` for a lead without a person; `signal.is_test` (boolean `true`) only appears on a test, and `signal.is_replay` (boolean `true`) only on a replay: on a normal delivery both keys are absent. They are not listed in the signal schemas of the reference (`WebhookFundraisingSignal` and the others): add them to your model as optional fields.

POST /webhooks/rodz HTTP/1.1
Content-Type: application/json
X-Webhook-Id: 7f3c2a9e-1b4d-4c8e-9a01-5d6e7f8a9b0c
X-Webhook-Timestamp: 1760256000
X-Webhook-Signature: 3b1f0c...e9a4 (64 hex characters)

{
  "signal": {
    "id": "d4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8",
    "name": "Series A+ in France",
    "type": "fundraising",
    "last_signal": "Fundraising",
    "last_signal_date": "2026-10-12",
    "heat_score": 62,
    "is_test": true,
    "funding_stage": "Series A",
    "funding_amount_usd": 5500000,
    "announcement_date": "2026-10-10"
  },
  "contact": "",
  "company": {
    "name": "Northwind Robotics",
    "website": "https://northwind-robotics.example",
    "linkedin_url": "https://www.linkedin.com/company/northwind-robotics-example",
    "hq_country_code": "FR",
    "hq_city": "Nantes"
  }
}

The headers of a delivery

HeaderContentUse
X-Webhook-SignatureHex HMAC-SHA256Authenticate the request
X-Webhook-TimestampUnix timestamp (seconds) used in the signatureRefuse stale messages
X-Webhook-IdStable delivery id, the same on every retryDeduplicate

Response codes and their effect

Your responseEffect on the Rodz side
2xxDelivery succeeded
429Rodz slows down and retries a little later
Timeout or 5xxRetries for 14 days (schedule above)
402 + messageOut of credits: slow retries (see below)
Any other 4xxPermanent failure, no retry

A 402, or a 400 or 429, whose body says your credits or quota ran out (for example notEnoughCredits or quota exceeded) is not permanent: the URL is right, so Rodz retries slowly. The first new attempt goes out 30 minutes later, then the delays double up to a cap of 6 hours. Rodz gives a lead up 14 days after it was created. A 402 without that message in the body stays a permanent failure. After a long outage, POST /api/v1/signals/{signal_id}/replay-webhook resends the delivered leads.

Answer within a second or two and move the heavy work (CRM call, enrichment) to a queue or a background task.

Good practice

  1. Always verify the signature, even behind a firewall: a webhook URL ends up being shared.
  2. Store processed X-Webhook-Id values with an expiry of at least 14 days, the longest retry window (Redis SET NX EX), rather than in memory: an identifier forgotten sooner would let a duplicate through.
  3. Log signal.id and contact.lead_id: they are the ids support will ask for.
  4. Ignore signal.is_test in production, and treat signal.is_replay as a normal, deduplicated delivery. Test for the key (signal.get("is_test")), not for a false value: it is never sent.

To send these leads to a tool without writing a server, see the n8n and Make to Salesforce recipes.

Frequently asked questions

What happens if my server returns an error?

A 2xx marks the delivery as successful. A timeout, a connection error or a 5xx is retried: several times within about two hours, then at 30 min, 1 h, 2 h, 4 h, then every 6 hours, for up to 14 days after the lead was created. A 4xx (bad URL, auth, validation) is permanent and not retried, except 429 (slow down, retry) and a receiver whose body says its credits or quota ran out: those leads are retried slowly and sent once it accepts again.

Why can the same lead arrive twice?

Because retries guarantee at-least-once delivery: if your response is lost, Rodz sends again. The X-Webhook-Id header is the same on every attempt of one delivery; deduplicate on it.

Where do I find the webhook secret?

In Integrations → API in the dashboard: each API key has its secret, shown once: when you create the key or when you regenerate the secret (it cannot be read again afterwards). Regenerating invalidates the old secret immediately, so prepare the update of your receiver’s environment variable before you regenerate, then update it right away.

Why does verification fail when the secret is right?

Almost always because the signature is recomputed over JSON that was parsed and re-serialized instead of the raw bytes. Read the body before any JSON parser (express.raw, await request.body()). Also check that the test returns signed: true.

Do I need a receiver to read leads?

No. GET /api/v1/signals/{signal_id}/leads returns a signal’s leads in the webhook format, with since, limit and offset. Reading leads is free: a lead is charged once, when it is produced.

Sources

Try it on your own market

Find the signals that fit your company and the tool that includes them.