> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doglytdc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Receive a signed notification on your server when something happens in the script.

## Events

| Event | When |
| - | - |
| `repo.commit` | A commit was saved to the script's repository. |
| `functions.deploy` | The backend (functions and collections) was published. |
| `access.granted` | Someone was granted access to the script. |
| `ping` | Test sent using the button or the test route. |

The address must be public and use `https://`. Private IPs and `localhost` are rejected. The secret appears **only once**, when you create the webhook.

![Screenshot: DoglyTdc Webhook token](https://mintcdn.com/dogly-tdc/qOnot79kPtISSKbW/images/scripts/scripts-webhook.png?fit=max\&auto=format\&n=qOnot79kPtISSKbW\&q=85\&s=acebfedc2e7ca71b6bfe1720dcba2661)

DoglyTdc Webhook token

## What you receive

```http theme={null}
POST /seu-endereco
Content-Type: application/json
User-Agent: DoglyTdc-Scripts-Webhook/1
X-DoglyTdc-Event: repo.commit
X-DoglyTdc-Delivery: 1234
X-DoglyTdc-Timestamp: 1794015161
X-DoglyTdc-Signature: sha256=…

{ "id": "1234", "event": "repo.commit", "script_id": "…", "created_at": "…", "data": { … } }
```

## Verify the signature

The signature is `sha256=` + the hex digest of HMAC-SHA256(secret, `timestamp + "." + raw body`). Reject requests with timestamps older than 5 minutes.

```js Node.js theme={null}
import crypto from "node:crypto";

export function valido(req, corpoCru, segredo) {
  const ts = req.headers["x-doglytdc-timestamp"];
  if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;
  const esperado = "sha256=" + crypto.createHmac("sha256", segredo).update(`${ts}.${corpoCru}`).digest("hex");
  const recebido = req.headers["x-doglytdc-signature"] || "";
  return recebido.length === esperado.length && crypto.timingSafeEqual(Buffer.from(recebido), Buffer.from(esperado));
}
```

## Retries

* Up to 3 attempts per notification (immediately, after 1 s, and after 3 s).
* 4xx responses (except 429) are not retried.
* After 10 consecutive failures, the webhook is disabled. Enable it again through the dashboard or with `PATCH`.

Routes: [API › Webhooks](https://docs.doglytdc.dev/en/scripts/api-reference/webhooks.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.