HomeProducts— Affect— PersonaTechnologyDocs— Quick Start— Authentication— Client SDK— Webhooks— ErrorsSandboxSign In
EN · 中文
SDK

Webhooks — how reports reach your back end

When an analysis completes, Lynxin POSTs a signed callback to the URL you configured. Verify it, correlate it to your user with client_ref (your own ID, passed in ingestAndAnalyze(clientRef)), and store it.

01 Configure (console, once)

Set your callback URL (https://…), generate a signing secret (whsec_…), pick events — then Send test event to confirm connectivity and signature.

02 The callback.v1 envelope

Every delivery is a callback.v1 envelope. On analysis.completed, result carries two reports; on analysis.failed, error is filled in.

{
  "event": "analysis.completed",   // one of three events (below)
  "delivery_id": "evt_9f2a…",      // idempotency key
  "task_id": "t_…",
  "session_id": "sess_…",
  "client_ref": "user_20394",      // your user ID, echoed back
  "status": "success",
  "result": {                          // on analysis.completed
    "analysis_mode": "model1+model2",
    "model1": { /* the signal report */ },
    "model2": { /* the personality report */ }
  },
  "error": null,                   // on analysis.failed
  "source": "…",
  "schema": "callback.v1",
  "timestamp": 1751520000
}

03 The result report

On analysis.completed, result holds two reports: model1 is the signal report and model2 is the personality report. The personality report has several modules, each with confidence and usage-limit notes. Results are for reference, not automated decisions. Signal report (model1) fields are on the Lynxin Affect report fields page, and personality report (model2) fields are on the Lynxin Persona report fields page.

04 Verify the signature

The header X-Lynxin-Signature: sha256=HMAC(secret, timestamp + "." + body) — where secret is your whsec_. Also sent: X-Lynxin-Delivery (idempotency), X-Lynxin-Timestamp (reject deliveries older than ~5 min to prevent replay), and X-Lynxin-Event (route on the header without parsing the body). Verify with whsec_, not your sk_. Compute the HMAC over the raw request body bytes — not a re-serialized JSON string, which reorders bytes and breaks the signature.

05 Events

  • ingest.completed — the recording is stored (signals ready). It carries the session_id and a basic summary, not the full report; your backend reads the full Lynxin Affect report with its sk_.
  • analysis.completed — analysis is complete; result holds two reports: the signal report and the personality report.
  • analysis.failed — analysis could not complete; error explains.
{
  "delivery_id": "evt_0123456789abcdef0123",
  "event": "ingest.completed",
  "client_ref": "demo_order_001",
  "source": "layer1-signal",
  "schema": "callback.v1",
  "status": "success",
  "session_id": "sess_demo_001",
  "summary": {
    "signal_pack_count": 2,
    "external_count": 0,
    "radar_count": 0,
    "external_metrics": [],
    "has_radar": false,
    "face_visible_ratio": 0.9,
    "frames": 60
  },
  "timestamp": 1794794400
}

Keep the session_id returned by the upload. If no ingest.completed arrives, have your backend call GET /v1/rdp/{session_id} with your server key and check pro_extracted and audio_extracted to see how far processing has got; you can also list sessions with GET /v1/rdp?limit=&offset=.

06 Respond & tolerate

  • Return 2xx fast, do the heavy work async. If your handler is slow or times out, the platform treats the delivery as failed and burns retries — acknowledge first, process after.
  • Tolerate unknown event types. Return 2xx for events you don't handle, including the console's webhook.test. Don't reply 4xx on an unrecognized event, or the Send test event check (and any future event type) will fail.

07 Retries & fallback

Delivery is retried with exponential backoff up to 9 attempts (~20 hours). After that a delivery is marked exhausted — resend it from the console (Webhook deliveries log), or have your backend call POST /v1/webhook/deliveries/{delivery_id}/resend with your server key. Delivery is at-least-once and may arrive out of order, so retries and duplicates are expected — make your handler idempotent by deduping on delivery_id. If you may analyze the same user more than once, use a per-session client_ref (e.g. user_20394:sess_abc) so you can tell each run apart.

08 First call ≠ first report

ingestAndAnalyze returns immediately (the trigger). The report is a post-session computation and arrives ~5–15 minutes later. Design your UX for a wait, or rely on the webhook.

09 Next steps