Skip to main content
What you will build

10 min | Beginner

  • An HTTPS webhook endpoint for partner notifications.
  • Signature checks on the raw request body before you parse JSON.
  • Handling for success and failure notifications.
  • Reject invalid signatures and acknowledge valid notifications.
Using an AI coding tool?Copy the prompt below to point your agent at the webhooks skill and Documentation MCP. For every task skill, refer to AI coding tools.

Fetch the webhooks skill and connect the documentation MCP.

Open in Cursor
In this tutorial, you build a server-side webhook receiver for Suki partner notifications. You verify each request with HMAC-SHA-256, parse the JSON body only after verification succeeds, and branch on SUCCESS or FAILURE. Examples are provided in Python and TypeScript coding languages. By the end of this tutorial, you’ll have a working POST /webhooks/notification handler that rejects invalid signatures with 4xx and acknowledges accepted notifications with 2xx.

Prerequisites

Before you begin, make sure you have:
  • Completed Partner onboarding.
  • Shared your HTTPS callback URL with Suki so it is stored on your partner record. You cannot register or change this URL through a self-service API. See Configuration.
  • Your partner secret key from Suki (server-side only).
  • A publicly reachable HTTPS endpoint (TLS 1.2 or higher).
  • An integration that creates and ends ambient or Form filling sessions so Suki can send completion or failure events. Refer to Build ambient session Streaming Client or Build Form filling Session Client tutorials for examples.
Store your partner secret key only on your backend. Never expose it in a client-side or public application.

Architecture

Project setup

  1. Create a script or server project in the language used by this tutorial (Python or TypeScript).
  2. Install the required dependencies:.
    • Python: pip install flask.
    • TypeScript: npm install express.
  3. Configure your credentials:.
    • Store your partner secret key on your backend only. Never expose it in browser code.
  4. Expose POST /webhooks/notification (or the path you registered with Suki) on a publicly reachable HTTPS URL.

How signature verification works in this tutorial

Important points to remember:
  • Verify against the raw body before JSON parse. Pretty-print, trim, or auto-parse middleware changes bytes and breaks HMAC.
  • Reject requests that are missing X-API-Key or have an empty digest with 4xx.
  • Return 2xx for accepted notifications after you verify the signature.
  • Confirm the HTTPS callback URL is registered with Suki on your partner record.

Tutorial steps

Work through each step in order. Read the explanation, review the code example, then continue to the next step. The full code example is available in the accordion below.
1

Accept the POST Callback

Expose an HTTPS POST route that matches the callback URL you shared with Suki. Keep the partner secret key on your backend only.Check: Your HTTPS POST route matches the callback URL registered with Suki.
2

Read the Raw Body and Headers

Read the raw request body before JSON parsing, plus the generated-at and X-API-Key headers. See Verify signatures.Check: You hold the raw body bytes plus generated-at and X-API-Key before any JSON parse.
3

Verify the HMAC Signature

Recompute HMAC-SHA-256 over generated-at + : + raw body, encode as hex, and compare to X-API-Key with a constant-time compare.Check: Invalid signatures return 401. Valid signatures pass a constant-time compare.If it fails: Verify against the raw request body before you parse JSON. Verifying a re-serialized body will not match.
4

Parse JSON and Branch on Status

Only after verification succeeds, parse JSON and branch on top-level status. Documented example payloads use SUCCESS and FAILURE. Acknowledge every verified delivery with 2xx. See Payload and response and Event types.Check: You parse JSON only after verification, and you branch on SUCCESS and FAILURE.
5

Return 2xx

Return 200 (or another 2xx) so Suki treats the notification as delivered. Invalid signatures should stay 401 (or 400).Check: Accepted notifications return 2xx. Invalid signatures stay 401 (or 400).If it fails: Return 2xx for accepted notifications after you verify the signature. If you do not, Suki keeps retrying the delivery.

Full code example

Python

Troubleshooting

Verify against the raw body before JSON parse. Pretty-print, trim, or auto-parse middleware changes bytes and breaks HMAC.
Reject with 4xx. Do not call a constant-time compare on an empty expected signature as a successful verify.
Return 2xx for accepted notifications after you verify the signature (see Event types).
Confirm the HTTPS URL is registered with Suki on your partner record (Configuration).

Summary

In this tutorial, you:
  • Built a POST /webhooks/notification handler.
  • Verified each request with HMAC-SHA-256 before parsing JSON.
  • Branched on SUCCESS or FAILURE and returned 2xx for accepted events.
Keep the partner secret server-side only.

Other tutorials

Continue with another end-to-end tutorial.
Last modified on October 16, 2026