Webhooks
Get pipeline movements the moment they happen
Accountable sends a signed HTTPS request to your server whenever a record enters your Leads, Active, or Funded pipeline. You host one endpoint. We do the rest.
POST with a JSON body and a signature header.2xx, process at your pace.Quick start
- Stand up an HTTPS endpoint
It must accept
POSTrequests, be reachable from the public internet, and answer within 10 seconds. Plain HTTP, redirects, and private or local addresses are rejected. - Add the endpoint in Accountable
A company admin adds the URL under Integrations. Accountable shows a signing secret that starts with
whsec_. It appears once, so store it somewhere safe. - Verify every request
Recompute the signature from the raw request body and your secret. Reject anything that does not match.
- Return a 2xx
Acknowledge first, then do your work. Use the event ID to ignore repeats.
The event
There is one event type, PIPELINE_MOVEMENT. It fires when a record enters a pipeline tab, either because it was just created there or because it moved from another tab. Edits to a record that stays in the same tab do not send an event.
Your endpoint receives every movement for your company. To react to only some of them, filter on stage and previousStage. For example, stage === "funded" catches every funded loan, and previousStage === "lead" && stage === "active" catches a lead becoming an active loan.
| Field | Type | Meaning |
|---|---|---|
eventType | string | Always PIPELINE_MOVEMENT. |
eventId | string | Unique per event. Use it to ignore repeats. |
occurredAt | ISO 8601 | When the movement happened. Use it to order events. |
stage | string | The tab the record entered: lead, active, or funded. |
previousStage | string or null | The tab it came from. null when the record is brand new. |
record | object | The details shown on that pipeline tab row, in camelCase. |
The values below are sample data. We share the complete list of record fields before you go live.
Headers
Every request carries these headers, with Content-Type: application/json.
| Header | Value |
|---|---|
Accountable-Signature | Timestamp and signature, for example t=1763900000,v1=9b2f…. |
Accountable-Event-Id | Matches eventId in the body. The same event always keeps the same ID. |
Accountable-Event-Type | PIPELINE_MOVEMENT |
Accountable-Delivery-Id | Identifies this delivery, for support requests. |
Verify the signature
Anyone can send a request to a public URL. The signature proves the request came from Accountable and that nobody changed the body on the way.
signature = hex( HMAC_SHA256( secret, "<t>.<raw request body>" ) )
- Split the header
Read
t(a Unix timestamp) and everyv1value. - Check the timestamp
Reject requests more than 5 minutes old. This stops replays.
- Recompute and compare
Sign
t, a period, and the body exactly as received. Compare with a constant-time function. Accept if anyv1matches.
Use the raw bytes. If your framework parses the JSON and you serialize it again, whitespace and key order can change and the signature will not match. Read the body before parsing it.
Try it
Pick a movement. This page signs a sample request in your browser with a demo secret, then verifies it the way your server should. Edit the body to see what a tampered request looks like.
Demo secret: . Real secrets are shown once when you add an endpoint.
Reference implementations
import crypto from 'node:crypto';
import express from 'express';
const app = express();
const SECRET = process.env.ACCOUNTABLE_WEBHOOK_SECRET;
const seen = new Set(); // use Redis or a database table in production
// Raw body: do not use express.json() on this route.
app.post('/webhooks/accountable', express.raw({ type: 'application/json' }), (req, res) => {
const pairs = (req.get('Accountable-Signature') || '')
.split(',')
.map((part) => part.trim().split('='));
const t = pairs.find(([k]) => k === 't')?.[1];
const signatures = pairs.filter(([k]) => k === 'v1').map(([, v]) => v);
const fresh = Math.abs(Date.now() / 1000 - Number(t)) <= 300;
const expected = crypto
.createHmac('sha256', SECRET)
.update(`${t}.`)
.update(req.body)
.digest('hex');
const valid = signatures.some(
(s) => s.length === expected.length && crypto.timingSafeEqual(Buffer.from(s), Buffer.from(expected))
);
if (!t || !fresh || !valid) return res.sendStatus(401);
const event = JSON.parse(req.body.toString('utf8'));
res.sendStatus(200); // acknowledge first
if (seen.has(event.eventId)) return; // repeat delivery
seen.add(event.eventId);
if (event.stage === 'funded') {
// your logic here
}
});
app.listen(3000);
<?php
$secret = getenv('ACCOUNTABLE_WEBHOOK_SECRET');
$body = file_get_contents('php://input'); // raw bytes
$header = $_SERVER['HTTP_ACCOUNTABLE_SIGNATURE'] ?? '';
$timestamp = null;
$signatures = [];
foreach (explode(',', $header) as $part) {
[$key, $value] = array_pad(explode('=', trim($part), 2), 2, '');
if ($key === 't') { $timestamp = ctype_digit($value) ? (int) $value : null; }
if ($key === 'v1') { $signatures[] = $value; }
}
$fresh = $timestamp !== null && abs(time() - $timestamp) <= 300;
$expected = hash_hmac('sha256', $timestamp . '.' . $body, $secret);
$valid = false;
foreach ($signatures as $signature) {
if (hash_equals($expected, $signature)) { $valid = true; }
}
if (!$fresh || !$valid) {
http_response_code(401);
exit;
}
$event = json_decode($body, true);
http_response_code(200); // acknowledge first
// Skip $event['eventId'] values you have already stored.
if ($event['stage'] === 'funded') {
// your logic here
}
import hashlib, hmac, json, os, time
from flask import Flask, request
app = Flask(__name__)
SECRET = os.environ["ACCOUNTABLE_WEBHOOK_SECRET"].encode()
seen = set() # use Redis or a database table in production
@app.post("/webhooks/accountable")
def accountable():
body = request.get_data() # raw bytes
pairs = [p.strip().split("=", 1) for p in request.headers.get("Accountable-Signature", "").split(",")]
t = next((v for k, v in pairs if k == "t"), None)
signatures = [v for k, v in pairs if k == "v1"]
if not t or not t.isdigit() or abs(time.time() - int(t)) > 300:
return "", 401
expected = hmac.new(SECRET, t.encode() + b"." + body, hashlib.sha256).hexdigest()
if not any(hmac.compare_digest(expected, s) for s in signatures):
return "", 401
event = json.loads(body)
if event["eventId"] not in seen:
seen.add(event["eventId"])
if event["stage"] == "funded":
pass # your logic here
return "", 200
Respond and retry
The status code you return tells Accountable what to do next.
| Your response | Result |
|---|---|
2xx | Delivered We mark the event done. |
5xx, 429, or no answer within 10 seconds | Retried We try again automatically. |
Any other 4xx | Failed We do not retry. Fix the endpoint and the next event will go through. |
If an endpoint keeps failing, Accountable disables it and emails your company admins. You can turn it back on once it is healthy.
Best practices
Expect the same event twice
Delivery is at-least-once. A network hiccup can cause a repeat. Store the eventId of events you have handled and skip duplicates.
Acknowledge quickly, work later
Verify, return 2xx, and hand the event to a queue or background job. Slow handlers hit the 10 second limit and cause retries.
Do not rely on arrival order
Two events for the same record can arrive out of order after a retry. Compare occurredAt before overwriting newer data with older data.
Rotate secrets without downtime
After you rotate a secret, the old one stays valid for 24 hours. During that window each request carries two v1 values. Accept a match on either, then switch your server to the new secret.
Keep the secret out of code
Store it in an environment variable or a secrets manager. Rotate it if it is ever exposed.
Testing
Before go-live, confirm that your endpoint handles these cases.
| Case | Expected behavior |
|---|---|
| A new lead is created | One event with stage: "lead" and previousStage: null. |
| A lead becomes an active loan | One event with stage: "active" and previousStage: "lead". |
| A loan is funded | One event with stage: "funded". |
| A record is edited within its tab | No event. |
| Body or timestamp is altered | Your endpoint returns 401. |
| The same event arrives twice | Your system processes it once. |
Webhooks are enabled per company. Contact your Accountable representative to turn them on, and send us your endpoint URL to configure.