# Webhooks: get a ping instead of asking

- Section: Webhooks (TTF API reference)
- Source: https://ttf.bot/developers/docs/#webhooks
- The whole reference as one text: https://ttf.bot/developers/docs/llms-full.txt

Tell TTF what to watch. When it happens, TTF sends a POST request to your server within seconds.

> A webhook is for people who run their own server or bot. Want the alert as a message in Telegram or Discord? That needs no server: see [Alerts in Telegram](https://ttf.bot/developers/docs/md/telegram-alerts.md) and [Alerts in Discord](https://ttf.bot/developers/docs/md/discord-alerts.md). The alerts are the same; only where they go differs.

## Set one up in 3 steps

1. **Add an endpoint**

   In the [dashboard](https://ttf.bot/developers/app/), tab **Destinations**, open **Add an https:// address** and type the address of your server (for example `https://yourbot.example/ttf-hook`). Only https on port 443 or 8443, and only public addresses. You get a **signing secret** (`whsec_...`) once: copy it.

2. **Add a rule**

   Tab **Alerts** (or **Wallets**): pick what to watch (table below) and send it to that endpoint. One endpoint can have many rules.

3. **Test it**

   Press **Send test alert**: a `ping` arrives at your server. Answer with any 2xx status, fast. Then [check the signature](https://ttf.bot/developers/docs/md/webhook-signatures.md) before you trust a body.

## What you can watch

| Rule type | Fires when | Settings | Plan group |
| --- | --- | --- | --- |
| `price_cross` | The price crosses your line (up through `above` or down through `below`). Once per crossing; re-armed after it moves 0.5 % back. | chain, token, above or below, fire_if_already_past | core |
| `pct_move` | The price moves by your percent within a window (negative = a drop). | chain, token, window (15m, 1h, 4h, 24h), percent | core |
| `trending_enter` | A token enters the trending board with at least your number of scans, and passes your filters (liquidity, market cap, age, words in the name, tax, holders and more: see [Trending alerts and filters](https://ttf.bot/developers/docs/md/alerts-trending.md)). | chain, `chains` or `all`, min_scans, optional filters, per_chain, repeat, max_per_hour, unknown | trending |
| `wallet_activity` | A wallet sends (or receives) a token transfer, optionally above a dollar value. With chain `evm` (All EVMs) one rule watches the wallet on every EVM chain TTF watches, chains added later included; each delivery names the chain it happened on. | chain (or `evm`), address or addresses, direction (out, in, any), min_usd | wallet |
| `signal` | A TTF signal of that kind appears (all-time-high breakout, call milestone). | kind | signals |

A rule only fires if your plan includes its group; on Free only the price rules can be made. How many endpoints, rules and deliveries per month you get depends on the plan (see [Credits & limits](https://ttf.bot/developers/docs/md/credits.md)).

Prefer code? Everything above can also be done with an API key: [manage webhooks from code](https://ttf.bot/developers/docs/md/webhook-api.md).

## What arrives

An HTTPS `POST` with a JSON body and these headers:

| Header | Value |
| --- | --- |
| `X-TTF-Event` | `price`, `trending`, `wallet`, `signal` or `ping` |
| `X-TTF-Event-Id` | Id of the event (one event can fire several of your rules). |
| `X-TTF-Delivery` | Id of this delivery, the same on every retry: use it to drop duplicates. |
| `X-TTF-Attempt` | 1, 2, 3 ... (counts retries). |
| `X-TTF-Timestamp` | Unix seconds when this attempt was signed. |
| `X-TTF-Signature` | `v1=<hex>` (two values for 24 h after you rotate the secret). |

Every delivery type with its body fields and real examples: [price](https://ttf.bot/developers/docs/md/webhook-price.md), [trending](https://ttf.bot/developers/docs/md/webhook-trending.md), [wallet](https://ttf.bot/developers/docs/md/webhook-wallet.md), [signal](https://ttf.bot/developers/docs/md/webhook-signal.md) and the [test ping](https://ttf.bot/developers/docs/md/webhook-ping.md).

> Deliveries come from changing addresses of our proxy provider: do not allow-list IPs, check the signature instead.
