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

# Webhook triggers

> Run a button or drawer when an external service sends an HTTP POST.

A webhook trigger turns a button or drawer into a receiver: an HTTP endpoint you can register with GitHub, Stripe, Linear, Apify, or any other service that sends webhooks.

This is the inverse of an [HTTP API button](/buttons/http-api). HTTP API buttons send requests; webhook triggers receive them.

```bash theme={null}
buttons drawer create github-pr-opened
buttons drawer github-pr-opened add handle-github-pr
buttons drawer github-pr-opened trigger webhook /github/pr-opened
buttons webhook listen
```

Webhook triggers currently attach to drawers. If you want to trigger one button, put it in a one-step drawer.

## Flags

```bash theme={null}
buttons drawer <name> trigger webhook [/path]
  --auth none
  --auth basic --auth-user <user> --auth-pass <password>
  --auth header --auth-header-name <name> --auth-header-value <value>
  --auth jwt --jwt-secret <secret> [--jwt-algorithm HS256|HS384|HS512]
             [--jwt-issuer <issuer>] [--jwt-audience <audience>]
```

Default path: `/<drawer-name>`.

Any secret-bearing value accepts `$ENV{VAR_NAME}` so committed `drawer.json` does not carry raw secrets.

## Auth example

```bash theme={null}
buttons drawer stripe-receipts trigger webhook /stripe \
  --auth header \
  --auth-header-name X-Stripe-Token \
  --auth-header-value '$ENV{STRIPE_WEBHOOK_TOKEN}'
```

## Local testing

Dry-run a webhook drawer without the listener:

```bash theme={null}
buttons drawer github-pr-opened press --webhook-body '{"action":"opened"}'
buttons drawer github-pr-opened press --webhook-body @fixture.json
```

## Planned unified surface

The unified `buttons trigger webhook ...` surface should compile down to the same drawer trigger model.

```bash theme={null}
buttons trigger webhook github-pr-opened /github/pr-opened
```

If the target is a button, Buttons should create a hidden one-step drawer wrapper internally. If the target is a drawer, the trigger attaches directly to the drawer.
