@withone/cli 1.14.1 → 1.16.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withone/cli",
3
- "version": "1.14.1",
3
+ "version": "1.16.0",
4
4
  "description": "CLI for managing One",
5
5
  "type": "module",
6
6
  "files": [
@@ -36,4 +36,4 @@
36
36
  "engines": {
37
37
  "node": ">=18"
38
38
  }
39
- }
39
+ }
@@ -19,6 +19,8 @@ description: |
19
19
 
20
20
  # One Workflows — Multi-Step API Workflows
21
21
 
22
+ <!-- Canonical flow schema: src/lib/flow-schema.ts (drives both validation and guide generation) -->
23
+
22
24
  You have access to the One CLI's workflow engine, which lets you create and execute multi-step API workflows as JSON files. Workflows chain actions across platforms — e.g., look up a Stripe customer, then send them a welcome email via Gmail.
23
25
 
24
26
  ## 1. Overview
@@ -0,0 +1,303 @@
1
+ ---
2
+ name: one-relay
3
+ description: |
4
+ Set up webhook relay endpoints to receive events from third-party platforms and forward them to other platforms using passthrough actions with Handlebars templates — no middleware, no flows, no code.
5
+
6
+ TRIGGER when the user wants to:
7
+ - Receive webhooks from a platform and forward/relay them somewhere
8
+ - Set up event-driven automation between platforms (e.g., "when a Stripe customer is created, send a Slack message")
9
+ - Create webhook endpoints for a connected platform
10
+ - Map webhook event data from one platform to another platform's API
11
+ - List, manage, or debug webhook relay endpoints, events, or deliveries
12
+
13
+ DO NOT TRIGGER for:
14
+ - Single action execution without webhooks (use one-actions skill)
15
+ - Multi-step workflows not triggered by webhooks (use one-flow skill)
16
+ - Setting up One or installing MCP (that's `one init`)
17
+ - Adding new connections (that's `one connection add`)
18
+ ---
19
+
20
+ # One Webhook Relay
21
+
22
+ Webhook relay lets you receive webhooks from third-party platforms (Stripe, Shopify, GitHub, etc.) and forward the event data to other platforms using passthrough actions. The passthrough action type maps fields from the incoming webhook payload directly to another platform's API using Handlebars templates — no middleware, no flows, no code needed.
23
+
24
+ ## Supported Platforms
25
+
26
+ Webhook relay is currently supported for these platforms:
27
+
28
+ - **Airtable**
29
+ - **Attio**
30
+ - **GitHub**
31
+ - **Google Calendar**
32
+ - **Stripe**
33
+
34
+ Only these platforms can be used as webhook sources. Any connected platform can be a destination via passthrough actions.
35
+
36
+ ## The Workflow
37
+
38
+ **You MUST follow this process to build a correct relay:**
39
+
40
+ ### Step 1: Discover connections
41
+
42
+ ```bash
43
+ one --agent connection list
44
+ ```
45
+
46
+ Identify the **source** platform (sends webhooks) and **destination** platform (receives forwarded data). Note both connection keys.
47
+
48
+ ### Step 2: Get event types for the source platform
49
+
50
+ ```bash
51
+ one --agent relay event-types <source-platform>
52
+ ```
53
+
54
+ See what webhook events the source platform supports. Pick the relevant event type(s).
55
+
56
+ ### Step 3: Get source knowledge — understand the incoming webhook payload
57
+
58
+ Search for the webhook event to understand what data the source platform sends:
59
+
60
+ ```bash
61
+ one --agent actions search <source-platform> "<event description>" -t knowledge
62
+ one --agent actions knowledge <source-platform> <actionId>
63
+ ```
64
+
65
+ Read the knowledge to understand the webhook payload structure. These fields become `{{payload.*}}` paths in your Handlebars templates.
66
+
67
+ ### Step 4: Get destination knowledge — understand the outgoing API shape
68
+
69
+ Search for the destination action to understand what data it expects:
70
+
71
+ ```bash
72
+ one --agent actions search <dest-platform> "<what you want to do>" -t execute
73
+ one --agent actions knowledge <dest-platform> <actionId>
74
+ ```
75
+
76
+ Read the knowledge to understand required fields, data types, and request body structure. These become the keys in your passthrough action's `body`.
77
+
78
+ ### Step 5: Create the relay endpoint
79
+
80
+ ```bash
81
+ one --agent relay create \
82
+ --connection-key <source-connection-key> \
83
+ --description "Forward <event> from <source> to <dest>" \
84
+ --event-filters '["event.type"]' \
85
+ --create-webhook
86
+ ```
87
+
88
+ The `--create-webhook` flag automatically registers the webhook URL with the source platform. The response includes the relay endpoint `id` you need for activation.
89
+
90
+ ### Step 6: Activate with a passthrough action
91
+
92
+ ```bash
93
+ one --agent relay activate <relay-id> --actions '[{
94
+ "type": "passthrough",
95
+ "actionId": "<destination-action-id>",
96
+ "connectionKey": "<destination-connection-key>",
97
+ "body": {
98
+ "field": "{{payload.path.to.value}}"
99
+ },
100
+ "eventFilters": ["event.type"]
101
+ }]'
102
+ ```
103
+
104
+ Map source fields to destination fields using Handlebars templates in the `body`. The template paths come from the source knowledge (Step 3), and the body keys come from the destination knowledge (Step 4).
105
+
106
+ ## Template Context Reference
107
+
108
+ When a webhook event is received, the following variables are available in Handlebars templates:
109
+
110
+ | Variable | Type | Description |
111
+ |---|---|---|
112
+ | `{{relayEventId}}` | UUID | Unique relay event ID |
113
+ | `{{platform}}` | String | Source platform (e.g., `stripe`) |
114
+ | `{{eventType}}` | String | Webhook event type (e.g., `customer.created`) |
115
+ | `{{payload}}` | Object | The full incoming webhook body |
116
+ | `{{timestamp}}` | DateTime | When the event was received |
117
+ | `{{connectionId}}` | UUID | Source connection UUID |
118
+
119
+ Access nested fields with dot notation: `{{payload.data.object.email}}`
120
+
121
+ Use the `{{json payload}}` helper to embed a full object as a JSON string.
122
+
123
+ ## Action Types
124
+
125
+ Each relay endpoint can have multiple actions. Three types are supported:
126
+
127
+ ### `passthrough` — Forward to another platform's API (primary)
128
+
129
+ Maps webhook data to another platform's API using Handlebars templates. This is the most powerful action type.
130
+
131
+ ```json
132
+ {
133
+ "type": "passthrough",
134
+ "actionId": "<action-id-from-search>",
135
+ "connectionKey": "<destination-connection-key>",
136
+ "body": {
137
+ "channel": "#alerts",
138
+ "text": "New customer: {{payload.data.object.name}} ({{payload.data.object.email}})"
139
+ },
140
+ "eventFilters": ["customer.created"]
141
+ }
142
+ ```
143
+
144
+ The `body`, `headers`, and `query` fields all support Handlebars templates.
145
+
146
+ ### `url` — Forward raw event to a URL
147
+
148
+ ```json
149
+ {
150
+ "type": "url",
151
+ "url": "https://your-app.com/webhooks/handler",
152
+ "secret": "optional-signing-secret",
153
+ "eventFilters": ["customer.created"]
154
+ }
155
+ ```
156
+
157
+ ### `agent` — Send to an agent
158
+
159
+ ```json
160
+ {
161
+ "type": "agent",
162
+ "agentId": "<agent-uuid>",
163
+ "eventFilters": ["customer.created"]
164
+ }
165
+ ```
166
+
167
+ ## Complete Example — Stripe customer.created → Slack message
168
+
169
+ ### 1. Get connections
170
+
171
+ ```bash
172
+ one --agent connection list
173
+ # stripe: live::stripe::default::abc123
174
+ # slack: live::slack::default::xyz789
175
+ ```
176
+
177
+ ### 2. Get Stripe event types
178
+
179
+ ```bash
180
+ one --agent relay event-types stripe
181
+ # Returns: ["customer.created", "customer.updated", "payment_intent.succeeded", ...]
182
+ ```
183
+
184
+ ### 3. Get Slack send message action
185
+
186
+ ```bash
187
+ one --agent actions search slack "send message" -t execute
188
+ # Returns: actionId "conn_mod_def::GJ7H84zBlaI::BCfuA16aTaGVIax5magsLA"
189
+
190
+ one --agent actions knowledge slack conn_mod_def::GJ7H84zBlaI::BCfuA16aTaGVIax5magsLA
191
+ # Required body: { "channel": "string", "text": "string" }
192
+ # Optional: "blocks" for rich formatting
193
+ ```
194
+
195
+ ### 4. Create the relay
196
+
197
+ ```bash
198
+ one --agent relay create \
199
+ --connection-key "live::stripe::default::abc123" \
200
+ --description "Notify Slack on new Stripe customers" \
201
+ --event-filters '["customer.created"]' \
202
+ --create-webhook
203
+ # Returns: { "id": "c531d7b8-...", "url": "https://api.withone.ai/v1/webhooks/relay/incoming/stripe/..." }
204
+ ```
205
+
206
+ ### 5. Activate with Slack passthrough action
207
+
208
+ ```bash
209
+ one --agent relay activate c531d7b8-... --actions '[{
210
+ "type": "passthrough",
211
+ "actionId": "conn_mod_def::GJ7H84zBlaI::BCfuA16aTaGVIax5magsLA",
212
+ "connectionKey": "live::slack::default::xyz789",
213
+ "body": {
214
+ "channel": "#alerts",
215
+ "text": "New Stripe customer: {{payload.data.object.name}} ({{payload.data.object.email}})",
216
+ "blocks": [
217
+ {
218
+ "type": "header",
219
+ "text": { "type": "plain_text", "text": ":tada: New Stripe Customer", "emoji": true }
220
+ },
221
+ {
222
+ "type": "section",
223
+ "fields": [
224
+ { "type": "mrkdwn", "text": "*Name:*\n{{payload.data.object.name}}" },
225
+ { "type": "mrkdwn", "text": "*Email:*\n{{payload.data.object.email}}" }
226
+ ]
227
+ },
228
+ {
229
+ "type": "section",
230
+ "fields": [
231
+ { "type": "mrkdwn", "text": "*Customer ID:*\n`{{payload.data.object.id}}`" },
232
+ { "type": "mrkdwn", "text": "*Created:*\n<!date^{{payload.data.object.created}}^{date_short} at {time}|{{payload.data.object.created}}>" }
233
+ ]
234
+ },
235
+ {
236
+ "type": "divider"
237
+ },
238
+ {
239
+ "type": "context",
240
+ "elements": [
241
+ { "type": "mrkdwn", "text": "Via One Webhook Relay · {{platform}}" }
242
+ ]
243
+ }
244
+ ]
245
+ },
246
+ "eventFilters": ["customer.created"]
247
+ }]'
248
+ ```
249
+
250
+ ## Commands Reference
251
+
252
+ ```bash
253
+ # Create a relay endpoint
254
+ one --agent relay create --connection-key <key> [--description <desc>] [--event-filters <json>] [--create-webhook]
255
+
256
+ # List all relay endpoints
257
+ one --agent relay list [--limit <n>] [--page <n>]
258
+
259
+ # Get relay endpoint details
260
+ one --agent relay get <id>
261
+
262
+ # Update a relay endpoint (including actions)
263
+ one --agent relay update <id> [--actions <json>] [--description <desc>] [--event-filters <json>] [--active] [--no-active]
264
+
265
+ # Delete a relay endpoint
266
+ one --agent relay delete <id>
267
+
268
+ # Activate a relay endpoint with actions
269
+ one --agent relay activate <id> --actions <json> [--webhook-secret <secret>]
270
+
271
+ # List supported event types for a platform
272
+ one --agent relay event-types <platform>
273
+
274
+ # List received webhook events
275
+ one --agent relay events [--platform <p>] [--event-type <t>] [--limit <n>] [--after <iso>] [--before <iso>]
276
+
277
+ # Get a specific event (includes full payload)
278
+ one --agent relay event <id>
279
+
280
+ # List delivery attempts
281
+ one --agent relay deliveries --endpoint-id <id>
282
+ one --agent relay deliveries --event-id <id>
283
+ ```
284
+
285
+ ## Debugging
286
+
287
+ If a relay isn't working:
288
+
289
+ 1. **Check the endpoint is active:** `one --agent relay get <id>` — verify `active: true` and actions are configured
290
+ 2. **Check events are arriving:** `one --agent relay events --platform <p> --limit 5` — if no events, the webhook isn't registered with the source platform (use `--create-webhook` on create)
291
+ 3. **Check delivery status:** `one --agent relay deliveries --event-id <id>` — shows status, status code, and error for each delivery attempt
292
+ 4. **Inspect the event payload:** `one --agent relay event <id>` — see the full payload to verify your template paths are correct
293
+
294
+ ## Important Notes
295
+
296
+ - **Always use `--agent` flag** for structured JSON output
297
+ - **Always use `--create-webhook`** when creating relay endpoints — it automatically registers the webhook URL with the source platform
298
+ - **Always check `actions knowledge`** for both source and destination platforms before building templates — the source knowledge tells you the `{{payload.*}}` paths, the destination knowledge tells you the required body fields
299
+ - Platform names are **kebab-case** (e.g., `hub-spot`, not `HubSpot`)
300
+ - Connection keys are passed as values, not hardcoded — use the exact keys from `one connection list`
301
+ - Event filters on both the endpoint and individual actions must match — if the endpoint filters to `["customer.created"]`, the action's eventFilters should include `"customer.created"`
302
+ - Multiple actions can be attached to a single relay endpoint — each can forward to a different platform
303
+ - Missing template variables resolve to empty strings — verify your `{{payload.*}}` paths against the actual webhook payload structure