kenso 0.1.42 → 0.1.43

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/docs/README.md CHANGED
@@ -64,6 +64,7 @@ Every page is in the package and prints offline with `kenso docs <topic>`.
64
64
  | [CRM (beta)](crm.md) | `crm` | Accounts, people, opportunities and CRM sync |
65
65
  | [Studio (beta)](studio.md) | `studio` | Pull, push, validate, preview and fill templates |
66
66
  | [Agent work (beta)](work.md) | `work` | My agent: your own coding agent writes Kenso AI work with `kenso work run`, or pull and submit |
67
+ | [Webhooks](webhooks.md) | `webhooks` | Build a webhook handler locally: `kenso webhooks listen --forward-to`, `trigger`, the signature |
67
68
  | [Coding agents](agents.md) | `agents` | Claude Code, Codex, Cursor, the Agent Skill, environment variables, sandboxes |
68
69
  | Command reference | `reference` | Every command with its flags, generated from the CLI at build time: `kenso docs reference`, or `docs/reference.md` in the installed package |
69
70
 
package/docs/reference.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Kenso CLI command reference
2
2
 
3
- Generated from kenso 0.1.42 (API contracts 5dc7eaafef1a) by `scripts/build-reference.ts`. Do not edit it: `pnpm build` writes it again.
3
+ Generated from kenso 0.1.43 (API contracts 5dc7eaafef1a) by `scripts/build-reference.ts`. Do not edit it: `pnpm build` writes it again.
4
4
 
5
- 1603 commands, one entry each: summary, API route, feature gate and flag names. Beta commands work only on workspaces with their feature flag; `kenso describe` hides the ones yours cannot use. Every command also takes the global flags below. A command's notes, flag descriptions, body schema and examples: `kenso <resource> <action> --help`, or `kenso describe <resource> <action>` as JSON.
5
+ 1605 commands, one entry each: summary, API route, feature gate and flag names. Beta commands work only on workspaces with their feature flag; `kenso describe` hides the ones yours cannot use. Every command also takes the global flags below. A command's notes, flag descriptions, body schema and examples: `kenso <resource> <action> --help`, or `kenso describe <resource> <action>` as JSON.
6
6
 
7
7
  ## Global flags
8
8
 
@@ -402,6 +402,7 @@ Exit codes: 0 ok, 1 error, 2 usage, 3 auth, 4 not found, 5 some rows failed, 6 r
402
402
  - [webhook-deliveries](#webhook-deliveries) (2)
403
403
  - [webhook-endpoints](#webhook-endpoints) (8)
404
404
  - [webhook-event-types](#webhook-event-types) (1)
405
+ - [webhooks](#webhooks) (2)
405
406
  - [website](#website) (8)
406
407
  - [whatsapp-accounts](#whatsapp-accounts) (5)
407
408
  - [whatsapp-settings](#whatsapp-settings) (2)
@@ -10050,6 +10051,20 @@ List webhook event types. `GET /v1/webhook-event-types`.
10050
10051
 
10051
10052
  Flags: `--each`, `--concurrency`.
10052
10053
 
10054
+ ## webhooks
10055
+
10056
+ ### kenso webhooks listen
10057
+
10058
+ Stream the workspace's events and forward them, signed, to a local handler. `GET /v1/event-occurrences`.
10059
+
10060
+ Flags: `--events`, `--forward-to`, `--print-secret`.
10061
+
10062
+ ### kenso webhooks trigger
10063
+
10064
+ Send a sample event of one type through the running kenso webhooks listen. `GET /v1/webhook-event-types`.
10065
+
10066
+ Arguments: `<event-type>`.
10067
+
10053
10068
  ## website
10054
10069
 
10055
10070
  ### kenso website get
@@ -0,0 +1,86 @@
1
+ # Webhooks: listen and trigger
2
+
3
+ Build and test a webhook handler on your own machine, with no public tunnel and no webhook endpoint in Kenso. `kenso webhooks listen` streams your workspace's events, prints each one as JSON and forwards it to your handler, signed the way Kenso signs its deliveries. `kenso webhooks trigger` sends a sample event through the running listener.
4
+
5
+ | Command | What it does |
6
+ |---|---|
7
+ | `webhooks listen --forward-to <url>` | Streams events, prints one JSON line each, and POSTs each to your handler |
8
+ | `webhooks listen --print-secret` | Prints the local signing secret and exits |
9
+ | `webhooks trigger <event-type>` | Sends that type's sample through the running listener |
10
+
11
+ ## Quick start
12
+
13
+ In one terminal:
14
+
15
+ ```bash
16
+ kenso webhooks listen --forward-to http://localhost:3000/hook
17
+ ```
18
+
19
+ It prints its signing secret on stderr:
20
+
21
+ ```
22
+ Ready. Forwarding events to http://localhost:3000/hook.
23
+ Signing secret: whsec_... (the same on every run; kept in ~/.kenso/webhooks/signing-secret).
24
+ ```
25
+
26
+ Put that secret in your handler's config (for example `KENSO_WEBHOOK_SECRET`). In another terminal:
27
+
28
+ ```bash
29
+ kenso webhooks trigger reply.received
30
+ ```
31
+
32
+ The listener prints the event and your handler receives it. `kenso webhook-event-types list` lists every type with its sample body.
33
+
34
+ ## What your handler receives
35
+
36
+ Each forward is a `POST` with a JSON body shaped like a webhook delivery (no envelope, `eventType` at the top) and the headers a Kenso delivery carries. How full the body is depends on where the event came from:
37
+
38
+ - **A trigger** sends the type's full sample body, the same shape a webhook endpoint receives in production.
39
+ - **A live event** is sparse. The event log keeps only part of each delivery, so the body has `eventType`, `eventId`, `timestamp` and `clientId`, plus the ids, statuses and `links` at their delivery paths (`contact.id`, `campaign.id`, `reply.classification`, ...). Names, emails, reply text and the other fields are not there: read them with the API, or build that part of the handler against a trigger's sample.
40
+
41
+ The headers:
42
+
43
+ | Header | Value |
44
+ |---|---|
45
+ | `svix-id` | The event's id. Dedupe on it |
46
+ | `svix-timestamp` | Unix seconds of the send |
47
+ | `svix-signature` | `v1,` and the base64 HMAC-SHA256 of `{svix-id}.{svix-timestamp}.{body}`, keyed by the secret |
48
+ | `content-type` | `application/json` |
49
+
50
+ So the verification code you write for production works unchanged: the Svix libraries (`svix` for Node, Python, Go and others) and the check in the Webhooks section of the Kenso API docs accept these deliveries. Only the secret differs. The listener's secret is local: it is made on your machine the first time you run `listen`, stays the same on every run, and is never a real endpoint's secret. In production, use your endpoint's secret from `kenso webhook-endpoints get-signing-secret --webhook-endpoint-id <webhookEndpointId>`.
51
+
52
+ For scripts, take the secret without starting a listener:
53
+
54
+ ```bash
55
+ export KENSO_WEBHOOK_SECRET=$(kenso webhooks listen --print-secret)
56
+ ```
57
+
58
+ ## Output
59
+
60
+ stdout gets one JSON line per event, for `jq` or an agent:
61
+
62
+ ```json
63
+ {"eventId":"0b6f...","type":"reply.received","timestamp":"2026-11-15T10:00:00Z","source":"live","forward":{"url":"http://localhost:3000/hook","status":200,"ms":12},"data":{"eventType":"reply.received","...":"..."}}
64
+ ```
65
+
66
+ - `source` is `live` for a real event and `trigger` for a sample.
67
+ - `forward` is what your handler answered: `status`, or `error` (`ECONNREFUSED` when nothing listens there). It is absent without `--forward-to`.
68
+ - `data` is the body your handler received (or would receive, without `--forward-to`).
69
+
70
+ The ready line, the secret and the summary at Ctrl-C go to stderr.
71
+
72
+ ## Live events
73
+
74
+ `listen` reads the workspace's event log (`GET /v1/event-occurrences`), so it receives the types with `mcp: true` in `kenso webhook-event-types list` that your seat can see. It polls the log, so a real event arrives within about 30 s; a trigger arrives at once. `--events reply.received,meeting.booked` (or `--events` repeated) narrows the types.
75
+
76
+ The event log is not on for every workspace yet. Where it is off, `listen` says so in a warning and still forwards everything you trigger, so you can build the handler first.
77
+
78
+ ## Triggers
79
+
80
+ `trigger` takes the type's sample from `GET /v1/webhook-event-types`, gives it a new `eventId` (`evt_test_...`) and the current `timestamp`, and hands it to the listener for this workspace, which prints and forwards it like a live event. It sends nothing to Kenso's event log, to your webhook endpoints or to anyone else. It exits 1 with `forward_failed` when your handler did not answer 2xx, and with `listener_not_running` when no listener runs for the workspace.
81
+
82
+ To send a sample to a real, deployed endpoint instead, use `kenso webhook-endpoints test --webhook-endpoint-id <webhookEndpointId> --event-type reply.received`.
83
+
84
+ ## Stopping
85
+
86
+ Ctrl-C stops the listener. `listen` creates no webhook endpoint, no event subscription and no tunnel, so there is nothing to delete in Kenso. Its polls do keep the workspace's event log recording: the log stops on its own 7 days after the last poll. A poll that fails (a network error, a 5xx) prints a warning and is tried again a minute later; a bad key or a refused request ends the listener. It removes its local state file (the address `trigger` uses) on the way out.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kenso",
3
- "version": "0.1.42",
3
+ "version": "0.1.43",
4
4
  "description": "The Kenso CLI: bulk lead, CRM and Studio work for people and coding agents",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -44,5 +44,5 @@
44
44
  "typescript-eslint": "8.71.1",
45
45
  "vitest": "5.0.3"
46
46
  },
47
- "gitHead": "381c3e47cf4b649d89205812f16430e66ffc51b8"
47
+ "gitHead": "aa4779760528d8e7201bcf9c5450a03cd2153e18"
48
48
  }