# Webhooks

A webhook Service receives an HTTP request from another system and runs your code for that event. Tokay gives it a stable endpoint and records each request so you can tell whether the sender connected, what payload arrived, and how the code responded.

The code can be a server that listens for requests or a handler function that accepts one request. Tokay detects the shape and runs it as a webhook Service.

## Give the sender the Service URL

Each webhook gets a URL such as `https://fn-x7k2m9q4.tokay.app`. Copy it from the Service page into Stripe, GitHub, a form provider, or the system sending events.

The random address is intentionally difficult to guess. Use **Regenerate URL** when the address is exposed or an integration should lose access. The old URL stops working immediately, so update every sender that should continue calling the Service.

## Verify the connection before relying on it

Before any request arrives, the Service page shows **Listening for first request...**. A successful first request changes the state to **Connection Established!** and identifies the detected sender when possible.

When the first request reaches the Service but the code fails, Tokay separates that from a sender that never connected and points to the failure evidence.

Use **Send Test Event** to test the deployed code before configuring the real sender.

## Request history preserves the event that matters

The Requests tab shows the source, HTTP method, response status, duration, and body preview for each incoming request. Expand a row to inspect the full payload.

**Copy as cURL** creates a command that replays the recorded request. After fixing the code, send the same payload again and confirm the handler now succeeds.

History is limited by request count rather than age, so a low volume integration keeps useful earlier events.

## Alerts find you when delivery starts failing

Tokay emails when a webhook that was succeeding begins to return errors and sends a recovery message when it succeeds again.

A red 5xx response usually means the handler crashed. The Logs tab contains the application output. An orange 4xx response means the code rejected the request, and the recorded payload shows what the sender supplied.

Webhook Services stay reachable even when the Project's web apps require sign in. For a private web app that needs one public route, use [Public endpoints](public-endpoints.md).
