Skip to Content
CallHumanDocs

Webhooks

Receive the result of every call at your server, signed with HMAC-SHA256, and verify it in a few lines.

When a call ends we send a POST with the result to the webhook_url of the call:

{
  "id": "call_x9f2k",
  "status": "answered",
  "option_path": [1],
  "option_label": "Confirm",
  "metadata": { "booking_id": "bk_1042" }
}

The body is exactly what GET /v1/calls/{id} returns.

Fields

FieldTypeDescription
idstringCall ID returned when you created the call.
statusstringanswered, not_answered or failed (see below).
option_pathinteger[]Keys leading to the chosen option. [2] = option 2 of the main menu; [3, 1] = option 1 of the submenu under option 3. Empty if nothing was chosen.
option_labelstring | nulllabel of the chosen option, or null.
metadataobjectThe metadata you sent, unchanged. Use it to find your own record.

Statuses

statusMeaningCounts towards your plan
queuedWaiting, or between retries—
in_progressRinging or on the call—
answeredThe person picked up (with or without choosing an option)Yes
not_answeredNo answer, busy or voicemail, after all retriesNo
failedInvalid number or technical errorNo

The webhook is sent once the call reaches a final status: answered, not_answered or failed.

Verify the signature

Every webhook is a POST with Content-Type: application/json and a CallHuman-Signature header: the HMAC-SHA256 of the raw request body, as lowercase hex with no prefix, using your project's webhook secret (dashboard → Settings). Compute it over the raw bytes you received — before parsing the JSON — and compare in constant time.

import crypto from "node:crypto";
import express from "express";

const app = express();
const secret = process.env.CALLHUMAN_WEBHOOK_SECRET;

// Use the raw body: the signature is computed over the exact bytes we sent.
app.post("/hooks/callhuman", express.raw({ type: "application/json" }), (req, res) => {
  const expected = crypto.createHmac("sha256", secret).update(req.body).digest("hex");
  const received = req.get("CallHuman-Signature") ?? "";

  const valid =
    received.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(received), Buffer.from(expected));
  if (!valid) return res.sendStatus(401);

  const call = JSON.parse(req.body.toString("utf8"));
  if (call.status === "answered" && call.option_label === "Confirm") {
    // markBookingConfirmed(call.metadata.booking_id);
  }
  res.sendStatus(200);
});

app.listen(3000);

Retries

Respond with any 2xx status within 10 seconds (do slow work after responding). If your server returns an error or times out, we retry up to 5 times: after 1, 5, 15, 30 and 60 minutes. The same result can therefore arrive more than once: make your handler idempotent and ignore duplicates by id.

No webhook?

webhook_url is optional. You can poll GET /v1/calls/{id} instead — useful for scripts and tests:

curl https://api.callhuman.es/v1/calls/call_x9f2k \
  -H "Authorization: Bearer $CALLHUMAN_API_KEY"

On this page