Network operations staffed around the clock
Skyroute
EN · EnglishEN
Vertrieb kontaktierenRequest access
Entwickler / WEBHOOKS

Vertrauen Sie dem Ereignis, das Sie erhalten.

Skyroute signiert jeden ausgehenden Webhook mit dem an diesem Endpunkt angebrachten Geheimnis. Überprüfen Sie die Rohanfrage, bevor Sie ein Anrufereignis als vertrauenswürdig behandeln.

AUSSERHALB ENTWICKLUNG

Unterzeichnete Anfrage, klare Grenze.

Erstellen Sie einen Webhook in den Kontoeinstellungen und speichern Sie das Signaturgeheimnis, wenn es angezeigt wird. Das Geheimnis ist in Ruhe verschlüsselt, wird nie in der HTTP-Nutzlast platziert und kann für eine neue einmalige Enthüllung gedreht werden.

01 / LIEFERFORMAT

Die Bytes, die signiert sind.

Skyroute POSTs JSON auf die konfigurierte öffentliche HTTPS URL mit event and payload. X-Skyroute-Timestamp ist ein Unix-Zeitstempel in Sekunden. X-Skyroute-Signature hat die Form v1=<lowercase hex>Unterschrift ist HMAC-SHA256 von timestamp + "." + raw JSON body.

EREIGNISTER · BEISPIEL
{"event":"call.started","payload":{"id":42,"status":"ringing"}}
SIGNATIONSINSPUT
HMAC_SHA256(secret, timestamp + "." + raw_body)
02 / ÜBERPRÜFUNG VOR DER VERARBEITUNG

Halten Sie den rohen Körper intakt.

Read the request bytes before JSON parsing. Reject timestamps outside a short tolerance, compute the HMAC with your endpoint secret, and compare the supplied digest in constant time. The example uses a five-minute tolerance; store event IDs or an equivalent deduplication key if your receiver needs replay protection.

NODE.JS · ÜBERPRÜFUNGSBEISPIEL
import { createHmac, timingSafeEqual } from 'node:crypto';

function verifySkyroute(rawBody, timestamp, signature, secret) {
  if (!/^\d+$/.test(timestamp ?? '')) return false;
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
  const supplied = signature?.startsWith('v1=') ? signature.slice(3) : '';
  if (!/^[a-f0-9]{64}$/.test(supplied)) return false;
  const expected = createHmac('sha256', secret)
    .update(`${timestamp}.`)
    .update(rawBody)
    .digest();
  return timingSafeEqual(expected, Buffer.from(supplied, 'hex'));
}

// In Express, use express.raw({ type: 'application/json' })
// on this route, then pass req.body to verifySkyroute.
// Parse JSON only after verification succeeds.

Verwenden Sie die genauen erhaltenen Bytes. Das Parsen und Re-Serialisieren von JSON ändert die Signatureingabe.

03 / SEKRETE ROTATION

Speichern Sie es, wenn es erscheint.

The signing secret appears once after you create or rotate a webhook. Update your receiver immediately when you rotate; the old secret stops signing new deliveries. Existing webhooks whose secret was not saved can be rotated in Webhook Settings.

ERFORDERLICHE SCHEINWERFER
Content-Type: application/json
X-Skyroute-Timestamp: 1793490000
X-Skyroute-Signature: v1=<64 lowercase hex characters>
04/WÄHRENDES LIEFERVERHALTEN

Kennen Sie die Betriebsgrenze.

Most events make one outbound HTTPS attempt per matching active webhook, with a five-second timeout and redirects disabled; failed attempts are logged without automatic retry. Sandbox route_test.result events are an exception: they use a durable retry queue and may arrive more than once. Deduplicate those events using the stable X-Skyroute-Event-Id header or payload.delivery_id. The separate inbound endpoint POST /api/webhooks/events Gibt 503 zurück, bis ein anbieterspezifischer Signaturverifikator konfiguriert ist.