@crvouga/mockingbird-service-intercom 1.0.0 → 1.1.1

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/CHANGELOG.md CHANGED
@@ -1,15 +1,24 @@
1
1
  # Changelog — @crvouga/mockingbird-service-intercom
2
2
 
3
+ ## 1.1.1 (2026-09-26)
4
+
5
+ ### Fixes and improvements
6
+
7
+ - take the rejected-request byte count from content-length, never by reading the body ([a0e5fb2](https://github.com/crvouga/mockingbird/commit/a0e5fb2fc80ab725c3552b612f3f091fd6c857fb))
8
+ - reject a present body by media type, and log what a rejected request sent ([12e351a](https://github.com/crvouga/mockingbird/commit/12e351aba53cfb7b41e31a7809419455fc2902eb))
9
+
10
+ ## 1.1.0 (2026-09-25)
11
+
12
+ ### Features
13
+
14
+ - metadata-only outbox, opt-in member webhook topics, and promote to ready ([4d635e9](https://github.com/crvouga/mockingbird/commit/4d635e90e1938dd5814ac33c10c92c768321a15b))
15
+
3
16
  ## 1.0.0 (2026-09-24)
4
17
 
5
18
  ### ⚠️ Breaking changes
6
19
 
7
20
  - vendor branding for every service; purge internal mocks and consumer names ([f689534](https://github.com/crvouga/mockingbird/commit/f6895343543550dafcb7d76b426cae7635e03226))
8
21
 
9
- ### Dependencies
10
-
11
- - `@crvouga/mockingbird-service-sqlite`
12
-
13
22
  ## 0.2.0 (2026-09-23)
14
23
 
15
24
  ### Features
package/README.md CHANGED
@@ -9,7 +9,8 @@ our backend makes:
9
9
  `?display_as=plaintext`, and cursor-paginated search;
10
10
  - **identity:** `/admins` and `/me`.
11
11
 
12
- Admin replies and close/open send Intercom's `notification_event` webhooks, signed with
12
+ Admin replies and close/open (and, for a receiver that subscribes to them, member messages and
13
+ replies) send Intercom's `notification_event` webhooks, signed with
13
14
  `X-Hub-Signature: sha1=<hex HMAC-SHA1>`, to both of our receivers: the backend's
14
15
  `POST /messaging/webhook` and the EMR's `POST /v1/webhooks/intercom`.
15
16
 
@@ -36,6 +37,10 @@ npx mockingbird-intercom serve --port 8807 \
36
37
  --webhook-secret "$INTERCOM_WEBHOOK_SECRET"
37
38
  ```
38
39
 
40
+ Add `--webhook-events conversation.user.created,conversation.user.replied,conversation.admin.replied,conversation.admin.closed,conversation.admin.opened`
41
+ to subscribe `--webhook-url` to the member topics too; `--emr-webhook-url` keeps the admin-only
42
+ default.
43
+
39
44
  | Consumer | Setting |
40
45
  | --- | --- |
41
46
  | Member messaging adapter (`intercom-messaging.adapter.ts`) | `INTERCOM_API_BASE_URL=http://127.0.0.1:8807` (already read), `INTERCOM_ACCESS_TOKEN=<any>` |
@@ -124,11 +129,14 @@ The mock sends webhooks for these events:
124
129
  | Close (`/parts` or `POST /__admin/conversations/:id/close`) | `conversation.admin.closed` |
125
130
  | Open (`/parts` or `POST /__admin/conversations/:id/open`) | `conversation.admin.opened` |
126
131
  | Admin-initiated conversation (`POST /__admin/conversations`) | `conversation.admin.single.created` |
132
+ | Member starts a conversation (`POST /conversations`) | `conversation.user.created` (opt-in) |
133
+ | Member reply (`/reply` with `type: "user"`) | `conversation.user.replied` (opt-in) |
127
134
 
128
- Snooze and assignment publish `conversation.admin.snoozed` and `.assigned`, but the default
129
- endpoints do not subscribe to them. Member messages and notes send nothing: the EMR treats every
130
- `notification_event` it receives as an admin event, so a real subscription must not include
131
- member topics either.
135
+ An endpoint receives the four admin topics above unless it lists its own `events`. The member
136
+ topics, `conversation.admin.snoozed` and `.assigned` are published but opt-in: subscribe with
137
+ `--webhook-events`, `webhooks.urls: [{url, events}]` or `PUT /__admin/webhook-endpoints`. The EMR
138
+ treats every `notification_event` it receives as an admin event, so its subscription must not
139
+ include member topics. Notes send nothing.
132
140
 
133
141
  Each delivery is a JSON body posted with `X-Hub-Signature: sha1=<hex HMAC-SHA1(secret, rawBody)>`:
134
142
 
@@ -156,7 +164,8 @@ Each delivery is a JSON body posted with `X-Hub-Signature: sha1=<hex HMAC-SHA1(s
156
164
 
157
165
  | Route | Effect |
158
166
  | --- | --- |
159
- | `POST /__admin/conversations/:id/admin-reply` | `{adminId? (default: first admin), body, messageType?: "comment" \| "note"}` appends an admin part and fires the webhook. |
167
+ | `POST /__admin/conversations/:id/admin-reply` | `{adminId? \| admin_id? (default: first admin), body, messageType?: "comment" \| "note"}` appends an admin part ("the care team replied") and fires the webhook. |
168
+ | `GET /__admin/outbox?since=&to=&limit=`, `GET /__admin/outbox/:id` | What the client sent through `POST /conversations` and `/reply`, oldest first: `{id, operation, conversationId, contactId, partId, partType ("source" for the opening message), authorType, authorId, hasBody, bodyLength, attachmentCount, at, createdAt}`. **Metadata only**: the body is never stored. `to=` matches the conversation or contact id; `since=` takes epoch ms or ISO-8601 on the mock clock. The admin plane's own replies are not listed. |
160
169
  | `POST /__admin/conversations/:id/close`, `…/open` | `{adminId?}` closes or reopens as an admin and fires the webhook. |
161
170
  | `POST /__admin/conversations` | `{contactId \| externalId, adminId?, body}` creates an admin-initiated conversation. The EMR then looks the member up by `contacts[0].external_id`. |
162
171
  | `GET /__admin/conversations`, `GET /__admin/contacts` | The namespace's records. |
@@ -205,14 +214,14 @@ never records message bodies or contact details.
205
214
  | --- | --- | --- |
206
215
  | `IntercomAPI` | class | The in-process mock: `fetch(request)`, `reset()`, `appendPart(…)`, `manage(…)`, `startAdminConversation(…)`, `conversations()`, `contacts()`, `conversationBody(…)`, `contactBody(…)`, `error(…)`, `state`. Options: `sqlite`, `now`, `wallClock`, `namespace`, `admins`, `settings`, `onWebhook`. |
207
216
  | `IntercomError` | class | A vendor error (status, code, message) raised by the admin-facing methods. |
208
- | `createRuntime` | function | The mock with the full service contract (health, admin, namespaces, credentials, presets, webhooks). Options: `webhooks: {urls, secret?, events?, retryDelaysMs?, fetch?}`, `admins`, `settings`, `clock`, `wallClock`, `seed`, `adminKey`, `onLog`, `sqlite`. |
217
+ | `createRuntime` | function | The mock with the full service contract (health, admin, namespaces, credentials, presets, webhooks). Options: `webhooks: {urls, secret?, events?, retryDelaysMs?, fetch?}` (a `urls` entry may be `{url, events}` to override `events` for that URL), `admins`, `settings`, `clock`, `wallClock`, `seed`, `adminKey`, `onLog`, `sqlite`. |
209
218
  | `INTERCOM_PRESETS` | object | Every named fault preset. |
210
219
  | `INTERCOM_NAMESPACE` | string | The service name, `"intercom"`. |
211
- | `INTERCOM_TOPICS` | array | Every webhook topic the mock can send. |
220
+ | `INTERCOM_TOPICS` | array | Every webhook topic the mock can send, including the opt-in member topics. |
212
221
  | `HUB_SIGNATURE_HEADER`, `signHub` | values | `X-Hub-Signature` and the `sha1=<hex>` signer, for your own receivers. |
213
222
  | `DEFAULT_ADMINS`, `DEFAULT_SETTINGS` | values | The seeded admins and default settings. |
214
223
  | `toHtml`, `toPlaintext`, `encodeCursor`, `decodeCursor` | functions | Body rendering and the search cursor format. |
215
224
  | `document`, `operationIds`, `supportedOperationIds` | values | The vendored OpenAPI contract and its operation ids. |
216
- | `createServer`, `serveTarget`, `DEFAULT_PORT` (`./server`) | Node | Serve over `node:http`; the `serve` CLI target (`--webhook-url`, `--emr-webhook-url`, `--webhook-secret`, `--access-token`); port 8807. |
225
+ | `createServer`, `serveTarget`, `DEFAULT_PORT` (`./server`) | Node | Serve over `node:http`; the `serve` CLI target (`--webhook-url`, `--webhook-events`, `--emr-webhook-url`, `--webhook-secret`, `--access-token`); port 8807. |
217
226
 
218
227
  Part of [mockingbird](https://github.com/crvouga/mockingbird).