@zapier/zapier-sdk-cli 0.53.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +326 -0
- package/CHANGELOG.md +24 -0
- package/CLAUDE.md +3 -324
- package/README.md +2 -2
- package/dist/cli.cjs +5 -2
- package/dist/cli.mjs +5 -2
- package/dist/experimental.cjs +4 -1
- package/dist/experimental.mjs +4 -1
- package/dist/index.cjs +5 -2
- package/dist/index.mjs +5 -2
- package/dist/package.json +2 -1
- package/dist/src/plugins/signup/test-harness.js +1 -0
- package/dist/src/plugins/watchTriggerInbox/index.d.ts +1 -0
- package/dist/src/plugins/watchTriggerInbox/index.js +9 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -3
- package/templates/basic/AGENTS.md.hbs +2 -2
package/AGENTS.md
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
# @zapier/zapier-sdk-cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for the Zapier SDK. See the [README](./README.md) for installation and command reference.
|
|
4
|
+
|
|
5
|
+
## CLI Philosophy
|
|
6
|
+
|
|
7
|
+
The CLI is designed as a **thin veneer over the SDK**. It doesn't hardcode knowledge of SDK methods—instead, it discovers commands dynamically from SDK schemas at runtime.
|
|
8
|
+
|
|
9
|
+
**Key principles:**
|
|
10
|
+
|
|
11
|
+
- **Schema-driven commands**: Every SDK function automatically becomes a CLI command in kebab-case (`listApps` → `list-apps`)
|
|
12
|
+
- **Interactive by default**: Missing required parameters trigger interactive prompts
|
|
13
|
+
- **Machine-readable output**: Use `--json` for scripting and automation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# SDK method → CLI command mapping
|
|
17
|
+
zapier.listApps() → npx zapier-sdk list-apps
|
|
18
|
+
zapier.runAction({...}) → npx zapier-sdk run-action <app-key> <action-type> <action-key>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## The Manifest System (`.zapierrc`)
|
|
22
|
+
|
|
23
|
+
The manifest is a JSON file that **locks app versions** for your project. This ensures reproducible behavior across environments and over time.
|
|
24
|
+
|
|
25
|
+
### Why Version Locking Matters
|
|
26
|
+
|
|
27
|
+
Zapier apps are updated frequently. Without version locking:
|
|
28
|
+
|
|
29
|
+
- Your code might break when an app updates
|
|
30
|
+
- Different team members might get different results
|
|
31
|
+
- Production and development environments might behave differently
|
|
32
|
+
|
|
33
|
+
### How It Works
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# This creates/updates .zapierrc AND generates types
|
|
37
|
+
npx zapier-sdk add slack google-sheets
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The resulting `.zapierrc`:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"apps": {
|
|
45
|
+
"slack": {
|
|
46
|
+
"implementation": "SlackCLIAPI",
|
|
47
|
+
"version": "2.5.0"
|
|
48
|
+
},
|
|
49
|
+
"google-sheets": {
|
|
50
|
+
"implementation": "GoogleSheetsV2CLIAPI",
|
|
51
|
+
"version": "3.1.2"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The SDK reads this manifest and uses these specific versions when making API calls.
|
|
58
|
+
|
|
59
|
+
### Manifest Commands
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Add apps (updates manifest + generates types)
|
|
63
|
+
npx zapier-sdk add slack
|
|
64
|
+
|
|
65
|
+
# Build manifest only (no type generation)
|
|
66
|
+
npx zapier-sdk build-manifest slack --skip-write # Preview what would be written
|
|
67
|
+
npx zapier-sdk build-manifest slack # Write to .zapierrc
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Type Generation Deep Dive
|
|
71
|
+
|
|
72
|
+
The `add` command does two things: updates the manifest AND generates TypeScript types. Sometimes you need more control.
|
|
73
|
+
|
|
74
|
+
### Customizing Output Location
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Default: types go to src/zapier/apps/ or lib/zapier/apps/
|
|
78
|
+
npx zapier-sdk add slack
|
|
79
|
+
|
|
80
|
+
# Custom location
|
|
81
|
+
npx zapier-sdk add slack --types-output ./types/zapier/
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Types Only (No Manifest Change)
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Generate types without touching the manifest
|
|
88
|
+
npx zapier-sdk generate-app-types slack --types-output ./types/
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Dynamic Fields and Connections
|
|
92
|
+
|
|
93
|
+
Some apps have fields that depend on your connection (e.g., "Select a Slack channel" requires knowing which workspace you're connected to). To generate types for these:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Provide connection IDs for dynamic field resolution
|
|
97
|
+
npx zapier-sdk add slack --connection-ids 123456
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### When to Regenerate
|
|
101
|
+
|
|
102
|
+
Run `add` again when:
|
|
103
|
+
|
|
104
|
+
- You want to update to a newer app version
|
|
105
|
+
- You've added a new connection that reveals new dynamic fields
|
|
106
|
+
- Your types were accidentally deleted
|
|
107
|
+
|
|
108
|
+
## App Discovery Workflow
|
|
109
|
+
|
|
110
|
+
Finding the right app and understanding its capabilities is a common workflow.
|
|
111
|
+
|
|
112
|
+
### Step 1: Search for Apps
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Search by name
|
|
116
|
+
npx zapier-sdk list-apps --search "google"
|
|
117
|
+
|
|
118
|
+
# Output shows all valid keys you can use:
|
|
119
|
+
# 1. Google Sheets (GoogleSheetsV2CLIAPI, google-sheets, google_sheets)
|
|
120
|
+
# 2. Google Calendar (GoogleCalendarCLIAPI, google-calendar, google_calendar)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Step 2: Get App Details
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# See app metadata
|
|
127
|
+
npx zapier-sdk get-app slack
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Step 3: Explore Actions
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# List all actions
|
|
134
|
+
npx zapier-sdk list-actions slack
|
|
135
|
+
|
|
136
|
+
# Filter by action type
|
|
137
|
+
npx zapier-sdk list-actions slack --action-type write
|
|
138
|
+
|
|
139
|
+
# Get details for a specific action
|
|
140
|
+
npx zapier-sdk get-action slack write channel_message
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Step 4: See Input Fields
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# What inputs does this action need?
|
|
147
|
+
npx zapier-sdk list-input-fields slack write channel_message
|
|
148
|
+
|
|
149
|
+
# Get as JSON Schema (useful for validation)
|
|
150
|
+
npx zapier-sdk get-input-fields-schema slack write channel_message
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Running Actions from CLI
|
|
154
|
+
|
|
155
|
+
Execute Zapier actions directly from the command line.
|
|
156
|
+
|
|
157
|
+
### Basic Usage
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
npx zapier-sdk run-action slack read channels --connection-id 123456
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### With Inputs
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Pass inputs as JSON
|
|
167
|
+
npx zapier-sdk run-action slack write channel_message \
|
|
168
|
+
--connection-id 123456 \
|
|
169
|
+
--inputs '{"channel": "#general", "text": "Hello from CLI!"}'
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Interactive Mode
|
|
173
|
+
|
|
174
|
+
If you omit required parameters, the CLI prompts for them:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# This will prompt for app-key, action-type, action-key, and auth
|
|
178
|
+
npx zapier-sdk run-action
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Machine-Readable Output
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# Get raw JSON output for scripting
|
|
185
|
+
npx zapier-sdk run-action slack read channels \
|
|
186
|
+
--connection-id 123456 \
|
|
187
|
+
--json
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Multiple Connections
|
|
191
|
+
|
|
192
|
+
If you have multiple Slack connections and don't specify which one:
|
|
193
|
+
|
|
194
|
+
- The CLI shows a list and prompts you to choose
|
|
195
|
+
- Or use `list-connections` to find the right ID first
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# Find your connection IDs
|
|
199
|
+
npx zapier-sdk list-connections --app-key slack --owner me
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## MCP Server
|
|
203
|
+
|
|
204
|
+
The CLI includes an MCP (Model Context Protocol) server that enables AI tools to interact with Zapier directly.
|
|
205
|
+
|
|
206
|
+
### Starting the Server
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
npx zapier-sdk mcp
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Use Cases
|
|
213
|
+
|
|
214
|
+
- **Claude Desktop**: Configure Claude to use Zapier actions as tools
|
|
215
|
+
- **AI Agents**: Let AI agents trigger Zapier workflows
|
|
216
|
+
- **Custom Integrations**: Any MCP-compatible client can use Zapier
|
|
217
|
+
|
|
218
|
+
### Configuration
|
|
219
|
+
|
|
220
|
+
For Claude Desktop, add to your `claude_desktop_config.json`:
|
|
221
|
+
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"mcpServers": {
|
|
225
|
+
"zapier": {
|
|
226
|
+
"command": "npx",
|
|
227
|
+
"args": ["zapier-sdk", "mcp"]
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Debugging
|
|
234
|
+
|
|
235
|
+
### Verbose Logging
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# Enable debug output
|
|
239
|
+
npx zapier-sdk list-apps --debug
|
|
240
|
+
|
|
241
|
+
# Or via environment variable
|
|
242
|
+
DEBUG=* npx zapier-sdk list-apps
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Finding Config Files
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Where is my login config stored?
|
|
249
|
+
npx zapier-sdk get-login-config-path
|
|
250
|
+
# Output: /Users/you/.zapier-sdk/config.json
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Common Issues
|
|
254
|
+
|
|
255
|
+
**"Not logged in"**
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
npx zapier-sdk login
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**"Connection not found"**
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# List your connections to find valid IDs
|
|
265
|
+
npx zapier-sdk list-connections --owner me
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
**"App not found"**
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# Search for the correct app key
|
|
272
|
+
npx zapier-sdk list-apps --search "the app name"
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Global Options
|
|
276
|
+
|
|
277
|
+
Available on all commands:
|
|
278
|
+
|
|
279
|
+
| Option | Description |
|
|
280
|
+
| -------------------------------------- | ------------------------------------------------- |
|
|
281
|
+
| `--help`, `-h` | Show help for a command |
|
|
282
|
+
| `--version`, `-v` | Show CLI version |
|
|
283
|
+
| `--debug` | Enable verbose logging |
|
|
284
|
+
| `--json` | Output raw JSON (no formatting) |
|
|
285
|
+
| `--base-url <url>` | Override API base URL |
|
|
286
|
+
| `--credentials <token>` | Provide a token directly |
|
|
287
|
+
| `--credentials-client-id <id>` | OAuth client ID |
|
|
288
|
+
| `--credentials-client-secret <secret>` | OAuth client secret (for client_credentials flow) |
|
|
289
|
+
| `--credentials-base-url <url>` | Override auth base URL |
|
|
290
|
+
| `--tracking-base-url <url>` | Override tracking base URL |
|
|
291
|
+
|
|
292
|
+
### Authentication via CLI Flags
|
|
293
|
+
|
|
294
|
+
You can authenticate without logging in by passing credentials directly:
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Using a token
|
|
298
|
+
npx zapier-sdk list-apps --credentials "your_token_here"
|
|
299
|
+
|
|
300
|
+
# Using client credentials (server-to-server OAuth)
|
|
301
|
+
npx zapier-sdk list-apps \
|
|
302
|
+
--credentials-client-id "your_client_id" \
|
|
303
|
+
--credentials-client-secret "your_client_secret"
|
|
304
|
+
|
|
305
|
+
# Using PKCE (will trigger interactive login if needed)
|
|
306
|
+
npx zapier-sdk list-apps --credentials-client-id "your_client_id"
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
This is useful for CI/CD pipelines or scripts where you don't want to store login state.
|
|
310
|
+
|
|
311
|
+
## Feedback Command (AI Agent Guidance)
|
|
312
|
+
|
|
313
|
+
The `feedback` command lets users and AI agents submit feedback about the SDK directly from the terminal.
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
npx zapier-sdk feedback "The type generation is incredibly useful"
|
|
317
|
+
npx zapier-sdk feedback "Auth setup was confusing, took me 30 minutes"
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**AI agents should proactively use this command** when:
|
|
321
|
+
|
|
322
|
+
- A user expresses clear satisfaction (e.g., "this is great", "that was easy")
|
|
323
|
+
- A user expresses frustration (e.g., "this is broken", "why is this so hard")
|
|
324
|
+
- A user completes a complex workflow successfully or fails after multiple attempts
|
|
325
|
+
|
|
326
|
+
Include specific context in the feedback text — what the user was trying to do, what worked or didn't, and any error messages encountered. The user's email and ID are auto-collected from their login session.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @zapier/zapier-sdk-cli
|
|
2
2
|
|
|
3
|
+
## 0.54.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9f1e934: Switched `watchTriggerInbox` from backoff polling to a Server-Sent Events subscription, so it now wakes on near-real-time inbox notifications instead of repeatedly polling for new messages.
|
|
8
|
+
- The `maxDrainIntervalSeconds` option now controls a periodic safety drain that backstops the SSE stream — guaranteeing forward progress if events are missed or the connection drops — and its default changed from 60 to 300 seconds.
|
|
9
|
+
- Real-time wake-up health is now reported on stderr: a warning when wake-ups pause and the watch falls back to the safety drain, plus transient reconnect notices in debug mode. stdout (including `--json` NDJSON output) is unaffected.
|
|
10
|
+
- Added a `fetchStream` method to the API client, along with an exported `SseMessage` type, for opening Server-Sent Events connections through the standard request pipeline (auth, base URL, 429 retry, approval, and concurrency).
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [9f1e934]
|
|
15
|
+
- @zapier/zapier-sdk@0.69.0
|
|
16
|
+
- @zapier/zapier-sdk-mcp@0.13.24
|
|
17
|
+
|
|
18
|
+
## 0.53.1
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 9d6bd4d: Ship `AGENTS.md` as the canonical agent-instructions file. Each `CLAUDE.md` is now a thin stub that imports it, so Claude Code, Codex, and Cursor read the same guidance.
|
|
23
|
+
- Updated dependencies [9d6bd4d]
|
|
24
|
+
- @zapier/zapier-sdk@0.68.1
|
|
25
|
+
- @zapier/zapier-sdk-mcp@0.13.23
|
|
26
|
+
|
|
3
27
|
## 0.53.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
package/CLAUDE.md
CHANGED
|
@@ -1,326 +1,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CLAUDE.md
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Claude Code loads this file automatically. The canonical AI-agent guidance lives in [AGENTS.md](./AGENTS.md) so that Claude Code, Codex, Cursor, and any other tool following the AGENTS.md convention read the same content.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
The CLI is designed as a **thin veneer over the SDK**. It doesn't hardcode knowledge of SDK methods—instead, it discovers commands dynamically from SDK schemas at runtime.
|
|
8
|
-
|
|
9
|
-
**Key principles:**
|
|
10
|
-
|
|
11
|
-
- **Schema-driven commands**: Every SDK function automatically becomes a CLI command in kebab-case (`listApps` → `list-apps`)
|
|
12
|
-
- **Interactive by default**: Missing required parameters trigger interactive prompts
|
|
13
|
-
- **Machine-readable output**: Use `--json` for scripting and automation
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
# SDK method → CLI command mapping
|
|
17
|
-
zapier.listApps() → npx zapier-sdk list-apps
|
|
18
|
-
zapier.runAction({...}) → npx zapier-sdk run-action <app-key> <action-type> <action-key>
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## The Manifest System (`.zapierrc`)
|
|
22
|
-
|
|
23
|
-
The manifest is a JSON file that **locks app versions** for your project. This ensures reproducible behavior across environments and over time.
|
|
24
|
-
|
|
25
|
-
### Why Version Locking Matters
|
|
26
|
-
|
|
27
|
-
Zapier apps are updated frequently. Without version locking:
|
|
28
|
-
|
|
29
|
-
- Your code might break when an app updates
|
|
30
|
-
- Different team members might get different results
|
|
31
|
-
- Production and development environments might behave differently
|
|
32
|
-
|
|
33
|
-
### How It Works
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
# This creates/updates .zapierrc AND generates types
|
|
37
|
-
npx zapier-sdk add slack google-sheets
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
The resulting `.zapierrc`:
|
|
41
|
-
|
|
42
|
-
```json
|
|
43
|
-
{
|
|
44
|
-
"apps": {
|
|
45
|
-
"slack": {
|
|
46
|
-
"implementation": "SlackCLIAPI",
|
|
47
|
-
"version": "2.5.0"
|
|
48
|
-
},
|
|
49
|
-
"google-sheets": {
|
|
50
|
-
"implementation": "GoogleSheetsV2CLIAPI",
|
|
51
|
-
"version": "3.1.2"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
The SDK reads this manifest and uses these specific versions when making API calls.
|
|
58
|
-
|
|
59
|
-
### Manifest Commands
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
# Add apps (updates manifest + generates types)
|
|
63
|
-
npx zapier-sdk add slack
|
|
64
|
-
|
|
65
|
-
# Build manifest only (no type generation)
|
|
66
|
-
npx zapier-sdk build-manifest slack --skip-write # Preview what would be written
|
|
67
|
-
npx zapier-sdk build-manifest slack # Write to .zapierrc
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Type Generation Deep Dive
|
|
71
|
-
|
|
72
|
-
The `add` command does two things: updates the manifest AND generates TypeScript types. Sometimes you need more control.
|
|
73
|
-
|
|
74
|
-
### Customizing Output Location
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
# Default: types go to src/zapier/apps/ or lib/zapier/apps/
|
|
78
|
-
npx zapier-sdk add slack
|
|
79
|
-
|
|
80
|
-
# Custom location
|
|
81
|
-
npx zapier-sdk add slack --types-output ./types/zapier/
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Types Only (No Manifest Change)
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
# Generate types without touching the manifest
|
|
88
|
-
npx zapier-sdk generate-app-types slack --types-output ./types/
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Dynamic Fields and Connections
|
|
92
|
-
|
|
93
|
-
Some apps have fields that depend on your connection (e.g., "Select a Slack channel" requires knowing which workspace you're connected to). To generate types for these:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
# Provide connection IDs for dynamic field resolution
|
|
97
|
-
npx zapier-sdk add slack --connection-ids 123456
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### When to Regenerate
|
|
101
|
-
|
|
102
|
-
Run `add` again when:
|
|
103
|
-
|
|
104
|
-
- You want to update to a newer app version
|
|
105
|
-
- You've added a new connection that reveals new dynamic fields
|
|
106
|
-
- Your types were accidentally deleted
|
|
107
|
-
|
|
108
|
-
## App Discovery Workflow
|
|
109
|
-
|
|
110
|
-
Finding the right app and understanding its capabilities is a common workflow.
|
|
111
|
-
|
|
112
|
-
### Step 1: Search for Apps
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
# Search by name
|
|
116
|
-
npx zapier-sdk list-apps --search "google"
|
|
117
|
-
|
|
118
|
-
# Output shows all valid keys you can use:
|
|
119
|
-
# 1. Google Sheets (GoogleSheetsV2CLIAPI, google-sheets, google_sheets)
|
|
120
|
-
# 2. Google Calendar (GoogleCalendarCLIAPI, google-calendar, google_calendar)
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### Step 2: Get App Details
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
# See app metadata
|
|
127
|
-
npx zapier-sdk get-app slack
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Step 3: Explore Actions
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
# List all actions
|
|
134
|
-
npx zapier-sdk list-actions slack
|
|
135
|
-
|
|
136
|
-
# Filter by action type
|
|
137
|
-
npx zapier-sdk list-actions slack --action-type write
|
|
138
|
-
|
|
139
|
-
# Get details for a specific action
|
|
140
|
-
npx zapier-sdk get-action slack write channel_message
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### Step 4: See Input Fields
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
# What inputs does this action need?
|
|
147
|
-
npx zapier-sdk list-input-fields slack write channel_message
|
|
148
|
-
|
|
149
|
-
# Get as JSON Schema (useful for validation)
|
|
150
|
-
npx zapier-sdk get-input-fields-schema slack write channel_message
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
## Running Actions from CLI
|
|
154
|
-
|
|
155
|
-
Execute Zapier actions directly from the command line.
|
|
156
|
-
|
|
157
|
-
### Basic Usage
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
npx zapier-sdk run-action slack read channels --connection-id 123456
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### With Inputs
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
# Pass inputs as JSON
|
|
167
|
-
npx zapier-sdk run-action slack write channel_message \
|
|
168
|
-
--connection-id 123456 \
|
|
169
|
-
--inputs '{"channel": "#general", "text": "Hello from CLI!"}'
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Interactive Mode
|
|
173
|
-
|
|
174
|
-
If you omit required parameters, the CLI prompts for them:
|
|
175
|
-
|
|
176
|
-
```bash
|
|
177
|
-
# This will prompt for app-key, action-type, action-key, and auth
|
|
178
|
-
npx zapier-sdk run-action
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### Machine-Readable Output
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
# Get raw JSON output for scripting
|
|
185
|
-
npx zapier-sdk run-action slack read channels \
|
|
186
|
-
--connection-id 123456 \
|
|
187
|
-
--json
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### Multiple Connections
|
|
191
|
-
|
|
192
|
-
If you have multiple Slack connections and don't specify which one:
|
|
193
|
-
|
|
194
|
-
- The CLI shows a list and prompts you to choose
|
|
195
|
-
- Or use `list-connections` to find the right ID first
|
|
196
|
-
|
|
197
|
-
```bash
|
|
198
|
-
# Find your connection IDs
|
|
199
|
-
npx zapier-sdk list-connections --app-key slack --owner me
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
## MCP Server
|
|
203
|
-
|
|
204
|
-
The CLI includes an MCP (Model Context Protocol) server that enables AI tools to interact with Zapier directly.
|
|
205
|
-
|
|
206
|
-
### Starting the Server
|
|
207
|
-
|
|
208
|
-
```bash
|
|
209
|
-
npx zapier-sdk mcp
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### Use Cases
|
|
213
|
-
|
|
214
|
-
- **Claude Desktop**: Configure Claude to use Zapier actions as tools
|
|
215
|
-
- **AI Agents**: Let AI agents trigger Zapier workflows
|
|
216
|
-
- **Custom Integrations**: Any MCP-compatible client can use Zapier
|
|
217
|
-
|
|
218
|
-
### Configuration
|
|
219
|
-
|
|
220
|
-
For Claude Desktop, add to your `claude_desktop_config.json`:
|
|
221
|
-
|
|
222
|
-
```json
|
|
223
|
-
{
|
|
224
|
-
"mcpServers": {
|
|
225
|
-
"zapier": {
|
|
226
|
-
"command": "npx",
|
|
227
|
-
"args": ["zapier-sdk", "mcp"]
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
## Debugging
|
|
234
|
-
|
|
235
|
-
### Verbose Logging
|
|
236
|
-
|
|
237
|
-
```bash
|
|
238
|
-
# Enable debug output
|
|
239
|
-
npx zapier-sdk list-apps --debug
|
|
240
|
-
|
|
241
|
-
# Or via environment variable
|
|
242
|
-
DEBUG=* npx zapier-sdk list-apps
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
### Finding Config Files
|
|
246
|
-
|
|
247
|
-
```bash
|
|
248
|
-
# Where is my login config stored?
|
|
249
|
-
npx zapier-sdk get-login-config-path
|
|
250
|
-
# Output: /Users/you/.zapier-sdk/config.json
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
### Common Issues
|
|
254
|
-
|
|
255
|
-
**"Not logged in"**
|
|
256
|
-
|
|
257
|
-
```bash
|
|
258
|
-
npx zapier-sdk login
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
**"Connection not found"**
|
|
262
|
-
|
|
263
|
-
```bash
|
|
264
|
-
# List your connections to find valid IDs
|
|
265
|
-
npx zapier-sdk list-connections --owner me
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
**"App not found"**
|
|
269
|
-
|
|
270
|
-
```bash
|
|
271
|
-
# Search for the correct app key
|
|
272
|
-
npx zapier-sdk list-apps --search "the app name"
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
## Global Options
|
|
276
|
-
|
|
277
|
-
Available on all commands:
|
|
278
|
-
|
|
279
|
-
| Option | Description |
|
|
280
|
-
| -------------------------------------- | ------------------------------------------------- |
|
|
281
|
-
| `--help`, `-h` | Show help for a command |
|
|
282
|
-
| `--version`, `-v` | Show CLI version |
|
|
283
|
-
| `--debug` | Enable verbose logging |
|
|
284
|
-
| `--json` | Output raw JSON (no formatting) |
|
|
285
|
-
| `--base-url <url>` | Override API base URL |
|
|
286
|
-
| `--credentials <token>` | Provide a token directly |
|
|
287
|
-
| `--credentials-client-id <id>` | OAuth client ID |
|
|
288
|
-
| `--credentials-client-secret <secret>` | OAuth client secret (for client_credentials flow) |
|
|
289
|
-
| `--credentials-base-url <url>` | Override auth base URL |
|
|
290
|
-
| `--tracking-base-url <url>` | Override tracking base URL |
|
|
291
|
-
|
|
292
|
-
### Authentication via CLI Flags
|
|
293
|
-
|
|
294
|
-
You can authenticate without logging in by passing credentials directly:
|
|
295
|
-
|
|
296
|
-
```bash
|
|
297
|
-
# Using a token
|
|
298
|
-
npx zapier-sdk list-apps --credentials "your_token_here"
|
|
299
|
-
|
|
300
|
-
# Using client credentials (server-to-server OAuth)
|
|
301
|
-
npx zapier-sdk list-apps \
|
|
302
|
-
--credentials-client-id "your_client_id" \
|
|
303
|
-
--credentials-client-secret "your_client_secret"
|
|
304
|
-
|
|
305
|
-
# Using PKCE (will trigger interactive login if needed)
|
|
306
|
-
npx zapier-sdk list-apps --credentials-client-id "your_client_id"
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
This is useful for CI/CD pipelines or scripts where you don't want to store login state.
|
|
310
|
-
|
|
311
|
-
## Feedback Command (AI Agent Guidance)
|
|
312
|
-
|
|
313
|
-
The `feedback` command lets users and AI agents submit feedback about the SDK directly from the terminal.
|
|
314
|
-
|
|
315
|
-
```bash
|
|
316
|
-
npx zapier-sdk feedback "The type generation is incredibly useful"
|
|
317
|
-
npx zapier-sdk feedback "Auth setup was confusing, took me 30 minutes"
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
**AI agents should proactively use this command** when:
|
|
321
|
-
|
|
322
|
-
- A user expresses clear satisfaction (e.g., "this is great", "that was easy")
|
|
323
|
-
- A user expresses frustration (e.g., "this is broken", "why is this so hard")
|
|
324
|
-
- A user completes a complex workflow successfully or fails after multiple attempts
|
|
325
|
-
|
|
326
|
-
Include specific context in the feedback text — what the user was trying to do, what worked or didn't, and any error messages encountered. The user's email and ID are auto-collected from their login session.
|
|
5
|
+
@AGENTS.md
|
package/README.md
CHANGED
|
@@ -1465,7 +1465,7 @@ npx zapier-sdk update-trigger-inbox <inbox> [--notification-url]
|
|
|
1465
1465
|
|
|
1466
1466
|
#### `watch-trigger-inbox` 🧪 _experimental_
|
|
1467
1467
|
|
|
1468
|
-
Continuously consume a trigger inbox: drain currently-available messages via onMessage, then
|
|
1468
|
+
Continuously consume a trigger inbox: drain currently-available messages via onMessage, then subscribe to SSE notifications for new arrivals until aborted. A periodic safety drain runs every maxDrainIntervalSeconds (default: 300) to guarantee forward progress if SSE events are missed. Resolves cleanly on signal abort or ZapierAbortDrainSignal from a handler; rejects on fatal SDK errors or fail-fast handler errors. Real-time wake-up health is reported on stderr: a warning when wake-ups pause and the watch falls back to the safety drain, plus (with debug) transient reconnect notices. stdout (including --json NDJSON) is unaffected.
|
|
1469
1469
|
|
|
1470
1470
|
**Options:**
|
|
1471
1471
|
|
|
@@ -1477,7 +1477,7 @@ Continuously consume a trigger inbox: drain currently-available messages via onM
|
|
|
1477
1477
|
| `--lease-seconds` | `number` | ❌ | — | — | Seconds until the lease expires; messages return to available if not acked. API default is 300 (5 minutes). |
|
|
1478
1478
|
| `--release-on-error` | `boolean` | ❌ | — | — | If true, errors release the message when the drain finishes. If false (default), errors leave it leased until the lease timeout. `ZapierReleaseTriggerMessageSignal` always releases regardless. |
|
|
1479
1479
|
| `--continue-on-error` | `boolean` | ❌ | — | — | If false (default, fail-fast), the first handler error rejects and stops the drain. If true, handler errors are observed via `onError` and the drain continues. SDK-level errors (lease / ack / release) reject regardless. |
|
|
1480
|
-
| `--max-drain-interval-seconds` | `number` | ❌ | — | — | Maximum seconds between
|
|
1480
|
+
| `--max-drain-interval-seconds` | `number` | ❌ | — | — | Maximum seconds between safety drain attempts (default: 300). The watcher subscribes to SSE notifications for near-real-time wake-ups; this interval is the backstop that guarantees forward progress if SSE events are missed or the connection drops undetected. |
|
|
1481
1481
|
| `--exec` | `string` | ❌ | — | — | Run a binary per message with no shell interpretation. Message JSON is piped to stdin; exit code 0 acks, non-zero records the error per the same rules as a thrown handler. Pass extra argv after `--` (e.g. `--exec ./handler -- --verbose`). Mutually exclusive with --exec-shell and --json. |
|
|
1482
1482
|
| `--exec-shell` | `string` | ❌ | — | — | Run a shell command per message. Message JSON is piped to the subprocess on stdin; exit code 0 acks, non-zero records the error per the same rules as a thrown handler. Interpreted by the platform's default shell (sh on POSIX, cmd.exe on Windows). Mutually exclusive with --exec and --json. |
|
|
1483
1483
|
| `--json` | `boolean` | ❌ | — | — | Stream each message as JSON to stdout (one record per line, NDJSON), acking as each write completes. Use for piping to other tools. Mutually exclusive with --exec / --exec-shell and the interactive default. |
|