Skip to content

Help

Webhooks

What AMD Cop posts to your own system for each alert, a sample body, and code that checks the signature.

AMD Cop can post its alerts to your own system: a CRM, a chat channel, your own monitoring. This page shows what it sends, how to tell the request is really from AMD Cop, and what happens when your server does not answer. You add endpoints in Notifications, under Endpoints.

What is sent

When an alert fires and an endpoint takes it, AMD Cop sends one POST to the endpoint's address with a JSON body and Content-Type: application/json. Test, beside each endpoint, sends one straight away with event set to webhook.test, and lists it in Recent deliveries with your server's answer.

  • Answer with any 2xx status within 10 seconds. The body of your answer is not read.
  • A failed delivery is tried again with a widening gap, up to six attempts over about half an hour. No answer, a 408, a 429 or a 5xx is tried again; any other 4xx is not, because the same body would get the same answer.
  • A repeat carries the same body and the same id, so drop any id you have already handled.
  • The address has to be reachable from the internet over https (or http). Addresses inside a private network are refused when you add them, and before every send.

A sample body

An alert that a dialer stopped sending calls, laid out for reading. It arrives on one line, with its keys in alphabetical order.

{
  "context": {
    "dialers": [
      {
        "address": "203.0.113.10",
        "calls_before": 412,
        "label": "Main floor",
        "last_call_at": "2026-11-04T11:04:12+00:00",
        "last_heartbeat_at": "2026-11-04T12:03:40+00:00",
        "reporting": true
      }
    ],
    "timezone": "Europe/London"
  },
  "event": "dialer.no_calls",
  "id": "8b1f6a4e-2c1d-4f7e-9a51-0c3e5d7b9f20",
  "org_id": "4d2c9e71-5b3a-4f08-8e6d-2a9b7c1f0e35",
  "route": "/ips",
  "subscription_id": null,
  "template_key": "dialer_no_calls"
}
Field What it is
id This delivery. A repeat of it carries the same id.
event Which alert it is, from the list below.
context The facts the alert states, which differ by alert. Times are UTC, with the zone your account uses in timezone.
route The portal page the alert is about.
org_id Your account.
subscription_id Your plan, on billing alerts; otherwise null.
template_key Which wording the alert uses in email and in the portal.

The alerts

Each endpoint takes every alert, those added later included, or only the ones you tick. Change it with Change, in the endpoint's Alerts column. Who is told by email and in the portal is set separately, on the Alerts tab.

event Sent when
dialer.silent A dialer's connector has not reported for 6 hours
dialer.no_calls A dialer sent calls, then none for an hour, at an hour it usually dials
install.failed An install stopped before it finished
verdicts.unusual Far fewer people were put through, or far more machines, than in the same hours on your last 7 days
decisions.slow Calls took half as long again as usual to decide, and a second or more
allowance.near_cap The Sandbox has used 80% of the month's free calls
credits.exhausted The Sandbox's free calls are all used, and AMD Cop has stopped deciding calls until the month renews
payment.upcoming A renewal is about to be charged to your saved PayPal account
payment.failed A payment could not be taken
webhook.test You pressed Test

An alert is sent once for each time it happens: a dialer that stays silent all afternoon is one alert, not one every quarter of an hour.

Checking the signature

Give an endpoint a signing secret, and every request to it carries an X-AMD-Signature header: the HMAC-SHA256 of the request body, keyed with your secret, written as lowercase hex. Without a secret there is no header.

Work it out over the body exactly as it arrived, before you parse it: parsed and written out again, the same JSON can come out with different bytes, and the signature will not match. Compare the two in constant time, as the code below does.

Python:

import hashlib
import hmac


def is_from_amd_cop(raw_body: bytes, signature: str, secret: str) -> bool:
    expected = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature)

Node.js:

const crypto = require("node:crypto");

function isFromAmdCop(rawBody, signature, secret) {
  const expected = crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
  const a = Buffer.from(expected);
  const b = Buffer.from(String(signature || ""));
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}

PHP:

<?php
$raw = file_get_contents('php://input');
$expected = hash_hmac('sha256', $raw, getenv('AMDCOP_WEBHOOK_SECRET'));
if (!hash_equals($expected, $_SERVER['HTTP_X_AMD_SIGNATURE'] ?? '')) {
    http_response_code(401);
    exit;
}
$alert = json_decode($raw, true);

To change a secret, set a new one on the endpoint; nothing ever shows the old one again.

If deliveries fail

  • Recent deliveries lists every send with your server's answer, such as 405 Method Not Allowed: the address must accept a POST.
  • could not connect or no answer within 10 seconds: check the address is reachable from the internet, and that a firewall in front of it lets AMD Cop's requests through.
  • TLS certificate not trusted: the server's certificate has to be one a browser would accept.

Anything else, write to us from Support with the time of the delivery.