Skip to content

Commit b14b349

Browse files
feat: automations (#256)
1 parent a53e49d commit b14b349

32 files changed

Lines changed: 1481 additions & 23 deletions

.github/workflows/pin-dependencies-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
const errors = [];
2121
2222
function isPinned(version) {
23-
return /^\d+\.\d+\.\d+$|^[a-z]+:[a-z]+@\d+$|^catalog:$/.test(version);
23+
return /^\d+\.\d+\.\d+(-[\w.]+)?$|^[a-z]+:[a-z]+@\d+$|^catalog:$/.test(version);
2424
}
2525
2626
for (const [dep, version] of Object.entries(pkg.dependencies || {})) {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "resend-cli",
3-
"version": "1.8.0",
3+
"version": "1.9.0",
44
"description": "The official CLI for Resend",
55
"license": "MIT",
66
"repository": {
@@ -45,7 +45,7 @@
4545
"commander": "14.0.3",
4646
"esbuild": "0.28.0",
4747
"picocolors": "1.1.1",
48-
"resend": "6.10.0"
48+
"resend": "6.11.0"
4949
},
5050
"pnpm": {
5151
"onlyBuiltDependencies": [

pnpm-lock.yaml

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

skills/resend-cli/SKILL.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ name: resend-cli
33
description: >
44
Operate the Resend platform from the terminal — send emails (including React Email
55
.tsx templates via --react-email), manage domains, contacts, broadcasts, templates,
6-
webhooks, API keys, and logs via the `resend` CLI. Use when the user wants to run
7-
Resend commands in the shell, scripts, or CI/CD pipelines, or send/preview React
8-
Email templates. Always load this skill before running `resend` commands — it
9-
contains the non-interactive flag contract and gotchas that prevent silent failures.
6+
webhooks, API keys, logs, automations, and events via the `resend` CLI. Use when the
7+
user wants to run Resend commands in the shell, scripts, or CI/CD pipelines, or
8+
send/preview React Email templates. Always load this skill before running `resend`
9+
commands — it contains the non-interactive flag contract and gotchas that prevent
10+
silent failures.
1011
license: MIT
1112
metadata:
1213
author: resend
@@ -21,6 +22,7 @@ references:
2122
- references/emails.md
2223
- references/domains.md
2324
- references/api-keys.md
25+
- references/automations.md
2426
- references/broadcasts.md
2527
- references/contacts.md
2628
- references/contact-properties.md
@@ -108,6 +110,8 @@ Auth resolves: `--api-key` flag > `RESEND_API_KEY` env > config file (`resend lo
108110
| `domains` | create, verify, update, delete, list |
109111
| `logs` | list, get, open |
110112
| `api-keys` | create, list, delete |
113+
| `automations` | create, get, list, update, delete, open, runs |
114+
| `events` | create, get, list, update, delete, send, open |
111115
| `broadcasts` | create, send, update, delete, list |
112116
| `contacts` | create, update, delete, segments, topics |
113117
| `contact-properties` | create, update, delete, list |
@@ -180,6 +184,7 @@ resend doctor -q
180184
- **Defining contact properties**[references/contact-properties.md](references/contact-properties.md)
181185
- **Working with templates**[references/templates.md](references/templates.md)
182186
- **Viewing API request logs**[references/logs.md](references/logs.md)
187+
- **Creating automations or sending events**[references/automations.md](references/automations.md)
183188
- **Setting up webhooks or listening for events**[references/webhooks.md](references/webhooks.md)
184189
- **Auth, profiles, or health checks**[references/auth.md](references/auth.md)
185190
- **Multi-step recipes** (setup, CI/CD, broadcast workflow) → [references/workflows.md](references/workflows.md)
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# automations & events
2+
3+
Detailed flag specifications for `resend automations` and `resend events` commands.
4+
5+
---
6+
7+
## automations list
8+
9+
| Flag | Type | Default | Description |
10+
|------|------|---------|-------------|
11+
| `--limit <n>` | number | 10 | Max results (1-100) |
12+
| `--after <cursor>` | string || Forward pagination |
13+
| `--before <cursor>` | string || Backward pagination |
14+
15+
---
16+
17+
## automations create
18+
19+
| Flag | Type | Required | Description |
20+
|------|------|----------|-------------|
21+
| `--name <name>` | string | Yes (unless in `--file`) | Automation name |
22+
| `--status <status>` | string | No | Initial status: `enabled` or `disabled` |
23+
| `--steps <json>` | string | Yes (unless `--file`) | Steps array as JSON string |
24+
| `--connections <json>` | string | Yes (unless `--file`) | Connections array as JSON string |
25+
| `--file <path>` | string | No | Path to JSON file with full payload (use `"-"` for stdin) |
26+
27+
When using `--file`, the JSON object should contain `{ name, status?, steps, connections }`. Flags override file values.
28+
29+
**Step types:** `trigger`, `delay`, `send_email`, `wait_for_event`, `condition`
30+
31+
**Connection types:** `default`, `condition_met`, `condition_not_met`, `timeout`, `event_received`
32+
33+
---
34+
35+
## automations get
36+
37+
```
38+
resend automations get <id>
39+
```
40+
41+
Returns the full automation object including steps and connections.
42+
43+
---
44+
45+
## automations update
46+
47+
| Flag | Type | Required | Description |
48+
|------|------|----------|-------------|
49+
| `--status <status>` | string | Yes | `enabled` or `disabled` |
50+
51+
```
52+
resend automations update <id> --status enabled
53+
```
54+
55+
---
56+
57+
## automations delete
58+
59+
| Flag | Type | Required | Description |
60+
|------|------|----------|-------------|
61+
| `--yes` | boolean | Yes (non-interactive) | Skip confirmation |
62+
63+
---
64+
65+
## automations open
66+
67+
```
68+
resend automations open [id]
69+
```
70+
71+
Opens the automations list or a specific automation's editor in the dashboard.
72+
73+
---
74+
75+
## automations runs
76+
77+
| Flag | Type | Default | Description |
78+
|------|------|---------|-------------|
79+
| `--limit <n>` | number | 10 | Max results (1-100) |
80+
| `--after <cursor>` | string || Forward pagination |
81+
| `--before <cursor>` | string || Backward pagination |
82+
83+
```
84+
resend automations runs <automation-id>
85+
```
86+
87+
**Run status values:** `running` | `completed` | `failed` | `cancelled`
88+
89+
---
90+
91+
## automations runs get
92+
93+
| Flag | Type | Required | Description |
94+
|------|------|----------|-------------|
95+
| `--automation-id <id>` | string | Yes | Automation ID |
96+
| `--run-id <id>` | string | Yes | Run ID |
97+
98+
Returns the full run object including step-level execution details.
99+
100+
---
101+
102+
## events list
103+
104+
| Flag | Type | Default | Description |
105+
|------|------|---------|-------------|
106+
| `--limit <n>` | number | 10 | Max results (1-100) |
107+
| `--after <cursor>` | string || Forward pagination |
108+
| `--before <cursor>` | string || Backward pagination |
109+
110+
---
111+
112+
## events create
113+
114+
| Flag | Type | Required | Description |
115+
|------|------|----------|-------------|
116+
| `--name <name>` | string | Yes | Event name (e.g. `user.signed_up`) |
117+
| `--schema <json>` | string | No | JSON object mapping field names to types (`string`, `number`, `boolean`, `date`) |
118+
119+
Event names cannot start with `resend:` (reserved).
120+
121+
---
122+
123+
## events get
124+
125+
```
126+
resend events get <id>
127+
```
128+
129+
Accepts an event ID.
130+
131+
---
132+
133+
## events update
134+
135+
| Flag | Type | Required | Description |
136+
|------|------|----------|-------------|
137+
| `--schema <json>` | string | Yes | Updated schema JSON (pass `null` to clear) |
138+
139+
---
140+
141+
## events delete
142+
143+
| Flag | Type | Required | Description |
144+
|------|------|----------|-------------|
145+
| `--yes` | boolean | Yes (non-interactive) | Skip confirmation |
146+
147+
---
148+
149+
## events send
150+
151+
| Flag | Type | Required | Description |
152+
|------|------|----------|-------------|
153+
| `--event <name>` | string | Yes | Event name to trigger |
154+
| `--contact-id <id>` | string | One of `--contact-id` or `--email` | Contact ID |
155+
| `--email <address>` | string | One of `--contact-id` or `--email` | Contact email |
156+
| `--payload <json>` | string | No | JSON payload matching the event schema |
157+
158+
---
159+
160+
## events open
161+
162+
```
163+
resend events open
164+
```
165+
166+
Opens the events management page in the dashboard.

skills/resend-cli/references/workflows.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,55 @@ resend contacts topics user@example.com
292292

293293
---
294294

295-
## 10. CI/CD Integration
295+
## 10. Automations & Events
296+
297+
```bash
298+
# 1. Create an event definition (the trigger signal)
299+
resend events create --name "user.signed_up" --schema '{"plan":"string"}'
300+
301+
# 2. Create an automation triggered by that event
302+
# Using a JSON file:
303+
cat > workflow.json << 'EOF'
304+
{
305+
"name": "Welcome Flow",
306+
"steps": [
307+
{ "key": "t", "type": "trigger", "config": { "eventName": "user.signed_up" } },
308+
{ "key": "d", "type": "delay", "config": { "duration": "5m" } },
309+
{ "key": "e", "type": "send_email", "config": { "template": { "id": "<published-template-id>" } } }
310+
],
311+
"connections": [
312+
{ "from": "t", "to": "d", "type": "default" },
313+
{ "from": "d", "to": "e", "type": "default" }
314+
]
315+
}
316+
EOF
317+
318+
resend automations create --file workflow.json
319+
320+
# 3. Enable the automation
321+
resend automations update <automation-id> --status enabled
322+
323+
# 4. Send an event to trigger it
324+
resend events send --event "user.signed_up" --email user@example.com --payload '{"plan":"pro"}'
325+
326+
# 5. Check runs
327+
resend automations runs <automation-id>
328+
resend automations runs get --automation-id <id> --run-id <id>
329+
330+
# 6. View in dashboard
331+
resend automations open <automation-id>
332+
333+
# Disable when done
334+
resend automations update <automation-id> --status disabled
335+
336+
# Clean up
337+
resend automations delete <automation-id> --yes
338+
resend events delete <event-id> --yes
339+
```
340+
341+
---
342+
343+
## 11. CI/CD Integration
296344

297345
```yaml
298346
# GitHub Actions example
@@ -332,7 +380,7 @@ resend emails send -q \
332380

333381
---
334382

335-
## 11. Inbound Email Processing
383+
## 12. Inbound Email Processing
336384

337385
```bash
338386
# Enable receiving on domain (at creation or check existing)

src/cli.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { apiKeysCommand } from './commands/api-keys/index';
55
import { authCommand } from './commands/auth/index';
66
import { loginCommand } from './commands/auth/login';
77
import { logoutCommand } from './commands/auth/logout';
8+
import { automationsCommand } from './commands/automations/index';
89
import { broadcastsCommand } from './commands/broadcasts/index';
910
import { listCommandsCommand } from './commands/commands';
1011
import { completionCommand } from './commands/completion';
@@ -14,6 +15,7 @@ import { docsCommand } from './commands/docs';
1415
import { doctorCommand } from './commands/doctor';
1516
import { domainsCommand } from './commands/domains/index';
1617
import { emailsCommand } from './commands/emails/index';
18+
import { eventsCommand } from './commands/events/index';
1719
import { logsCommand } from './commands/logs/index';
1820
import { openCommand } from './commands/open';
1921
import { segmentsCommand } from './commands/segments/index';
@@ -129,6 +131,8 @@ ${pc.gray('Examples:')}
129131
.addCommand(loginCommand)
130132
.addCommand(emailsCommand)
131133
.addCommand(broadcastsCommand)
134+
.addCommand(automationsCommand)
135+
.addCommand(eventsCommand)
132136
.addCommand(templatesCommand)
133137
.addCommand(contactsCommand)
134138
.addCommand(contactPropertiesCommand)

0 commit comments

Comments
 (0)