# Destinations

Destinations are where verified events go. Add several to one endpoint when different systems need the same event — each gets its own retry schedule and delivery history.

## Destination types

| Type                        | Status    | Description                                              |
| --------------------------- | --------- | -------------------------------------------------------- |
| HTTPS endpoint (`http`)     | Supported | JSON or form body, custom headers, bearer or basic auth. |
| Grok Bot (`grokbot`)        | Supported | Dispatch the event to a Grok Bot agent.                  |
| Slack (`slack`)             | Supported | Post to an incoming webhook or `chat.postMessage`.       |
| Feishu / Lark (`feishu`)    | Supported | Post text to a custom group bot, optionally signed.      |
| DingTalk (`dingtalk`)       | Supported | Post text to a custom robot, optionally signed.          |
| WeCom (`wecom`)             | Supported | Post text or markdown to a WeCom group bot.              |
| Telegram (`telegram`)       | Supported | Send a Bot API `sendMessage`, optional parse mode.       |
| Microsoft Teams (`teams`)   | Supported | Post a MessageCard to an incoming webhook.               |
| Discord (`discord`)         | Supported | Post content or embeds to an incoming webhook.           |
| Google Chat (`google-chat`) | Supported | Post text or cards v2 to an incoming webhook.            |
| LINE (`line`)               | Supported | Send a Messaging API push message.                       |
| Mattermost (`mattermost`)   | Supported | Post to a self-hosted incoming webhook.                  |
| Rocket.Chat (`rocketchat`)  | Supported | Post to a self-hosted incoming webhook.                  |
| WhatsApp (`whatsapp`)       | Supported | Send a Cloud API template or text message.               |
| T3 Code (`t3code`)          | Supported | Trigger a scheduled task (webhook automation).           |
| Paseo (`paseo`)             | Supported | Dispatch a Hub manual run (agent run id recorded).       |

## Add a destination

```bash
curl -X POST "https://api.hooks.events/v1/endpoints/ep_7a3k2/destinations" \
  -H "Authorization: Bearer $HOOKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://api.acme.com/hooks/orders",
    "method": "POST",
    "auth": { "type": "bearer", "token": "$DOWNSTREAM_TOKEN" }
  }'
```

## Feishu / Lark group bot

A `feishu` destination posts a text message to a custom group bot (自定义群机器人). The bot URL (`https://open.feishu.cn/open-apis/bot/v2/hook/<id>`, or `https://open.larksuite.com/...` for international) is a credential, so store it in a project secret and reference it from the config:

```json
{
  "webhookUrl": "{{secret.FEISHU_WEBHOOK_URL}}",
  "text": "New {{event.type}}: {{event.subject.title}}\n{{event.subject.url}}",
  "signature": { "secret": "{{secret.FEISHU_SIGN_SECRET}}" }
}
```

- `text` uses the same template engine as other targets, so event fields and filters work as usual.
- `signature` is optional; include it when the bot's signature check (加签) is enabled. Hooks sends `timestamp` and `sign = Base64(HMAC-SHA256(key = "<timestamp>\n<secret>", message = ""))` with the message.
- A failed call can still be HTTP 200 with a non-zero business `code`; hooks treats that as a failure and records the Feishu code and message.
- The webhook URL and signature secret are redacted from previews and delivery records.

## DingTalk group bot

A `dingtalk` destination posts a text message to a custom robot (自定义机器人). The bot URL (`https://oapi.dingtalk.com/robot/send?access_token=<token>`) carries the access token, so store the whole URL in a project secret and reference it from the config:

```json
{
  "webhookUrl": "{{secret.DINGTALK_WEBHOOK_URL}}",
  "text": "New {{event.type}}: {{event.subject.title}}\n{{event.subject.url}}",
  "signature": { "secret": "{{secret.DINGTALK_SIGN_SECRET}}" }
}
```

- `text` uses the same template engine as other targets, so event fields and filters work as usual.
- `signature` is optional; include it when the robot's signature check (加签) is enabled. Hooks appends a millisecond `timestamp` and `sign = URL-encode(Base64(HMAC-SHA256(key = <secret>, message = "<timestamp>\n<secret>")))` to the URL query.
- A failed call can still be HTTP 200 with a non-zero business `errcode`; hooks treats that as a failure and records the DingTalk code and message. Rate limiting (`130101`) is retried.
- The webhook URL, access token and signature secret are redacted from previews and delivery records.

## WeCom group bot

A `wecom` destination posts a text or markdown message to a WeCom (企业微信) group bot (群机器人). The bot URL (`https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=<key>`) carries the key, so store the whole URL in a project secret and reference it from the config:

```json
{
  "webhookUrl": "{{secret.WECOM_WEBHOOK_URL}}",
  "mode": "markdown",
  "markdown": "**{{event.subject.title}}**\n[Open]({{event.subject.url}})"
}
```

- `mode` is `text` (default) or `markdown`; `markdown` must be set when the mode is `markdown`.
- `text` and `markdown` use the same template engine as other targets, so event fields and filters work as usual.
- A failed call can still be HTTP 200 with a non-zero business `errcode`; hooks treats that as a failure, records the code and WeCom's `errmsg`, and retries the rate-limit codes `45009` / `45033`.
- The webhook URL and key are redacted from previews and delivery records.

## Telegram bot

A `telegram` destination calls the Telegram Bot API `sendMessage`. The bot token is a credential and lives in the request path (`https://api.telegram.org/bot<token>/sendMessage`), so store it in a project secret and reference it from the config:

```json
{
  "token": "{{secret.TELEGRAM_BOT_TOKEN}}",
  "chatId": "-1001234567890",
  "text": "New {{event.type}}: {{event.subject.title}}\n{{event.subject.url}}",
  "parseMode": "HTML"
}
```

- `chatId` is a template too, so one bot can route different events to different chats.
- `parseMode` is optional (`HTML` or `MarkdownV2`); the rendered text must already be escaped for it.
- A failed call can still be HTTP 200 with `ok: false`; hooks treats that as a failure and records Telegram's `error_code` and `description`. Rate limits (`429` + `retry_after`) are retried.
- The bot token is redacted from previews and delivery records.

## Microsoft Teams incoming webhook

A `teams` destination posts a MessageCard to a Teams incoming webhook (Office 365 Connector or Workflows). The webhook URL is a credential, so store the whole URL in a project secret and reference it from the config:

```json
{
  "webhookUrl": "{{secret.TEAMS_WEBHOOK_URL}}",
  "title": "New {{event.type}}: {{event.subject.title}}",
  "text": "{{event.subject.url}}",
  "themeColor": "0076D7"
}
```

- `title` and `text` use the same template engine as other targets; `themeColor` is optional six hex digits.
- Accepted hosts are `*.webhook.office.com`, `*.logic.azure.com` and `*.environment.api.powerplatform.com`; other hosts are rejected before sending.
- Non-2xx responses are failures, and a JSON error body's `message` is appended to the recorded reason.
- The webhook URL is redacted from previews and delivery records.

## Discord incoming webhook

A `discord` destination posts to a Discord Incoming Webhook (`https://discord.com/api/webhooks/<id>/<token>`). The URL carries the token, so store the whole URL in a project secret and reference it from the config:

```json
{
  "webhookUrl": "{{secret.DISCORD_WEBHOOK_URL}}",
  "content": "New {{event.type}}: {{event.subject.title}}",
  "embeds": "{\"title\":\"{{event.subject.title}}\",\"url\":\"{{event.subject.url}}\"}"
}
```

- `content` uses the same template engine as other targets; `embeds` is optional JSON (one object or an array of up to ten) rendered as a template.
- Success is `204` (or `200` with `?wait=true`); 429 with `retry_after` is retried, and other non-2xx responses record Discord's `message` as the reason.
- The webhook URL and token are redacted from previews and delivery records.

## Google Chat incoming webhook

A `google-chat` destination posts to a Google Chat Incoming Webhook (`https://chat.googleapis.com/v1/spaces/<space>/messages?key=…&token=…`). The URL carries the key and token, so store the whole URL in a project secret and reference it from the config:

```json
{
  "webhookUrl": "{{secret.GOOGLE_CHAT_WEBHOOK_URL}}",
  "text": "New {{event.type}}: {{event.subject.title}}\n{{event.subject.url}}",
  "cardsV2": "[{\"cardId\":\"issue\",\"card\":{\"header\":{\"title\":\"{{event.subject.title}}\"}}}]"
}
```

- `text` uses the same template engine as other targets; `cardsV2` is optional JSON (one `{cardId, card}` object or an array of up to ten) rendered as a template.
- Success is `200`; 429 with `Retry-After` is retried, and other non-2xx responses record Google's `error.message` as the reason. A 2xx body that still carries an `error` object is treated as a failure.
- The webhook URL and its key/token are redacted from previews and delivery records.

## LINE Messaging API

A `line` destination sends a **Push Message** through the LINE Messaging API. The channel access token is a credential, so store it in a project secret and reference it from the config:

```json
{
  "channelAccessToken": "{{secret.LINE_CHANNEL_ACCESS_TOKEN}}",
  "to": "U1234567890abcdef",
  "text": "New {{event.type}}: {{event.subject.title}}\n{{event.subject.url}}"
}
```

- `to` is the recipient id (`U…` user, `C…` group, `R…` room) and is a template; `text` uses the same template engine as other targets.
- The request goes to `POST https://api.line.me/v2/bot/message/push` with `Authorization: Bearer <token>`, never with the token in the URL. Only text messages are supported for now.
- Success is `200`; `429` is retried (`LINE_RATE_LIMITED`), and other non-2xx responses record LINE's `message` as the reason.
- The channel access token is redacted from previews and delivery records.

## Mattermost incoming webhook

A `mattermost` destination posts to a self-hosted Mattermost incoming webhook. The webhook URL embeds the key, so store the whole URL in a project secret and reference it from the config:

```json
{
  "webhookUrl": "{{secret.MATTERMOST_WEBHOOK_URL}}",
  "username": "hooks-bot",
  "channel": "alerts",
  "text": "New {{event.type}}: {{event.subject.title}}\n{{event.subject.url}}"
}
```

- `webhookUrl` must be a `{{secret.NAME}}` reference; a literal URL is rejected at save time.
- `text` is Mattermost Markdown rendered with the template engine and defaults to the event title and URL.
- `username` and `channel` are optional server-side overrides; the Mattermost server must allow username overrides.
- Success is `200` with a plain-text `ok`. Non-2xx responses fail (or retry on `408`/`425`/`429`/`5xx`) and record Mattermost's plain-text or JSON reason.
- The webhook URL is redacted from previews and delivery records; attempts only keep the stored destination host.

## Rocket.Chat incoming webhook

A `rocketchat` destination posts to a self-hosted Rocket.Chat incoming webhook. The webhook URL embeds the integration id and token, so store the whole URL in a project secret and reference it from the config:

```json
{
  "webhookUrl": "{{secret.ROCKETCHAT_WEBHOOK_URL}}",
  "channel": "#alerts",
  "alias": "hooks-bot",
  "text": "New {{event.type}}: {{event.subject.title}}\n{{event.subject.url}}"
}
```

- `webhookUrl` must be a `{{secret.NAME}}` reference; a literal URL is rejected at save time.
- `text` is Markdown rendered with the template engine and defaults to the event title and URL.
- `channel` overrides the room (room id, `#channel-name` or `@username`); `alias` overrides the display alias.
- Success is `200` with `{"success":true}`. A 2xx body with `success:false` or a per-room `responses` error fails (`ROCKETCHAT_ERROR` / `ROCKETCHAT_ROOM_ERROR`); non-2xx responses fail or retry on `408`/`425`/`429`/`5xx` and record Rocket.Chat's reason.
- The webhook URL is redacted from previews and delivery records; attempts only keep the stored destination host.

## WhatsApp Cloud API

A `whatsapp` destination sends a message through the WhatsApp Cloud API, which is served by Meta's Graph API. The access token is a credential, so store it in a project secret and reference it from the config:

```json
{
  "accessToken": "{{secret.WHATSAPP_ACCESS_TOKEN}}",
  "phoneNumberId": "109876543210987",
  "to": "+15551234567",
  "templateName": "order_update",
  "languageCode": "en_US",
  "templateParameters": ["{{event.subject.title}}", "{{event.subject.url}}"]
}
```

- `mode` defaults to `template`; set it to `text` to send `{"type":"text","text":{"body":"…"}}` instead. Production notifications normally need an approved template (free-form text only works inside an open 24-hour window).
- `phoneNumberId` is the numeric Cloud API sender id; `version` defaults to `v23.0`.
- `to` is the recipient number in E.164 form and is a template; it must render to digits, otherwise the delivery fails with `INVALID_WHATSAPP_RECIPIENT`. `templateParameters` and `text` use the same template engine as other targets.
- The request goes to `POST https://graph.facebook.com/<version>/<phone-number-id>/messages` with `Authorization: Bearer <token>`, never with the token in the URL.
- Success is `200`; `429` and Graph error codes `131048`/`131056` are retried (`WHATSAPP_RATE_LIMITED`), transient Graph errors are retried (`WHATSAPP_TRANSIENT_ERROR`), and other non-2xx responses record Meta's `error.message` as the reason. A 2xx body that still carries an `error` object is a failure.
- The access token is redacted from previews and delivery records.

## Filters

A destination can accept only some events:

```json
{
  "allow": [
    { "field": "event.type", "op": "equals", "value": "issues.opened" },
    { "field": "event.subject.labels", "op": "contains", "value": "agent" }
  ]
}
```

Rules support `equals`, `not_equals`, `in`, `contains`, `matches`, and `exists` on fields such as `event.type`, `event.source`, `event.actor.login`, `event.repo`, `event.project`, and `event.subject.*`. Bot actors are ignored by default; set `ignoreBots: false` to include them.

> Inbound secrets and cookies are never forwarded. Configure a separate outbound credential for each destination.
