# Set up webhooks

Register an HTTPS receiver, verify signed events, watch record changes and inspect notification attempts.

Webhooks notify your backend when a Sage command completes or a watched resource changes. They are separate from the OAuth callback that returns a customer to your app after pairing.

## Add an endpoint

1. Open **Connections → View → Webhooks** for the company.

1. Select **Add endpoint** in the Endpoints card.

1. Enter your receiver's public HTTPS **Endpoint URL**. Localhost and private network destinations are not supported.

1. Select **Copy secret** and store the signing secret securely on your receiving server before registering. It will not be shown again.

1. To receive record changes as well as command completions, enable **Watch Sage records**, choose the resources and a check interval.

1. Select **Register endpoint**.

![Add webhook endpoint dialog with an example HTTPS URL, masked signing secret and Watch Sage records option](/_emdash/api/media/file/01M623K4PT90AD1CJ9VJ1DKCKV.01M623K52PP8A9TSZHKBREDD7V.jpg)

Command completion events are included by default. Record watching needs permission to list those resources. Supported polling intervals are every minute, every five minutes and every 15 minutes. Each connection supports up to ten webhook endpoints.

![Webhooks tab with an Endpoints card and Add endpoint action](/_emdash/api/media/file/01M623JZQ0YRACMEREP5TDP26N.01M623K01TRGJAF358CJW6G0V4.jpg)

## Verify notifications on your server

1. Keep the raw request body before parsing JSON.

1. Read `webhook-timestamp` and compute HMAC-SHA256 with the signing secret over `timestamp + "." + rawBody`.

1. Compare the hexadecimal digest with the `v1=` value in `webhook-signature` using a constant-time comparison. Reject stale timestamps according to your receiver's replay policy.

1. Deduplicate using `webhook-id`. Persist the event durably before responding with a successful 2xx status.

1. Process the saved event asynchronously. Delivery has a five-second timeout and does not follow redirects.

Use the [OpenAPI event schemas](https://sage-connector-public-api.nameless-union-7a77.workers.dev/openapi.json) for each payload. A command completion can report failure; inspect the result. Notification delivery success means your receiver accepted the event, not that a Sage write succeeded.

## Inspect webhook activity

Open **Webhook activity** to see creation time, destination, status and attempts. Failed delivery can mean a signature mismatch in your receiver, an unreachable endpoint, a redirect, a timeout or a non-2xx response.

![Webhook activity showing example delivered and failed notifications with attempt counts](/_emdash/api/media/file/01M623K7F5YWJ2X3VV30JSVE1N.01M623K7R1ZV6NQPZFXMC922BR.jpg)

Automatic retries back off and stop after 12 attempts. The portal does not have a manual Retry action. Fix the receiving endpoint and reconcile any missed data through the API when automatic retries are exhausted.

## Understand record changes

Record notifications use polling. The next interval starts after a scan completes, so scan time, queue wait and retries add delay. Rapid edits can be coalesced, and a record created and deleted between scans can be missed. Handle event sequence and reset information in the schema, and use periodic reconciliation when you need a complete copy.

## Remove an endpoint

On **Webhooks**, select **Remove**, type `remove` in the modal and confirm. Future deliveries stop and pending deliveries for that endpoint are cancelled. The Sage connection itself stays linked.
