Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## 0.16.0

Needs `@brew.new/sdk` `^12.2.0`, which adds `triggers.ensureBrewEvent`
(GetBrew/typescript-sdk#66), and the API from GetBrew/brew-v2#2071.

### Added

- **`automations triggers ensure-brew-event`**
(`POST /v1/automations/triggers/brew-events`). Gets or creates the brand's
trigger for a contact unsubscribing. `--scope domain --domain-id <id>`
watches one marketing domain's list (ids from `domains list`), and
`--scope all` watches every email the brand sends. `--event` defaults to
`contact.unsubscribed`, the only Brew event so far. The same scope always
prints the same row, and `created` says whether this call made it. A
missing or unknown `--scope`, a `--scope domain` without `--domain-id`, or
a `--domain-id` with `--scope all` exits 2 before any request.
- Brew starts these triggers itself. `automations triggers fire` on one exits
1 with `409 TRIGGER_NOT_FIREABLE`, and `update` and `contract put` exit 1
with `422 TRIGGER_IMMUTABLE`. Try the automation with `automations test`:
the test runs on the trigger's sample, with any payload fields you pass laid
over it, and writes no contact.
- The bundled spec carries `provider: "brew_event"` on trigger rows (with a
`brewEvent` config) and `source: "brew_event"` on trigger instances.

## 0.14.0

Needs `@brew.new/sdk` `^12.0.0`, which removes `data.run`
Expand Down
4 changes: 2 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion docs/commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- GENERATED FILE — do not edit. Regenerate with `bun run docs:commands`. -->

144 commands. Classes: read (always safe), write
145 commands. Classes: read (always safe), write
(mutating, retry-safe), destructive (irreversible — the confirmation
protocol applies: interactive y/N on a TTY, exit 4 + JSON envelope with
a `confirmCommand` otherwise, `--yes` to proceed).
Expand Down Expand Up @@ -99,6 +99,7 @@ a `confirmCommand` otherwise, `--yes` to proceed).
| `brew-cli automations triggers contract validate` | read | `POST /v1/automations/triggers/{triggerEventId}/contract/validate` | Dry-run a payload against a trigger's contract (the fire path's validator) — never fires; invalid payloads still exit 0 |
| `brew-cli contracts infer` | read | `POST /v1/payload-contracts/infer` | Draft a payload contract from a real example payload — nothing is saved; PUT the draft on a trigger |
| `brew-cli automations triggers create` | write | `POST /v1/automations/triggers` | Create a trigger event (title + typed payload schema) |
| `brew-cli automations triggers ensure-brew-event` | write | `POST /v1/automations/triggers/brew-events` | Get or create the brand's trigger for a contact unsubscribing (one domain's list, or all emails) |
| `brew-cli automations triggers update` | write | `PATCH /v1/automations/triggers/{triggerEventId}` | Update a trigger event (title, description, payload schema) |
| `brew-cli automations triggers delete` | destructive | `DELETE /v1/automations/triggers/{triggerEventId}` | Delete a trigger event (rejected while automations depend on it) |
| `brew-cli automations triggers fire` | destructive | `POST /v1/automations/triggers/{triggerEventId}/fire` | Fire a trigger event with a payload (starts LIVE runs) |
Expand Down Expand Up @@ -1470,6 +1471,23 @@ Create a trigger event (title + typed payload schema)
brew-cli automations triggers create --title user.signup --input '{"payloadSchema":{"type":"object","fields":[{"key":"userId","type":"string","required":true}]}}'
```

### brew-cli automations triggers ensure-brew-event

Get or create the brand's trigger for a contact unsubscribing (one domain's list, or all emails)

- Route: `POST /v1/automations/triggers/brew-events`
- Class: write
- SDK: `brew.automations.triggers.ensureBrewEvent(...)`
- `--scope <scope>` — domain (one marketing domain's list, with --domain-id) | all (every email the brand sends)
- `--domain-id <domainId>` — The marketing domain for --scope domain (ids from domains list)
- `--event <event>` — The Brew event (default contact.unsubscribed)
- `--idempotency-key <key>` — Idempotency-Key for safe retries (auto-generated otherwise)

```bash
brew-cli automations triggers ensure-brew-event --scope domain --domain-id jd7f0c2a8w1x9m4n6p3q5r8s2t
brew-cli automations triggers ensure-brew-event --scope all
```

### brew-cli automations triggers update

Update a trigger event (title, description, payload schema)
Expand Down
Loading
Loading