# Webhooks

> Events with GitHub's payload shape, signed, retried, and logged.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://git.docs.sypnia.com/automation/webhooks/

For agents: Webhooks per repository or organization: events push, pull_request, pull_request_review, issues, issue_comment, create, delete, release, status, plus Sypnia's case_linked. Payloads follow GitHub's shape where an equivalent exists; headers X-Sypnia-Event, X-Sypnia-Delivery, X-Sypnia-Signature-256 (HMAC-SHA256 of the body with the secret; also X-Hub-Signature-256 for compatibility). Retries with backoff for 24 h on non-2xx; deliveries log with redeliver; 10 s timeout.

A webhook sends an HTTPS `POST` to your address when something happens.

| Event                                 | When                                                 |
| ------------------------------------- | ---------------------------------------------------- |
| `push`                                | commits pushed to a branch or tag                    |
| `pull_request`, `pull_request_review` | opened, updated, reviewed, merged, closed            |
| `issues`, `issue_comment`             | opened, edited, closed, commented                    |
| `create`, `delete`                    | a branch or tag created or deleted                   |
| `release`, `status`                   | a release published; a check reported                |
| `case_linked`                         | a commit, issue or pull request linked to a use case |

Payloads follow **GitHub's shape** wherever an equivalent exists, so most existing tools work unchanged.

## Checking the signature

Each delivery carries `X-Sypnia-Signature-256`: an HMAC-SHA256 of the body with your webhook's secret (also sent as `X-Hub-Signature-256`).

```ts
import { verifyWebhook } from '@sypnia/git/webhooks';
const event = verifyWebhook(rawBody, request.headers, process.env.WEBHOOK_SECRET!); // throws if the signature is wrong
```

## Delivery

Ten seconds to answer with a `2xx`; otherwise it is retried with backoff for 24 hours. Every delivery is logged with its response, and can be sent again.
