Skip to main content
Prerequisites: A configured integration in the ClickTerm Dashboard, a public HTTPS endpoint in your backend, and a completed signature verification flow.
Use webhooks when you want ClickTerm to notify your backend automatically after a clickwrap event has been verified. This is useful for synchronizing consent data, triggering downstream workflows, or updating internal systems without polling.

When webhooks are sent

ClickTerm sends a webhook only after your backend successfully calls POST /public-client/v1/clickwrap/verify and the clickwrap event is finalized.
Webhooks complement the verification response. Use the direct API response for the immediate user flow, and use webhooks for asynchronous backend processing.

Flow overview

Setup

1

Configure your webhook URL

Open your integration in the ClickTerm Dashboard and set a public HTTPS webhook URL for your backend.
Integrations page showing the form to add a new ClickTerm app

Webhook configuration for your ClickTerm app

The URL must use HTTPS and resolve to a public IP address. Localhost, private networks (e.g. 10.x.x.x, 172.16.x.x, 192.168.x.x), and cloud metadata endpoints are rejected.
2

Store the signing secret

Save the webhook signing secret in your backend secret manager or environment configuration.
3

Expose a POST endpoint

Your endpoint must accept HTTP POST requests and preserve the raw request body for signature verification.
4

Verify before processing

Validate the timestamp and X-Clickterm-Signature header before parsing or acting on the payload.
5

Return 200 OK

Respond with 200 OK only after successful verification and processing. Any other response is treated as a failed delivery.

Request format

Webhook callbacks are sent as HTTP POST requests with Content-Type: application/json.

Headers

Example raw request

The X-Clickterm-Signature header always starts with the sha256= prefix followed by the hex-encoded HMAC digest. When verifying, you must either strip this prefix before comparing or prepend it to your computed digest. Comparing the raw header value directly against the hex digest alone will always fail.

Payload

templatePlaceholders and technicalMetadata are JSON-encoded strings, not objects. Parse them in your handler (e.g. JSON.parse(data.templatePlaceholders) in JavaScript, json.loads(data["templatePlaceholders"]) in Python).

Payload fields

Event types

Currently supported webhook event types:

CLICKWRAP_EVENT_VERIFIED payload

Delivery behavior

ClickTerm considers a delivery successful only when your endpoint returns 200 OK.
Only 200 OK is accepted as a success. Other 2xx status codes like 201 Created or 204 No Content are treated as failures and will trigger retries. Make sure your webhook handler returns exactly 200.
Webhook handlers should be idempotent. Retries can happen if your endpoint times out or returns a non-200 response.

Recovering missed webhooks

If all delivery attempts fail, the webhook is not retried further. Your event data is still stored in ClickTerm. To diagnose and recover:
For production integrations, combine webhooks with periodic status polling. Use webhooks for real-time event-driven workflows, and use the status endpoint as a fallback to catch any events that weren’t delivered successfully.

Verify webhook signatures

To verify a webhook:
1

Build the signing payload

Concatenate the X-Clickterm-Timestamp header, a literal dot (.), and the raw request body:
2

Compute the HMAC

Calculate the HMAC SHA-256 digest of the signing payload using your webhook signing secret as the key, then hex-encode the result.
3

Prepend the sha256= prefix

Prepend sha256= to your computed hex digest to form the expected signature:
4

Compare in constant time

Compare your expected signature against the X-Clickterm-Signature header value using a constant-time comparison function to prevent timing attacks.

Best practices

  • Use the raw request body for signature verification. Do not reserialize JSON before computing the HMAC.
  • Reject stale timestamps to reduce replay risk.
  • Store webhook secrets in a secret manager or environment variables, not in source control.
  • Make event processing idempotent by keying on clickwrapEventId.
  • Return 200 OK quickly, and offload slow downstream work to a queue if needed.

Verifying a signature

Verify the ClickTerm signature before the webhook is generated.

Checking consent status

Query consent state directly for specific end users.

List clickwrap events

Reference for the clickwrap events listing endpoint.