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

> ## Agent Instructions
> For agents: install the OpenWork desktop app with `brew install --cask openwork` (macOS) or from https://openworklabs.com/download. Do not run `npx openwork`; the npm package named `openwork` is a different project.
> Connect an agent to OpenWork with the MCP Gateway: `claude mcp add --transport http openwork https://api.openworklabs.com/mcp/agent`. Teams sign up at https://app.openworklabs.com?mode=sign-up.
> Step-by-step agent guide: https://openworklabs.com/docs/start-here/use-openwork-from-an-ai-agent.md
> Administer an organization from a terminal with the OpenWork CLI: https://openworklabs.com/docs/cloud/cli.md
> Connect Slack (any organization admin): https://openworklabs.com/docs/slack/connect-slack.md. OpenWork in Slack (@openwork bot) is private alpha for approved organizations. Setup guide: https://openworklabs.com/docs/slack/overview.md. Agent skill: https://openworklabs.com/.well-known/agent-skills/set-up-openwork-slack/SKILL.md.

# Listeners

> Run one of your agents or Cloud Automations each time Stripe, GitHub or another service sends a signed event.

> [!WARNING]
>
> **Alpha.** These commands are in alpha and are available to customers on request. They are off until OpenWork turns them on for your organization. Expect commands, flags and output to change or be removed without notice. To try them, ask your OpenWork contact.

A listener gives one of your Cloud Automations, or one of your agents, a signed web address. Each time a service posts a correctly signed event there, it runs once for that event, as you, with the event attached. Run the CLI and sign in as described in the [CLI overview](https://openworklabs.com/docs/cloud/cli.md).

```sh theme={null}
openwork listeners create stripe-dispute --on webhook:stripe/charge.dispute.created --run agent:"Dispute Desk"
openwork listeners secret stripe-dispute --file ./stripe-signing-secret.txt
openwork listeners test stripe-dispute
```

Listeners are yours. Other members and admins cannot see, change or use them. While the feature is off, every command stops with `feature_disabled` and changes nothing.

***

## create

```sh theme={null}
openwork listeners create <name> --on webhook:<stripe|github|custom>/<event> --run agent:<id-or-name>
openwork listeners create pr-clip --on webhook:github/pull_request.labeled --filter 'label.name == "demo"' --run automation:atm_01kr9a00000000000000000000
```

| Flag | Description |
| - | - |
| `--on` | The sender and the event to wait for. Use `*` as the event for every event the sender posts. |
| `--run` | What runs: `agent:<id-or-name>` for an agent of yours with one routine, or `automation:<id>` for a Cloud Automation of yours. |
| `--filter` | Run only for events whose contents match. One or more `path == "text"` comparisons joined by `&&`. |
| `--dry-run` | Prints the request without sending it. |

The name uses lowercase letters, digits and hyphens. You can have 25 listeners.

The command prints the address to give the sender and, for GitHub and custom senders, a signing secret. The secret is shown once.

| Sender | Set it up | Event name |
| - | - | - |
| `stripe` | Add the address as a webhook endpoint in Stripe, then store the signing secret Stripe shows with `listeners secret`. | The event type, such as `charge.dispute.created`. |
| `github` | Add the address as a webhook with content type `application/json` and the secret from `create`. | The event, then a dot and its action when it has one, such as `pull_request.labeled`. |
| `custom` | Sign each request the [Standard Webhooks](https://www.standardwebhooks.com) way with the secret from `create`. | `type` in the JSON body. |

A listener runs a Cloud Automation whose action is an agent run. It does not run a Desktop Automation, a computer, or an agent with several routines; for that agent, name the routine with `automation:<id>`.

***

## secret

Store the signing secret Stripe shows. A Stripe listener accepts nothing until this is done.

```sh theme={null}
openwork listeners secret stripe-dispute --file ./stripe-signing-secret.txt
```

The secret is read from a file and is never taken from the command line.

For a GitHub or custom listener, the command replaces the secret with a new one and prints it once. The old one stops working at once, so the command asks first unless `--force` is passed.

```sh theme={null}
openwork listeners secret pr-clip
```

***

## test

Send a listener one test event. What it runs starts once, the same way it would for a real event.

```sh theme={null}
openwork listeners test stripe-dispute
openwork listeners test pr-clip --file ./event.json
```

`--file` is a JSON file used as the event's contents. A listener with a filter needs contents that match it, or nothing runs and the command says so.

***

## events

See the last 20 events a listener received and whether each started a run.

```sh theme={null}
openwork listeners events stripe-dispute
```

| Status | Meaning |
| - | - |
| `pending` | Waiting to start. An event that arrives while a run is in progress waits for it. |
| `delivered` | A run started. The run id is shown. |
| `skipped` | No run. The listener was removed or the feature was turned off first. |
| `failed` | No run. The reason is shown, such as `target_missing` when the Automation was deleted. |

Events the listener does not wait for, and events its filter drops, are not stored and do not appear. A repeated event starts one run. Stored events are deleted after seven days.

***

## list

```sh theme={null}
openwork listeners list
```

Shows what each listener waits for, its filter, what it runs, whether it is ready to accept events and when the last event arrived.

***

## remove

```sh theme={null}
openwork listeners remove pr-clip
```

The address stops accepting events and the stored events are deleted. The command asks first unless `--force` is passed.

***

## What a run can do

A run started by an event is an ordinary run of that Automation. It uses the same model, connectors and limits, and appears in the same run history. The event is given to the agent as data from outside, after the instructions you saved.

> [!WARNING]
>
> Anyone who can make the sender post an event decides part of what the agent reads. Give the Automation only the connectors it needs, and do not write instructions that tell it to follow what an event says.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.