@withone/cli 1.36.0 → 1.37.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/dist/index.js +34 -3
- package/package.json +1 -1
- package/skills/one/references/relay.md +23 -0
package/dist/index.js
CHANGED
|
@@ -4334,6 +4334,7 @@ async function relayCreateCommand(options) {
|
|
|
4334
4334
|
if (options.description) body.description = options.description;
|
|
4335
4335
|
if (options.eventFilters) body.eventFilters = parseJsonArg2(options.eventFilters, "--event-filters");
|
|
4336
4336
|
if (options.tags) body.tags = parseJsonArg2(options.tags, "--tags");
|
|
4337
|
+
if (options.metadata) body.metadata = parseJsonArg2(options.metadata, "--metadata");
|
|
4337
4338
|
if (options.createWebhook) body.createWebhook = true;
|
|
4338
4339
|
const result = await api.createRelayEndpoint(body);
|
|
4339
4340
|
if (isAgentMode()) {
|
|
@@ -4348,6 +4349,10 @@ async function relayCreateCommand(options) {
|
|
|
4348
4349
|
if (result.description) console.log(` ${pc8.dim("Description:")} ${result.description}`);
|
|
4349
4350
|
if (result.eventFilters?.length) console.log(` ${pc8.dim("Events:")} ${result.eventFilters.join(", ")}`);
|
|
4350
4351
|
if (result.webhookPayload?.id) console.log(` ${pc8.dim("Webhook ID:")} ${result.webhookPayload.id}`);
|
|
4352
|
+
if (result.warning) {
|
|
4353
|
+
console.log();
|
|
4354
|
+
console.log(` ${pc8.yellow("\u26A0 Warning:")} ${result.warning}`);
|
|
4355
|
+
}
|
|
4351
4356
|
console.log();
|
|
4352
4357
|
} catch (error2) {
|
|
4353
4358
|
spinner6.stop("Failed to create relay endpoint");
|
|
@@ -8201,8 +8206,32 @@ one --agent relay deliveries --endpoint-id <id> # Check delivery status
|
|
|
8201
8206
|
2. **Get event types** \u2014 \`one --agent relay event-types <platform>\`
|
|
8202
8207
|
3. **Get source knowledge** \u2014 understand the incoming webhook payload shape (\`{{payload.*}}\` paths)
|
|
8203
8208
|
4. **Get destination knowledge** \u2014 understand the outgoing API body shape
|
|
8204
|
-
5. **Create endpoint** \u2014 with \`--create-webhook
|
|
8205
|
-
6. **Activate** \u2014 with passthrough action mapping source fields to destination fields
|
|
8209
|
+
5. **Create endpoint** \u2014 with \`--create-webhook\`, \`--event-filters\`, and \`--metadata\` if the source platform requires it
|
|
8210
|
+
6. **Activate** \u2014 with passthrough action mapping source fields to destination fields. **Do NOT pass \`--webhook-secret\`** when the endpoint was created with \`--create-webhook\` \u2014 the correct secret is auto-stored, and supplying a wrong one silently drops every delivery (events arrive, 0 deliveries).
|
|
8211
|
+
|
|
8212
|
+
## Platform-Specific Metadata (\`--metadata\`)
|
|
8213
|
+
|
|
8214
|
+
Some source platforms need extra identifiers to register a webhook. Pass these via \`--metadata '<json>'\` on \`relay create\`. Without them, \`--create-webhook\` silently fails:
|
|
8215
|
+
|
|
8216
|
+
| Platform | Required metadata keys |
|
|
8217
|
+
|---|---|
|
|
8218
|
+
| \`github\` | \`GITHUB_OWNER\`, \`GITHUB_REPOSITORY\` |
|
|
8219
|
+
| \`typeform\` | \`TYPEFORM_FORM_ID\` |
|
|
8220
|
+
| \`stripe\` | (none) |
|
|
8221
|
+
| \`airtable\` | (none) |
|
|
8222
|
+
| \`attio\` | (none) |
|
|
8223
|
+
| \`google-calendar\` | (none) |
|
|
8224
|
+
|
|
8225
|
+
Example (GitHub):
|
|
8226
|
+
|
|
8227
|
+
\`\`\`bash
|
|
8228
|
+
one --agent relay create \\
|
|
8229
|
+
--connection-key "live::github::default::<key>" \\
|
|
8230
|
+
--event-filters '["issues","pull_request"]' \\
|
|
8231
|
+
--metadata '{"GITHUB_OWNER":"my-org","GITHUB_REPOSITORY":"my-repo"}' \\
|
|
8232
|
+
--description "GitHub relay" \\
|
|
8233
|
+
--create-webhook
|
|
8234
|
+
\`\`\`
|
|
8206
8235
|
|
|
8207
8236
|
## Template Context
|
|
8208
8237
|
|
|
@@ -8253,6 +8282,8 @@ Any connected platform can be a destination via passthrough actions.
|
|
|
8253
8282
|
2. \`relay events --platform <p>\` \u2014 check events are arriving
|
|
8254
8283
|
3. \`relay deliveries --event-id <id>\` \u2014 check delivery status and errors
|
|
8255
8284
|
4. \`relay event <id>\` \u2014 inspect full payload to verify template paths
|
|
8285
|
+
|
|
8286
|
+
**If events arrive but 0 deliveries succeed**: you likely passed a wrong \`--webhook-secret\` on \`relay activate\`. When you created the endpoint with \`--create-webhook\`, the secret was registered with the source platform and stored automatically \u2014 do not pass it again on activate. Signature verification will fail silently and every event will be dropped.
|
|
8256
8287
|
`;
|
|
8257
8288
|
var GUIDE_CACHE = `# One Cache \u2014 Reference
|
|
8258
8289
|
|
|
@@ -9416,7 +9447,7 @@ flow.command("scaffold [template]").description("Generate a workflow scaffold (t
|
|
|
9416
9447
|
await flowScaffoldCommand(template);
|
|
9417
9448
|
});
|
|
9418
9449
|
var relay = program.command("relay").alias("r").description("Receive webhooks from platforms and relay them via passthrough actions");
|
|
9419
|
-
relay.command("create").description("Create a new relay endpoint for a connection").requiredOption("--connection-key <key>", "Connection key for the source platform").option("--description <desc>", "Description of the relay endpoint").option("--event-filters <json>", `JSON array of event types to filter (e.g. '["customer.created"]')`).option("--tags <json>", "JSON array of tags").option("--create-webhook", "Automatically register the webhook with the source platform").action(async (options) => {
|
|
9450
|
+
relay.command("create").description("Create a new relay endpoint for a connection").requiredOption("--connection-key <key>", "Connection key for the source platform").option("--description <desc>", "Description of the relay endpoint").option("--event-filters <json>", `JSON array of event types to filter (e.g. '["customer.created"]')`).option("--tags <json>", "JSON array of tags").option("--metadata <json>", `JSON object of platform-specific metadata required to register the webhook (e.g. GitHub: '{"GITHUB_OWNER":"org","GITHUB_REPOSITORY":"repo"}', Typeform: '{"TYPEFORM_FORM_ID":"abc"}')`).option("--create-webhook", "Automatically register the webhook with the source platform").action(async (options) => {
|
|
9420
9451
|
await relayCreateCommand(options);
|
|
9421
9452
|
});
|
|
9422
9453
|
relay.command("list").alias("ls").description("List all relay endpoints").option("--limit <n>", "Max results per page").option("--page <n>", "Page number").action(async (options) => {
|
package/package.json
CHANGED
|
@@ -52,6 +52,25 @@ one --agent relay create \
|
|
|
52
52
|
|
|
53
53
|
Always use `--create-webhook` — it registers the webhook URL with the source platform automatically.
|
|
54
54
|
|
|
55
|
+
**Some source platforms require extra identifiers via `--metadata`:**
|
|
56
|
+
|
|
57
|
+
| Platform | Required metadata keys |
|
|
58
|
+
|---|---|
|
|
59
|
+
| `github` | `GITHUB_OWNER`, `GITHUB_REPOSITORY` |
|
|
60
|
+
| `typeform` | `TYPEFORM_FORM_ID` |
|
|
61
|
+
| `stripe`, `airtable`, `attio`, `google-calendar` | (none) |
|
|
62
|
+
|
|
63
|
+
Without metadata, `--create-webhook` silently fails for these platforms. Example for GitHub:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
one --agent relay create \
|
|
67
|
+
--connection-key "live::github::default::<key>" \
|
|
68
|
+
--event-filters '["issues","pull_request"]' \
|
|
69
|
+
--metadata '{"GITHUB_OWNER":"my-org","GITHUB_REPOSITORY":"my-repo"}' \
|
|
70
|
+
--description "GitHub relay" \
|
|
71
|
+
--create-webhook
|
|
72
|
+
```
|
|
73
|
+
|
|
55
74
|
### Step 6: Activate with a passthrough action
|
|
56
75
|
|
|
57
76
|
```bash
|
|
@@ -66,6 +85,8 @@ one --agent relay activate <relay-id> --actions '[{
|
|
|
66
85
|
}]'
|
|
67
86
|
```
|
|
68
87
|
|
|
88
|
+
**Do NOT pass `--webhook-secret` on activate** when you created the endpoint with `--create-webhook`. The correct secret is registered with the source platform and stored automatically. Supplying a wrong one does not error — events arrive but every delivery is dropped during signature verification (0 deliveries). If you don't have a reason to override the secret, omit the flag.
|
|
89
|
+
|
|
69
90
|
## Template Context
|
|
70
91
|
|
|
71
92
|
| Variable | Description |
|
|
@@ -177,3 +198,5 @@ one --agent relay deliveries --event-id <id>
|
|
|
177
198
|
- Event filters on both the endpoint and individual actions must match
|
|
178
199
|
- Multiple actions can be attached to a single relay endpoint
|
|
179
200
|
- Missing template variables resolve to empty strings — verify `{{payload.*}}` paths against the actual payload
|
|
201
|
+
- GitHub and Typeform relays require `--metadata` on create; without it `--create-webhook` silently fails
|
|
202
|
+
- Never pass `--webhook-secret` on activate when the endpoint was created with `--create-webhook` — the auto-stored secret is correct, and a wrong one causes signature verification to drop every event silently
|