@pilot-status/sdk 0.4.0 → 0.8.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.
Files changed (124) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +203 -17
  3. package/dist/client.d.ts +53 -2
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +54 -4
  6. package/dist/client.js.map +1 -1
  7. package/dist/errors.d.ts +58 -0
  8. package/dist/errors.d.ts.map +1 -1
  9. package/dist/errors.js +65 -0
  10. package/dist/errors.js.map +1 -1
  11. package/dist/http.d.ts +7 -1
  12. package/dist/http.d.ts.map +1 -1
  13. package/dist/http.js +3 -0
  14. package/dist/http.js.map +1 -1
  15. package/dist/index.d.ts +12 -5
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +10 -3
  18. package/dist/index.js.map +1 -1
  19. package/dist/internal.d.ts +19 -0
  20. package/dist/internal.d.ts.map +1 -0
  21. package/dist/internal.js +27 -0
  22. package/dist/internal.js.map +1 -0
  23. package/dist/resources/api-keys.d.ts +20 -7
  24. package/dist/resources/api-keys.d.ts.map +1 -1
  25. package/dist/resources/api-keys.js +18 -5
  26. package/dist/resources/api-keys.js.map +1 -1
  27. package/dist/resources/billing.d.ts +18 -0
  28. package/dist/resources/billing.d.ts.map +1 -0
  29. package/dist/resources/billing.js +30 -0
  30. package/dist/resources/billing.js.map +1 -0
  31. package/dist/resources/branding.d.ts +18 -0
  32. package/dist/resources/branding.d.ts.map +1 -0
  33. package/dist/resources/branding.js +29 -0
  34. package/dist/resources/branding.js.map +1 -0
  35. package/dist/resources/chatwoot.d.ts +57 -0
  36. package/dist/resources/chatwoot.d.ts.map +1 -0
  37. package/dist/resources/chatwoot.js +117 -0
  38. package/dist/resources/chatwoot.js.map +1 -0
  39. package/dist/resources/conversations.d.ts +16 -0
  40. package/dist/resources/conversations.d.ts.map +1 -0
  41. package/dist/resources/conversations.js +28 -0
  42. package/dist/resources/conversations.js.map +1 -0
  43. package/dist/resources/embed.d.ts +24 -0
  44. package/dist/resources/embed.d.ts.map +1 -0
  45. package/dist/resources/embed.js +37 -0
  46. package/dist/resources/embed.js.map +1 -0
  47. package/dist/resources/flows.d.ts +203 -0
  48. package/dist/resources/flows.d.ts.map +1 -0
  49. package/dist/resources/flows.js +289 -0
  50. package/dist/resources/flows.js.map +1 -0
  51. package/dist/resources/groups.d.ts +37 -1
  52. package/dist/resources/groups.d.ts.map +1 -1
  53. package/dist/resources/groups.js +91 -0
  54. package/dist/resources/groups.js.map +1 -1
  55. package/dist/resources/messages.d.ts +61 -1
  56. package/dist/resources/messages.d.ts.map +1 -1
  57. package/dist/resources/messages.js +134 -1
  58. package/dist/resources/messages.js.map +1 -1
  59. package/dist/resources/meta.d.ts +19 -0
  60. package/dist/resources/meta.d.ts.map +1 -0
  61. package/dist/resources/meta.js +31 -0
  62. package/dist/resources/meta.js.map +1 -0
  63. package/dist/resources/numbers.d.ts +102 -1
  64. package/dist/resources/numbers.d.ts.map +1 -1
  65. package/dist/resources/numbers.js +152 -0
  66. package/dist/resources/numbers.js.map +1 -1
  67. package/dist/resources/service-window.d.ts +20 -0
  68. package/dist/resources/service-window.d.ts.map +1 -0
  69. package/dist/resources/service-window.js +26 -0
  70. package/dist/resources/service-window.js.map +1 -0
  71. package/dist/resources/subscription.d.ts +43 -0
  72. package/dist/resources/subscription.d.ts.map +1 -0
  73. package/dist/resources/subscription.js +60 -0
  74. package/dist/resources/subscription.js.map +1 -0
  75. package/dist/resources/templates.d.ts +31 -1
  76. package/dist/resources/templates.d.ts.map +1 -1
  77. package/dist/resources/templates.js +56 -0
  78. package/dist/resources/templates.js.map +1 -1
  79. package/dist/resources/webhooks.d.ts +53 -0
  80. package/dist/resources/webhooks.d.ts.map +1 -0
  81. package/dist/resources/webhooks.js +97 -0
  82. package/dist/resources/webhooks.js.map +1 -0
  83. package/dist/resources/workspace.d.ts +57 -0
  84. package/dist/resources/workspace.d.ts.map +1 -0
  85. package/dist/resources/workspace.js +73 -0
  86. package/dist/resources/workspace.js.map +1 -0
  87. package/dist/types.d.ts +957 -21
  88. package/dist/types.d.ts.map +1 -1
  89. package/dist/types.js.map +1 -1
  90. package/dist/webhooks/parse.d.ts +16 -0
  91. package/dist/webhooks/parse.d.ts.map +1 -1
  92. package/dist/webhooks/parse.js +49 -0
  93. package/dist/webhooks/parse.js.map +1 -1
  94. package/dist/webhooks/signature.d.ts +42 -0
  95. package/dist/webhooks/signature.d.ts.map +1 -0
  96. package/dist/webhooks/signature.js +40 -0
  97. package/dist/webhooks/signature.js.map +1 -0
  98. package/dist/webhooks/types.d.ts +59 -1
  99. package/dist/webhooks/types.d.ts.map +1 -1
  100. package/package.json +5 -3
  101. package/dist/messages.test.d.ts +0 -2
  102. package/dist/messages.test.d.ts.map +0 -1
  103. package/dist/messages.test.js +0 -107
  104. package/dist/messages.test.js.map +0 -1
  105. package/dist/numbers.test.d.ts +0 -2
  106. package/dist/numbers.test.d.ts.map +0 -1
  107. package/dist/numbers.test.js +0 -57
  108. package/dist/numbers.test.js.map +0 -1
  109. package/dist/resources/groups.test.d.ts +0 -2
  110. package/dist/resources/groups.test.d.ts.map +0 -1
  111. package/dist/resources/groups.test.js +0 -19
  112. package/dist/resources/groups.test.js.map +0 -1
  113. package/dist/resources/newsletters.test.d.ts +0 -2
  114. package/dist/resources/newsletters.test.d.ts.map +0 -1
  115. package/dist/resources/newsletters.test.js +0 -19
  116. package/dist/resources/newsletters.test.js.map +0 -1
  117. package/dist/resources/projects.d.ts +0 -9
  118. package/dist/resources/projects.d.ts.map +0 -1
  119. package/dist/resources/projects.js +0 -23
  120. package/dist/resources/projects.js.map +0 -1
  121. package/dist/resources/templates.test.d.ts +0 -2
  122. package/dist/resources/templates.test.d.ts.map +0 -1
  123. package/dist/resources/templates.test.js +0 -28
  124. package/dist/resources/templates.test.js.map +0 -1
@@ -0,0 +1,289 @@
1
+ import { PilotStatusHttpError } from "../errors.js";
2
+ import { compact } from "../internal.js";
3
+ /**
4
+ * Meta's `validation_errors` list, pulled out of a thrown `uploadJson` failure.
5
+ *
6
+ * ⛔ THIS IS THE ONE PLACE THE LIST LIVES, AND IT IS NOT IN A SUCCESSFUL RESPONSE.
7
+ * `POST /flows/{id}/assets` on the GRAPH answers HTTP 200 with the errors inside the
8
+ * body — whoever reads the status concludes the upload was accepted, the editor shows
9
+ * "saved", the Flow keeps the PREVIOUS JSON and nobody sees an error until a customer
10
+ * opens the old form in production. OUR route refuses to propagate that shape: a
11
+ * refused JSON is a 422 `FLOW_JSON_INVALID`, which this SDK raises as a
12
+ * {@link PilotStatusHttpError}. So {@link FlowsResource.uploadJson} resolving at all
13
+ * means `validationErrors` was empty; a non-empty list is only ever reachable from the
14
+ * exception, and this function is how you read it without unwrapping `error.body`
15
+ * yourself.
16
+ *
17
+ * ```ts
18
+ * try {
19
+ * await client.flows.uploadJson("flw_1", json);
20
+ * } catch (err) {
21
+ * const problems = flowJsonValidationErrors(err);
22
+ * if (problems) console.error("Meta refused the Flow JSON:", problems);
23
+ * else throw err; // 401/403/404/409/5xx — not a JSON problem
24
+ * }
25
+ * ```
26
+ *
27
+ * Returns `null` — never `[]` — for anything that is not that 422, so "Meta refused
28
+ * the content" stays distinguishable from "the token expired" and from "the Flow is
29
+ * already published". The list itself is Meta's, VERBATIM: it names the line and the
30
+ * component it refused, its shape is theirs to change, and translating it would
31
+ * replace the only text that says what to fix.
32
+ */
33
+ export function flowJsonValidationErrors(error) {
34
+ if (!(error instanceof PilotStatusHttpError))
35
+ return null;
36
+ const body = error.body;
37
+ if (body?.code !== "FLOW_JSON_INVALID")
38
+ return null;
39
+ if (!Array.isArray(body.validationErrors))
40
+ return null;
41
+ return body.validationErrors;
42
+ }
43
+ /**
44
+ * WhatsApp Flows: the forms a customer fills in inside the chat.
45
+ *
46
+ * ⛔ EVERY `{id}` THIS RESOURCE TAKES IS THE LOCAL CUID (`Flow.id`), never Meta's
47
+ * `metaFlowId`. Meta's id is published for correlating with Flow Manager and is never
48
+ * an input: an identifier we do not mint is one we cannot scope to a tenant. The two
49
+ * are both opaque strings, so nothing but a 404 will tell you which one you sent —
50
+ * see `cloneFromFlowId` and `supersededByFlowId`, where the confusion actually costs.
51
+ *
52
+ * ⚠️ NUMBER-SCOPED KEYS ONLY, and the number must be a Meta (Cloud API) one. The WABA
53
+ * is derived from the key's bound number — there is no parameter that names one, and
54
+ * sending `whatsappNumberId`/`wabaId` in any body is REFUSED (400
55
+ * `FLOW_NUMBER_FROM_KEY`), not ignored. Use `client.withNumber(...)` to aim at another
56
+ * number. A non-Meta number answers 422 `FLOW_REQUIRES_META_NUMBER`.
57
+ *
58
+ * The lifecycle is one-way: DRAFT → published → deprecated. Only a DRAFT can be
59
+ * renamed, re-uploaded or deleted; once published, Meta never lets a Flow be edited
60
+ * again and the only revision is a CLONE under a new id.
61
+ */
62
+ export class FlowsResource {
63
+ #http;
64
+ constructor(http) {
65
+ this.#http = http;
66
+ }
67
+ /**
68
+ * The Flows of the WABA behind the key's number, most recently updated first.
69
+ *
70
+ * ⚠️ Answers an ENVELOPE (`{flows, total, page, pageSize, totalPages}`) and not a
71
+ * bare array like `templates.list()`. Deep paging is refused: `page * pageSize`
72
+ * beyond 100 000 is a 400 `FLOW_INVALID_PAGINATION`.
73
+ */
74
+ async list(params) {
75
+ return this.#http.requestJson({
76
+ method: "GET",
77
+ path: "/v1/flows",
78
+ query: compact({
79
+ page: params?.page,
80
+ pageSize: params?.pageSize,
81
+ }),
82
+ });
83
+ }
84
+ /**
85
+ * Creates a Flow in DRAFT, or CLONES an existing one.
86
+ *
87
+ * ⚠️ Cloning is not a convenience: a published Flow is frozen on Meta forever, so
88
+ * `cloneFromFlowId` is the only way to ship a new version of a form that is
89
+ * already live. Read its JSDoc — it takes the LOCAL id, and a `metaFlowId` there
90
+ * comes back as a 404 for a Flow you can plainly see in Flow Manager.
91
+ *
92
+ * Answers 201 `{id, metaFlowId}`. `status` is NOT a field here: publishing has a
93
+ * route of its own precisely so it cannot happen by typo.
94
+ */
95
+ async create(input) {
96
+ return this.#http.requestJson({
97
+ method: "POST",
98
+ path: "/v1/flows",
99
+ body: compact({
100
+ name: input.name,
101
+ categories: input.categories,
102
+ cloneFromFlowId: input.cloneFromFlowId,
103
+ }),
104
+ });
105
+ }
106
+ /**
107
+ * Renames and/or recategorises a Flow. DRAFT only — a published Flow answers 409
108
+ * `FLOW_NOT_DRAFT`, and the remedy is `create({ cloneFromFlowId })`.
109
+ *
110
+ * ⛔ `name` and `categories` are the ONLY fields, and the omission is the guard: a
111
+ * do-everything PATCH that accepted `status` would turn a client's typo into a
112
+ * permanent publish. At least one of the two is required (400 `FLOW_PATCH_EMPTY`).
113
+ */
114
+ async update(id, input) {
115
+ return this.#http.requestJson({
116
+ method: "PATCH",
117
+ path: `/v1/flows/${encodeURIComponent(id)}`,
118
+ body: compact({
119
+ name: input.name,
120
+ categories: input.categories,
121
+ }),
122
+ });
123
+ }
124
+ /**
125
+ * Deletes a Flow. DRAFT only — a published one answers 409 `FLOW_NOT_DRAFT` and
126
+ * cannot be removed at all; deprecate it instead.
127
+ */
128
+ async delete(id) {
129
+ return this.#http.requestJson({
130
+ method: "DELETE",
131
+ path: `/v1/flows/${encodeURIComponent(id)}`,
132
+ });
133
+ }
134
+ /**
135
+ * Uploads the Flow JSON of a DRAFT. `flowJson` is the complete document as a
136
+ * STRING — the text you wrote, not an object we would re-serialise, because
137
+ * Meta's validation errors point at positions inside the text they received.
138
+ *
139
+ * ⛔ RESOLVING MEANS META ACCEPTED IT. This is the whole reason the method exists
140
+ * rather than a thin wrapper: the Graph answers 200 with `validation_errors`
141
+ * inside the body when it REFUSES, so a status-reading client concludes it saved
142
+ * while the Flow silently keeps the previous JSON. Our route reads the LIST, not
143
+ * the status, and answers 422 `FLOW_JSON_INVALID` — which lands here as a thrown
144
+ * {@link PilotStatusHttpError} carrying Meta's list untouched. Read it with
145
+ * {@link flowJsonValidationErrors}; the exception is not to be swallowed.
146
+ *
147
+ * On success `validationErrors` is `[]` and it is present on purpose, so the
148
+ * client that branches on the status and the one that branches on the list reach
149
+ * the same conclusion.
150
+ *
151
+ * ⚠️ Reversible while the Flow is a DRAFT — upload another one. Publishing is not.
152
+ */
153
+ async uploadJson(id, flowJson) {
154
+ return this.#http.requestJson({
155
+ method: "POST",
156
+ path: `/v1/flows/${encodeURIComponent(id)}/json`,
157
+ body: { flowJson },
158
+ });
159
+ }
160
+ /**
161
+ * ⛔ PUBLISHES THE FLOW ON META. IRREVERSIBLE, WITH NO UNDO ANYWHERE.
162
+ *
163
+ * A published Flow can never be edited again — not by us, not in Flow Manager.
164
+ * The only revision after this call is `create({ cloneFromFlowId: id })`, which
165
+ * mints a DIFFERENT Flow under a new id that customers have to be pointed at.
166
+ *
167
+ * ⛔ `{ confirm: true }` IS REQUIRED AND IS THE LITERAL `true`. The argument is
168
+ * not optional and the type is not `boolean`, so `publish(id)` and
169
+ * `publish(id, { confirm: someFlag })` are COMPILE errors: the flag has to be
170
+ * written out at the call site, where the person writing it can see what it does.
171
+ * The value is passed THROUGH rather than hardcoded — a JavaScript caller who
172
+ * sends `false` gets a 400 `FLOW_PUBLISH_REQUIRES_CONFIRMATION` instead of a
173
+ * publish they did not ask for.
174
+ *
175
+ * A Flow that is not a DRAFT answers 409 `FLOW_NOT_DRAFT`.
176
+ */
177
+ async publish(id, options) {
178
+ return this.#http.requestJson({
179
+ method: "POST",
180
+ path: `/v1/flows/${encodeURIComponent(id)}/publish`,
181
+ body: { confirm: options.confirm },
182
+ });
183
+ }
184
+ /**
185
+ * Takes a PUBLISHED Flow out of circulation.
186
+ *
187
+ * ⚠️ Not `delete()`: deleting only works on a DRAFT and removes the row;
188
+ * deprecating works on a published Flow and only marks it.
189
+ *
190
+ * `supersededByFlowId` is the LOCAL id of the successor — read its JSDoc. It is
191
+ * the forward half of the version chain whose backward half `cloneFromFlowId`
192
+ * writes; a `metaFlowId` there records a pointer to no row of ours and the chain
193
+ * ends silently. Omitting it is legitimate and means "nothing replaces this".
194
+ *
195
+ * The result echoes `supersededBy` ALWAYS, `null` included, so a successor that
196
+ * was recorded is distinguishable from one that got dropped on the way.
197
+ */
198
+ async deprecate(id, options = {}) {
199
+ return this.#http.requestJson({
200
+ method: "POST",
201
+ path: `/v1/flows/${encodeURIComponent(id)}/deprecate`,
202
+ body: compact({
203
+ supersededByFlowId: options.supersededByFlowId,
204
+ }),
205
+ });
206
+ }
207
+ /**
208
+ * The forms customers submitted to ONE Flow, newest first.
209
+ *
210
+ * ⚠️ CHECK `notice`. `"FLOW_RESPONSES_WINDOW_TRUNCATED"` means the Flow has minted
211
+ * more sends than one request will correlate, so the page is SHORT — a truncated
212
+ * answer read as a complete one is how a caller concludes submissions were lost.
213
+ *
214
+ * ⚠️ Two retention windows, and neither is a bug. An answer stops being readable
215
+ * 30 days after it arrived; a `contactPhone` disappears (becomes `null`) 37 days
216
+ * after the SEND, so a response can outlive the phone that produced it.
217
+ */
218
+ async listResponses(id, params) {
219
+ return this.#http.requestJson({
220
+ method: "GET",
221
+ path: `/v1/flows/${encodeURIComponent(id)}/responses`,
222
+ query: compact({
223
+ page: params?.page,
224
+ pageSize: params?.pageSize,
225
+ }),
226
+ });
227
+ }
228
+ /**
229
+ * The state of ONE number's `data_exchange` endpoint keypair: what we hold, where
230
+ * Meta calls, and whether Meta still holds the public half we hold.
231
+ *
232
+ * `whatsappNumberId` must be the number THIS KEY is bound to — the path is checked
233
+ * against the credential, never used to look a number up, so another number of
234
+ * your own tenant answers 404 `FLOW_NUMBER_NOT_FOUND` (404 and not 403, so an id
235
+ * cannot be confirmed by guessing). Reach another number with
236
+ * `client.withNumber(...)`.
237
+ *
238
+ * ⛔ Read `metaStatus` as four values, not two. `NOT_SET` is Meta saying it holds
239
+ * no key; `UNKNOWN` is us failing to ask. Rotating on an `UNKNOWN` — i.e. on a
240
+ * transient Graph 500 — destroys a key that was working perfectly.
241
+ *
242
+ * ⚠️ Needs `flows:manage`, although it only reads: `endpointUrl` is a credential.
243
+ * See {@link FlowEndpointKeyStatus}.
244
+ */
245
+ async getEndpointKey(whatsappNumberId) {
246
+ return this.#http.requestJson({
247
+ method: "GET",
248
+ path: `/v1/numbers/${encodeURIComponent(whatsappNumberId)}/flow-endpoint-key`,
249
+ });
250
+ }
251
+ /**
252
+ * ⛔ THREE OPERATIONS BEHIND ONE `POST`, AND THE THIRD IS DESTRUCTIVE. Whoever
253
+ * reads "POST" reads "create"; this call is named `rotate` because on a number
254
+ * that already has a live key it does not create anything — it REPLACES.
255
+ *
256
+ * 1. **Creation** — no keypair has ever been generated. Mints one, uploads the
257
+ * public half, done. Answers `replaced: false`.
258
+ * 2. **Resume** — a pair exists but Meta never accepted it (`uploadedAt` is
259
+ * `null`). Re-uploads the SAME stored public half, so the call CONVERGES and
260
+ * destroys nothing. Also `replaced: false`.
261
+ * 3. **⛔ REPLACEMENT** — a key of ours is live at Meta. Meta holds exactly ONE
262
+ * public key per phone id, so registering a second does not add it: the first
263
+ * is GONE, and with it every `data_exchange` Flow on that number, at the
264
+ * instant Meta accepts. The customer's symptom is the form no longer opening,
265
+ * and NOTHING on our side reports it — the endpoint just answers 421 to
266
+ * bodies encrypted for a key we no longer hold. Answers `replaced: true`.
267
+ *
268
+ * ⛔ Case 3 requires `{ confirm: true }` (the literal `true`, strictly) and
269
+ * answers 400 `FLOW_ENDPOINT_KEY_REQUIRES_CONFIRMATION` without it. Cases 1 and 2
270
+ * do NOT — which is why `confirm` is optional here while `publish`'s is
271
+ * mandatory: the gate is on the STATE of the number, not on the call. Call
272
+ * {@link getEndpointKey} first if you need to know which of the three you are
273
+ * about to do.
274
+ *
275
+ * ⚠️ ALWAYS read `replaced` in the result. `replaced: true` is the only place the
276
+ * sentence "the key that was working is gone" is ever said; a 200 alone does not
277
+ * say it.
278
+ */
279
+ async rotateEndpointKey(whatsappNumberId, options = {}) {
280
+ return this.#http.requestJson({
281
+ method: "POST",
282
+ path: `/v1/numbers/${encodeURIComponent(whatsappNumberId)}/flow-endpoint-key`,
283
+ body: compact({
284
+ confirm: options.confirm,
285
+ }),
286
+ });
287
+ }
288
+ }
289
+ //# sourceMappingURL=flows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flows.js","sourceRoot":"","sources":["../../src/resources/flows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAqBzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACnD,IAAI,CAAC,CAAC,KAAK,YAAY,oBAAoB,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1D,MAAM,IAAI,GAAG,KAAK,CAAC,IAGJ,CAAC;IAChB,IAAI,IAAI,EAAE,IAAI,KAAK,mBAAmB;QAAE,OAAO,IAAI,CAAC;IACpD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC;QAAE,OAAO,IAAI,CAAC;IACvD,OAAO,IAAI,CAAC,gBAAgB,CAAC;AACjC,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,aAAa;IACb,KAAK,CAAa;IAE3B,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,IAAI,CAAC,MAAuB;QAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAiB;YAC1C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,OAAO,CAAC;gBACX,IAAI,EAAE,MAAM,EAAE,IAAI;gBAClB,QAAQ,EAAE,MAAM,EAAE,QAAQ;aAC7B,CAAC;SACL,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,MAAM,CAAC,KAAsB;QAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,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AC,gBAAgB,CAAC,oBAAoB;YAC7E,IAAI,EAAE,OAAO,CAAC;gBACV,OAAO,EAAE,OAAO,CAAC,OAAO;aAC3B,CAAC;SACL,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -1,8 +1,44 @@
1
1
  import type { HttpClient } from "../http.js";
2
- import type { GroupListItem } from "../types.js";
2
+ import type { CreateGroupInput, GroupActionResult, GroupDetail, GroupInviteResult, GroupListItem, GroupPinAction } from "../types.js";
3
+ /**
4
+ * WhatsApp groups (`/v1/groups*`). NUMBER-scoped key.
5
+ *
6
+ * It works on an unofficial (QR) number as well as on a Meta Cloud API number —
7
+ * as long as the Meta account is an Official Business Account with groups
8
+ * enabled, otherwise creation answers `400 META_GROUPS_NOT_ELIGIBLE`.
9
+ *
10
+ * `groupId` is always the JID ending in `@g.us`; on a Meta number it is the
11
+ * pseudo-JID `<META_GROUP_ID>@g.us` that `list()` and the group webhooks return.
12
+ */
3
13
  export declare class GroupsResource {
4
14
  #private;
5
15
  constructor(http: HttpClient);
6
16
  list(): Promise<GroupListItem[]>;
17
+ create(input: CreateGroupInput): Promise<GroupDetail>;
18
+ /** Subject, participants and roles. */
19
+ get(groupId: string): Promise<GroupDetail>;
20
+ /**
21
+ * LEAVES the group (`DELETE /v1/groups/{groupId}`) — it does not delete the
22
+ * group for the other participants, and not every provider supports it (`400
23
+ * FEATURE_NOT_SUPPORTED`).
24
+ */
25
+ leave(groupId: string): Promise<GroupActionResult>;
26
+ /** `participants` are phone numbers as E.164 digits, not JIDs. */
27
+ addParticipants(groupId: string, participants: string[]): Promise<GroupActionResult>;
28
+ removeParticipants(groupId: string, participants: string[]): Promise<GroupActionResult>;
29
+ promoteParticipants(groupId: string, participants: string[]): Promise<GroupActionResult>;
30
+ demoteParticipants(groupId: string, participants: string[]): Promise<GroupActionResult>;
31
+ /**
32
+ * The group's invite link. `reset: true` REVOKES the current link and
33
+ * generates another one — whoever already has the old one loses access.
34
+ */
35
+ invite(groupId: string, options?: {
36
+ reset?: boolean;
37
+ }): Promise<GroupInviteResult>;
38
+ /**
39
+ * Pins/unpins a message. Supported on the Meta Cloud API and on Evolution GO;
40
+ * Evolution v2 does not pin group messages (`400 FEATURE_NOT_SUPPORTED`).
41
+ */
42
+ pin(groupId: string, messageId: string, action: GroupPinAction): Promise<GroupActionResult>;
7
43
  }
8
44
  //# sourceMappingURL=groups.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../src/resources/groups.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,qBAAa,cAAc;;gBAGX,IAAI,EAAE,UAAU;IAItB,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAMzC"}
1
+ {"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../src/resources/groups.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EACR,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,cAAc,EACjB,MAAM,aAAa,CAAC;AAOrB;;;;;;;;;GASG;AACH,qBAAa,cAAc;;gBAGX,IAAI,EAAE,UAAU;IAItB,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAOhC,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC;IAQ3D,uCAAuC;IACjC,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAOhD;;;;OAIG;IACG,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAOxD,kEAAkE;IAC5D,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQpF,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQvF,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQxF,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQ7F;;;OAGG;IACG,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQ5F;;;OAGG;IACG,GAAG,CACL,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,cAAc,GACvB,OAAO,CAAC,iBAAiB,CAAC;CAOhC"}
@@ -1,3 +1,18 @@
1
+ import { compact } from "../internal.js";
2
+ /** The group JID, encoded for the path. */
3
+ function groupPath(groupId, suffix = "") {
4
+ return `/v1/groups/${encodeURIComponent(groupId)}${suffix}`;
5
+ }
6
+ /**
7
+ * WhatsApp groups (`/v1/groups*`). NUMBER-scoped key.
8
+ *
9
+ * It works on an unofficial (QR) number as well as on a Meta Cloud API number —
10
+ * as long as the Meta account is an Official Business Account with groups
11
+ * enabled, otherwise creation answers `400 META_GROUPS_NOT_ELIGIBLE`.
12
+ *
13
+ * `groupId` is always the JID ending in `@g.us`; on a Meta number it is the
14
+ * pseudo-JID `<META_GROUP_ID>@g.us` that `list()` and the group webhooks return.
15
+ */
1
16
  export class GroupsResource {
2
17
  #http;
3
18
  constructor(http) {
@@ -9,5 +24,81 @@ export class GroupsResource {
9
24
  path: "/v1/groups",
10
25
  });
11
26
  }
27
+ async create(input) {
28
+ return this.#http.requestJson({
29
+ method: "POST",
30
+ path: "/v1/groups",
31
+ body: compact({ subject: input.subject, participants: input.participants }),
32
+ });
33
+ }
34
+ /** Subject, participants and roles. */
35
+ async get(groupId) {
36
+ return this.#http.requestJson({
37
+ method: "GET",
38
+ path: groupPath(groupId),
39
+ });
40
+ }
41
+ /**
42
+ * LEAVES the group (`DELETE /v1/groups/{groupId}`) — it does not delete the
43
+ * group for the other participants, and not every provider supports it (`400
44
+ * FEATURE_NOT_SUPPORTED`).
45
+ */
46
+ async leave(groupId) {
47
+ return this.#http.requestJson({
48
+ method: "DELETE",
49
+ path: groupPath(groupId),
50
+ });
51
+ }
52
+ /** `participants` are phone numbers as E.164 digits, not JIDs. */
53
+ async addParticipants(groupId, participants) {
54
+ return this.#http.requestJson({
55
+ method: "POST",
56
+ path: groupPath(groupId, "/participants"),
57
+ body: { participants },
58
+ });
59
+ }
60
+ async removeParticipants(groupId, participants) {
61
+ return this.#http.requestJson({
62
+ method: "DELETE",
63
+ path: groupPath(groupId, "/participants"),
64
+ body: { participants },
65
+ });
66
+ }
67
+ async promoteParticipants(groupId, participants) {
68
+ return this.#http.requestJson({
69
+ method: "POST",
70
+ path: groupPath(groupId, "/participants/promote"),
71
+ body: { participants },
72
+ });
73
+ }
74
+ async demoteParticipants(groupId, participants) {
75
+ return this.#http.requestJson({
76
+ method: "POST",
77
+ path: groupPath(groupId, "/participants/demote"),
78
+ body: { participants },
79
+ });
80
+ }
81
+ /**
82
+ * The group's invite link. `reset: true` REVOKES the current link and
83
+ * generates another one — whoever already has the old one loses access.
84
+ */
85
+ async invite(groupId, options = {}) {
86
+ return this.#http.requestJson({
87
+ method: "POST",
88
+ path: groupPath(groupId, "/invite"),
89
+ body: compact({ reset: options.reset }),
90
+ });
91
+ }
92
+ /**
93
+ * Pins/unpins a message. Supported on the Meta Cloud API and on Evolution GO;
94
+ * Evolution v2 does not pin group messages (`400 FEATURE_NOT_SUPPORTED`).
95
+ */
96
+ async pin(groupId, messageId, action) {
97
+ return this.#http.requestJson({
98
+ method: "POST",
99
+ path: groupPath(groupId, "/pin"),
100
+ body: { messageId, action },
101
+ });
102
+ }
12
103
  }
13
104
  //# sourceMappingURL=groups.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"groups.js","sourceRoot":"","sources":["../../src/resources/groups.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,cAAc;IACd,KAAK,CAAa;IAE3B,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAkB;YAC3C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,YAAY;SACrB,CAAC,CAAC;IACP,CAAC;CACJ"}
1
+ {"version":3,"file":"groups.js","sourceRoot":"","sources":["../../src/resources/groups.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAUzC,2CAA2C;AAC3C,SAAS,SAAS,CAAC,OAAe,EAAE,MAAM,GAAG,EAAE;IAC3C,OAAO,cAAc,kBAAkB,CAAC,OAAO,CAAC,GAAG,MAAM,EAAE,CAAC;AAChE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,cAAc;IACd,KAAK,CAAa;IAE3B,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAkB;YAC3C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,YAAY;SACrB,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAuB;QAChC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAc;YACvC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;SAC9E,C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AC,KAAK,CAAC,WAAW,CAAoB;YAC7C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,SAAS,CAAC,OAAO,EAAE,sBAAsB,CAAC;YAChD,IAAI,EAAE,EAAE,YAAY,EAAE;SACzB,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,UAA+B,EAAE;QAC3D,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAoB;YAC7C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC;YACnC,IAAI,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;SAC1C,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,GAAG,CACL,OAAe,EACf,SAAiB,EACjB,MAAsB;QAEtB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAoB;YAC7C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;YAChC,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;SAC9B,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -1,10 +1,70 @@
1
1
  import type { HttpClient } from "../http.js";
2
- import type { CancelMessagesResult, MessageDetails, SendMessageAccepted, SendMessageInput } from "../types.js";
2
+ import type { CancelMessagesResult, GroupMessagesParams, GroupMessagesResult, MarkReadResult, MessageDetails, MessageHistoryParams, MessageHistoryResult, MessageListParams, MessageListResult, SendMessageAccepted, SendMessageInput, TypingInput, TypingResult, UnreadMessagesParams, UnreadMessagesResult } from "../types.js";
3
3
  export declare class MessagesResource {
4
4
  #private;
5
5
  constructor(http: HttpClient);
6
6
  send(input: SendMessageInput): Promise<SendMessageAccepted>;
7
7
  get(id: string): Promise<MessageDetails>;
8
+ /**
9
+ * The conversation history of the key's number, newest first — both
10
+ * directions, every provider, including messages imported from the device on
11
+ * connect. This is the way to fetch old messages: the webhook does not replay
12
+ * history by default (see `numbers.updateSettings`).
13
+ *
14
+ * Not to be confused with the message LOG: `get()` tracks the delivery status
15
+ * of something you sent; this is the chat thread itself.
16
+ *
17
+ * `startDate`/`endDate` filter `providerTimestamp` — when the message actually
18
+ * happened, not when we ingested it. `startDate` after `endDate` throws a 400
19
+ * with `code: "INVALID_DATE_RANGE"`.
20
+ *
21
+ * Requires a NUMBER-scoped API key; a tenant-scoped key gets a 400. Rows
22
+ * outside the number's PII retention window are still returned, with content,
23
+ * media and peer identity nulled and `redacted: true` set.
24
+ */
25
+ history(params?: MessageHistoryParams): Promise<MessageHistoryResult>;
8
26
  cancel(messageIds: string[]): Promise<CancelMessagesResult>;
27
+ /**
28
+ * The number's message LOG (`GET /v1/messages`), newest first, with the
29
+ * delivery status of each one.
30
+ *
31
+ * Not to be confused with {@link history}: here is the operational trail
32
+ * (status, `errorCode`, `origin`, whether the 24h window was open at send
33
+ * time); there is the conversation. `status` is a COMMA-SEPARATED list inside a
34
+ * single string, not an array — that is what the server reads.
35
+ */
36
+ list(params?: MessageListParams): Promise<MessageListResult>;
37
+ /** Stored group messages (`GET /v1/messages/group`). Empty on `RELAY_ONLY`. */
38
+ group(params?: GroupMessagesParams): Promise<GroupMessagesResult>;
39
+ /**
40
+ * Unread inbound messages (`GET /v1/messages/unread`).
41
+ *
42
+ * `total` is the real unread count (the same one the dashboard shows, coming
43
+ * from the conversation counters) — it is NOT `messages.length`, because the
44
+ * list only carries the latest unread of each conversation. Empty on
45
+ * `RELAY_ONLY`.
46
+ */
47
+ unread(params?: UnreadMessagesParams): Promise<UnreadMessagesResult>;
48
+ /**
49
+ * Acknowledges the read receipt (blue tick) of the LAST message received from
50
+ * `to`, and of every earlier one, without sending any message at all
51
+ * (`POST /v1/messages/read`).
52
+ *
53
+ * Best-effort: a 200 with `acked: false` is the normal "there was nothing to
54
+ * acknowledge" case (empty thread) or a number on `RELAY_ONLY` — check `acked`,
55
+ * not just the HTTP status.
56
+ */
57
+ markRead(to: string): Promise<MarkReadResult>;
58
+ /**
59
+ * Shows "typing…" / "recording…" to a contact, without sending a message
60
+ * (`POST /v1/messages/typing`). `state` defaults to `"typing"`.
61
+ *
62
+ * The indicator clears on its own once a message is sent, or on a provider
63
+ * timeout (~25s on Meta). On a META number the parity is not complete and the
64
+ * server tells you what it did in `effectiveState`: `"recording"` becomes
65
+ * `"typing"` (the Cloud API has no recording variant) and `"paused"` is a
66
+ * no-op. On the Evolution providers the three states are relayed as-is.
67
+ */
68
+ typing(input: TypingInput): Promise<TypingResult>;
9
69
  }
10
70
  //# sourceMappingURL=messages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/resources/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB,qBAAa,gBAAgB;;gBAGf,IAAI,EAAE,UAAU;IAItB,IAAI,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAiC3D,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAOxC,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAOlE"}
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/resources/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EAEV,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,YAAY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