@ingenx-io/valets-schema-mcp-server 0.1.10 → 0.2.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.
Files changed (66) hide show
  1. package/data/docs/collections/firestore-paths.md +20 -0
  2. package/data/docs/enums/attention-status.md +1 -1
  3. package/data/docs/enums/booking-status.md +1 -1
  4. package/data/docs/enums/customer-payment-status.md +1 -1
  5. package/data/docs/enums/customer-payment-target-type.md +1 -1
  6. package/data/docs/enums/delivery-type.md +1 -1
  7. package/data/docs/enums/deployment-link-type.md +1 -1
  8. package/data/docs/enums/event-status.md +1 -1
  9. package/data/docs/enums/fulfillment-status.md +1 -1
  10. package/data/docs/enums/loyalty-transaction-type.md +1 -1
  11. package/data/docs/enums/order-status.md +1 -1
  12. package/data/docs/enums/outbound-message-format.md +22 -0
  13. package/data/docs/enums/outbound-message-purpose.md +24 -0
  14. package/data/docs/enums/outbound-message-status.md +4 -4
  15. package/data/docs/enums/payment-method.md +2 -2
  16. package/data/docs/enums/payment-proof-status.md +2 -2
  17. package/data/docs/enums/payment-status.md +2 -2
  18. package/data/docs/enums/pending-issue.md +2 -2
  19. package/data/docs/enums/return-status.md +2 -2
  20. package/data/docs/enums/session-status.md +2 -2
  21. package/data/docs/enums/site-status.md +2 -2
  22. package/data/docs/enums/stocktake-frequency.md +2 -2
  23. package/data/docs/enums/stocktake-item-status.md +2 -2
  24. package/data/docs/enums/stocktake-status.md +2 -2
  25. package/data/docs/enums/ticket-status.md +2 -2
  26. package/data/docs/enums/waba-label.md +2 -2
  27. package/data/docs/enums/whatsapp-button-sub-type.md +22 -0
  28. package/data/docs/enums/whatsapp-template-component.md +23 -0
  29. package/data/docs/enums/whatsapp-template-status.md +26 -0
  30. package/data/docs/index.md +11 -5
  31. package/data/docs/models/allowed-user.md +1 -1
  32. package/data/docs/models/analytics-backfill.md +1 -1
  33. package/data/docs/models/analytics-daily.md +1 -1
  34. package/data/docs/models/analytics-event.md +1 -1
  35. package/data/docs/models/analytics-hourly.md +1 -1
  36. package/data/docs/models/booking-version.md +1 -1
  37. package/data/docs/models/booking.md +1 -1
  38. package/data/docs/models/customer-payment-allocation.md +1 -1
  39. package/data/docs/models/customer-payment.md +1 -1
  40. package/data/docs/models/customer.md +1 -1
  41. package/data/docs/models/event.md +1 -1
  42. package/data/docs/models/loyalty-config.md +1 -1
  43. package/data/docs/models/loyalty-reward.md +1 -1
  44. package/data/docs/models/loyalty-status.md +1 -1
  45. package/data/docs/models/loyalty-transaction.md +1 -1
  46. package/data/docs/models/magic-link-request.md +1 -1
  47. package/data/docs/models/metrics-current.md +1 -1
  48. package/data/docs/models/metrics-daily.md +1 -1
  49. package/data/docs/models/metrics-monthly.md +1 -1
  50. package/data/docs/models/order-item.md +1 -1
  51. package/data/docs/models/order.md +1 -1
  52. package/data/docs/models/sale.md +1 -1
  53. package/data/docs/models/site-payment.md +1 -1
  54. package/data/docs/models/site.md +1 -1
  55. package/data/docs/models/stocktake-item.md +1 -1
  56. package/data/docs/models/stocktake.md +1 -1
  57. package/data/docs/models/ticket.md +1 -1
  58. package/data/docs/models/whatsapp-inbound-message.md +1 -1
  59. package/data/docs/models/whatsapp-outbound-lifecycle-event.md +310 -0
  60. package/data/docs/models/whatsapp-outbound-message.md +395 -172
  61. package/data/docs/models/whatsapp-template.md +283 -0
  62. package/data/static/llms.txt +129 -32
  63. package/data/static/openapi.yaml +329 -66
  64. package/data/static/schemas.json +414 -69
  65. package/package.json +1 -1
  66. package/data/docs/enums/outbound-message-kind.md +0 -23
@@ -0,0 +1,283 @@
1
+ ---
2
+ title: "WhatsappTemplate"
3
+ sidebar_label: "WhatsappTemplate"
4
+ sidebar_position: 31
5
+ ---
6
+
7
+ # WhatsappTemplate
8
+
9
+ <details>
10
+ <summary>Example JSON</summary>
11
+
12
+ ```json
13
+ {
14
+ "id": null,
15
+ "waba": "waba",
16
+ "wabaId": "wab_ref123",
17
+ "name": "Amadou Diallo",
18
+ "language": "language",
19
+ "category": "category",
20
+ "status": "status",
21
+ "parameters": [
22
+ {
23
+ "name": "Amadou Diallo",
24
+ "component": "component"
25
+ }
26
+ ],
27
+ "preview": "preview"
28
+ }
29
+ ```
30
+
31
+ </details>
32
+
33
+
34
+ - [1. Property `id`](#id)
35
+ - [2. Property `waba`](#waba)
36
+ - [3. Property `wabaId`](#wabaId)
37
+ - [4. Property `name`](#name)
38
+ - [5. Property `language`](#language)
39
+ - [6. Property `category`](#category)
40
+ - [7. Property `status`](#status)
41
+ - [8. Property `parameters`](#parameters)
42
+ - [8.1. parameters items](#parameters_items)
43
+ - [8.1.1. Property `name`](#parameters_items_name)
44
+ - [8.1.2. Property `component`](#parameters_items_component)
45
+ - [8.1.3. Property `buttonIndex`](#parameters_items_buttonIndex)
46
+ - [8.1.4. Property `buttonSubType`](#parameters_items_buttonSubType)
47
+ - [9. Property `preview`](#preview)
48
+
49
+ | | |
50
+ | ------------------------- | ------------------------------- |
51
+ | **Type** | `object` |
52
+ | **Required** | No |
53
+ | **Additional properties** | Not allowed |
54
+ | **Defined in** | #/definitions/whatsapp-template |
55
+
56
+ **Description:** WhatsappTemplate — Meta-approved template synced from the WhatsApp Business API (GH#43; parameter placement GH#46). Collection: whatsapp_templates/\{docId\}, doc ID `\{waba\}__\{name\}__\{language\}`. WABA-scoped; backend-synced; dashboard reads only.
57
+
58
+ | Property | Pattern | Type | Deprecated | Definition | Title/Description |
59
+ | ---------------------------- | ------- | ---------------- | ---------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
60
+ | - [id](#id ) | No | string or null | No | - | (Read-only) Firestore document ID — composite \`\{waba\}__\{name\}__\{language\}\`. |
61
+ | + [waba](#waba ) | No | enum (of string) | No | In #/definitions/waba-label | (Read-only) WABA label this template is approved on. Templates are WABA-scoped. Mirrors WhatsappOutboundMessage.waba. |
62
+ | + [wabaId](#wabaId ) | No | string | No | - | (Read-only) Meta WABA ID this template belongs to. The sender must verify its phone number belongs to this WABA before using the template. |
63
+ | + [name](#name ) | No | string | No | - | (Read-only) Template name as registered with Meta. |
64
+ | + [language](#language ) | No | string | No | - | (Read-only) Template language/locale code (e.g. "en", "fr"). |
65
+ | + [category](#category ) | No | string | No | - | (Read-only) Meta template category (e.g. MARKETING, UTILITY, AUTHENTICATION). |
66
+ | + [status](#status ) | No | enum (of string) | No | In #/definitions/whatsapp-template-status | (Read-only) Meta review status. Only APPROVED templates can be sent. |
67
+ | + [parameters](#parameters ) | No | array of object | No | - | (Read-only) Declared parameters with component placement. Supersedes the flat \`variables\` list (GH#46) — lets the send group values into the correct header/body/button components. A message supplies values keyed by \`name\` via WhatsappOutboundMessage.template.variables. |
68
+ | + [preview](#preview ) | No | string | No | - | (Read-only) Rendered preview text for display in the dashboard picker. |
69
+
70
+ ## <a name="id"></a>1. Property `id`
71
+
72
+ | | |
73
+ | ------------ | ---------------- |
74
+ | **Type** | `string or null` |
75
+ | **Required** | No |
76
+
77
+ **Description:** (Read-only) Firestore document ID — composite `\{waba\}__\{name\}__\{language\}`.
78
+
79
+ :::warning Server-set
80
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
81
+ :::
82
+
83
+ ## <a name="waba"></a>2. Property `waba`
84
+
85
+ | | |
86
+ | -------------- | ------------------------ |
87
+ | **Type** | `enum (of string)` |
88
+ | **Required** | Yes |
89
+ | **Defined in** | #/definitions/waba-label |
90
+
91
+ **Description:** (Read-only) WABA label this template is approved on. Templates are WABA-scoped. Mirrors WhatsappOutboundMessage.waba.
92
+
93
+ Must be one of:
94
+ * "cmz"
95
+ * "val"
96
+
97
+ :::warning Server-set
98
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
99
+ :::
100
+
101
+ ## <a name="wabaId"></a>3. Property `wabaId`
102
+
103
+ | | |
104
+ | ------------ | -------- |
105
+ | **Type** | `string` |
106
+ | **Required** | Yes |
107
+
108
+ **Description:** (Read-only) Meta WABA ID this template belongs to. The sender must verify its phone number belongs to this WABA before using the template.
109
+
110
+ :::warning Server-set
111
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
112
+ :::
113
+
114
+ ## <a name="name"></a>4. Property `name`
115
+
116
+ | | |
117
+ | ------------ | -------- |
118
+ | **Type** | `string` |
119
+ | **Required** | Yes |
120
+
121
+ **Description:** (Read-only) Template name as registered with Meta.
122
+
123
+ :::warning Server-set
124
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
125
+ :::
126
+
127
+ ## <a name="language"></a>5. Property `language`
128
+
129
+ | | |
130
+ | ------------ | -------- |
131
+ | **Type** | `string` |
132
+ | **Required** | Yes |
133
+
134
+ **Description:** (Read-only) Template language/locale code (e.g. "en", "fr").
135
+
136
+ :::warning Server-set
137
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
138
+ :::
139
+
140
+ ## <a name="category"></a>6. Property `category`
141
+
142
+ | | |
143
+ | ------------ | -------- |
144
+ | **Type** | `string` |
145
+ | **Required** | Yes |
146
+
147
+ **Description:** (Read-only) Meta template category (e.g. MARKETING, UTILITY, AUTHENTICATION).
148
+
149
+ :::warning Server-set
150
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
151
+ :::
152
+
153
+ ## <a name="status"></a>7. Property `status`
154
+
155
+ | | |
156
+ | -------------- | -------------------------------------- |
157
+ | **Type** | `enum (of string)` |
158
+ | **Required** | Yes |
159
+ | **Defined in** | #/definitions/whatsapp-template-status |
160
+
161
+ **Description:** (Read-only) Meta review status. Only APPROVED templates can be sent.
162
+
163
+ Must be one of:
164
+ * "APPROVED"
165
+ * "PENDING"
166
+ * "REJECTED"
167
+ * "PAUSED"
168
+ * "DISABLED"
169
+ * "IN_APPEAL"
170
+
171
+ :::warning Server-set
172
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
173
+ :::
174
+
175
+ ## <a name="parameters"></a>8. Property `parameters`
176
+
177
+ | | |
178
+ | ------------ | ----------------- |
179
+ | **Type** | `array of object` |
180
+ | **Required** | Yes |
181
+
182
+ **Description:** (Read-only) Declared parameters with component placement. Supersedes the flat `variables` list (GH#46) — lets the send group values into the correct header/body/button components. A message supplies values keyed by `name` via WhatsappOutboundMessage.template.variables.
183
+
184
+ | | Array restrictions |
185
+ | -------------------- | ------------------ |
186
+ | **Min items** | N/A |
187
+ | **Max items** | N/A |
188
+ | **Items unicity** | False |
189
+ | **Additional items** | False |
190
+ | **Tuple validation** | See below |
191
+
192
+ | Each item of this array must be | Description |
193
+ | ------------------------------------- | ---------------------------------------------------------------------- |
194
+ | [parameters items](#parameters_items) | Declared WhatsApp template parameter with component placement (GH#46). |
195
+
196
+ ### <a name="parameters_items"></a>8.1. parameters items
197
+
198
+ | | |
199
+ | ------------------------- | ----------- |
200
+ | **Type** | `object` |
201
+ | **Required** | No |
202
+ | **Additional properties** | Not allowed |
203
+
204
+ **Description:** Declared WhatsApp template parameter with component placement (GH#46).
205
+
206
+ | Property | Pattern | Type | Deprecated | Definition | Title/Description |
207
+ | --------------------------------------------------- | ------- | ---------------- | ---------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
208
+ | + [name](#parameters_items_name ) | No | string | No | - | Parameter name/placeholder (e.g. "1"). Matches a key in WhatsappOutboundMessage.template.variables. |
209
+ | + [component](#parameters_items_component ) | No | enum (of string) | No | In #/definitions/whatsapp-template-component | Which template component this parameter targets: header \| body \| button. |
210
+ | - [buttonIndex](#parameters_items_buttonIndex ) | No | integer | No | - | 0-based button position. Present only when component=button (Meta requires a string index at send time). |
211
+ | - [buttonSubType](#parameters_items_buttonSubType ) | No | enum (of string) | No | In #/definitions/whatsapp-button-sub-type | Button sub-type (url \| quick_reply). Present only when component=button. |
212
+
213
+ #### <a name="parameters_items_name"></a>8.1.1. Property `name`
214
+
215
+ | | |
216
+ | ------------ | -------- |
217
+ | **Type** | `string` |
218
+ | **Required** | Yes |
219
+
220
+ **Description:** Parameter name/placeholder (e.g. "1"). Matches a key in WhatsappOutboundMessage.template.variables.
221
+
222
+ #### <a name="parameters_items_component"></a>8.1.2. Property `component`
223
+
224
+ | | |
225
+ | -------------- | ----------------------------------------- |
226
+ | **Type** | `enum (of string)` |
227
+ | **Required** | Yes |
228
+ | **Defined in** | #/definitions/whatsapp-template-component |
229
+
230
+ **Description:** Which template component this parameter targets: header | body | button.
231
+
232
+ Must be one of:
233
+ * "header"
234
+ * "body"
235
+ * "button"
236
+
237
+ #### <a name="parameters_items_buttonIndex"></a>8.1.3. Property `buttonIndex`
238
+
239
+ | | |
240
+ | ------------ | --------- |
241
+ | **Type** | `integer` |
242
+ | **Required** | No |
243
+
244
+ **Description:** 0-based button position. Present only when component=button (Meta requires a string index at send time).
245
+
246
+ | Restrictions | |
247
+ | ------------ | ---------------------- |
248
+ | **Minimum** | &ge; -9007199254740991 |
249
+ | **Maximum** | &le; 9007199254740991 |
250
+
251
+ #### <a name="parameters_items_buttonSubType"></a>8.1.4. Property `buttonSubType`
252
+
253
+ | | |
254
+ | -------------- | -------------------------------------- |
255
+ | **Type** | `enum (of string)` |
256
+ | **Required** | No |
257
+ | **Defined in** | #/definitions/whatsapp-button-sub-type |
258
+
259
+ **Description:** Button sub-type (url | quick_reply). Present only when component=button.
260
+
261
+ Must be one of:
262
+ * "url"
263
+ * "quick_reply"
264
+
265
+ :::warning Server-set
266
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
267
+ :::
268
+
269
+ ## <a name="preview"></a>9. Property `preview`
270
+
271
+ | | |
272
+ | ------------ | -------- |
273
+ | **Type** | `string` |
274
+ | **Required** | Yes |
275
+
276
+ **Description:** (Read-only) Rendered preview text for display in the dashboard picker.
277
+
278
+ ----------------------------------------------------------------------------------------------------------------------------
279
+ Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2026-05-27 at 13:06:59 +0000
280
+
281
+ :::warning Server-set
282
+ Do not include in write requests. This field is set exclusively by the server (Firestore trigger or Admin SDK). Clients that send it will have the value silently ignored or may receive a validation error.
283
+ :::
@@ -4,7 +4,7 @@
4
4
  > Source of truth: Zod schemas in packages/schema/src/
5
5
  > All Firestore documents are scoped under companies/{companyId}/
6
6
 
7
- > Generated: 2026-05-16
7
+ > Generated: 2026-05-27
8
8
 
9
9
  ---
10
10
 
@@ -50,13 +50,17 @@ Values: EARNED, REDEEMED, ADJUSTED, EXPIRED, BONUS, REFUND
50
50
  Core order lifecycle status (D03, D34). Universal across all business types. Replaces the Dashboard's legacy 20-value flat enum (MIG-11).
51
51
  Values: PENDING, CONFIRMED, PROCESSING, READY, COMPLETED, CANCELLED, EXPIRED
52
52
 
53
- ### OutboundMessageKind
54
- Outbound WhatsApp message kind. Strict enum new kinds require a schema version bump (GH#38).
55
- Values: otp, review_request, adhoc
53
+ ### OutboundMessageFormat
54
+ Outbound WhatsApp message format. `text` is a free-form body (only valid inside the 24h customer-care window); `template` is a pre-approved WhatsApp template send. The backend is the authority on which is allowed (GH#43).
55
+ Values: text, template
56
+
57
+ ### OutboundMessagePurpose
58
+ Business purpose of an outbound WhatsApp message — orthogonal to its format (see OutboundMessageFormat). `otp`/`review_request`/`adhoc` are system-originated; `conversational` is a human agent reply from the dashboard inbox. Optional signal carried for analytics/triggers (GH#43; supersedes the GH#38 OutboundMessageKind).
59
+ Values: otp, review_request, adhoc, conversational
56
60
 
57
61
  ### OutboundMessageStatus
58
- Outbound WhatsApp message delivery status. Lifecycle: accepted → sent → delivered → read, or accepted → failed. Updated in-place by Meta delivery callbacks (GH#38).
59
- Values: accepted, sent, delivered, read, failed
62
+ Outbound WhatsApp message delivery status. Lifecycle: queued → sent → delivered → read, or queued → failed. The dashboard creates the message with status `queued`; the whatsapp-server backend owns every transition after, updating in place from Meta delivery callbacks (GH#43).
63
+ Values: queued, sent, delivered, read, failed
60
64
 
61
65
  ### PaymentMethod
62
66
  Unified payment method set with African + global methods (D02).
@@ -106,6 +110,18 @@ Values: VALID, USED, CANCELLED
106
110
  Human-readable WABA label identifying which Meta business number received the message (GH#36).
107
111
  Values: cmz, val
108
112
 
113
+ ### WhatsappButtonSubType
114
+ Sub-type of a WhatsApp template button parameter. Set when WhatsappTemplateParameter.component === "button" — maps to Meta `components[].sub_type` (GH#46).
115
+ Values: url, quick_reply
116
+
117
+ ### WhatsappTemplateComponent
118
+ WhatsApp template component a parameter targets. Determines which Meta `components` entry the supplied value is placed in at send time (GH#46).
119
+ Values: header, body, button
120
+
121
+ ### WhatsappTemplateStatus
122
+ Meta review status of a WhatsApp message template, synced from the WhatsApp Business API. Only APPROVED templates can be sent. The fuller Meta status set is used deliberately (vs just APPROVED/PENDING/REJECTED) so this enum has a distinct value signature from PaymentProofStatus in the JSON-Schema $ref matcher (GH#43).
123
+ Values: APPROVED, PENDING, REJECTED, PAUSED, DISABLED, IN_APPEAL
124
+
109
125
  ---
110
126
 
111
127
  ## Models
@@ -1518,47 +1534,128 @@ Example:
1518
1534
  }
1519
1535
  ```
1520
1536
 
1537
+ ### WhatsappOutboundLifecycleEvent
1538
+ Fields: 11 (2 required)
1539
+
1540
+ | Field | Type | Required | Description |
1541
+ |-------|------|----------|-------------|
1542
+ | id | ['string', 'null'] | no | (Read-only) Firestore document ID, auto-generated. |
1543
+ | type | any | yes | (Read-only) Event type — send_attempt | status_callback | error | future string. |
1544
+ | at | FirestoreTimestamp | yes | (Read-only) When the event was recorded server-side. |
1545
+ | status | any | no | (Read-only) Resulting/observed status, when this event implies one. |
1546
+ | wamid | ['string', 'null'] | no | (Read-only) WhatsApp message ID, if known at this point in the lifecycle. |
1547
+ | phoneNumberId | ['string', 'null'] | no | (Read-only) Meta phone number ID (the specific line within the WABA) used for the attempt. |
1548
+ | contactWaId | ['string', 'null'] | no | (Read-only) Normalized wa_id returned by Meta. May differ from the recipient `to`. |
1549
+ | metaRequest | any | no | (Read-only) Raw outbound payload sent to the Meta Graph API. |
1550
+ | metaResponse | any | no | (Read-only) Raw Meta Graph API response. |
1551
+ | errorCode | ['integer', 'null'] | no | (Read-only) Meta error code. Present on failed attempts. |
1552
+ | errorDetail | any | no | (Read-only) Raw Meta error object(s). |
1553
+
1554
+ Example:
1555
+ ```json
1556
+ {
1557
+ "id": null,
1558
+ "type": "phone",
1559
+ "at": "at",
1560
+ "status": "status",
1561
+ "wamid": null,
1562
+ "phoneNumberId": null,
1563
+ "contactWaId": null,
1564
+ "metaRequest": "metaRequest",
1565
+ "metaResponse": "metaResponse",
1566
+ "errorCode": null,
1567
+ "errorDetail": "errorDetail"
1568
+ }
1569
+ ```
1570
+
1521
1571
  ### WhatsappOutboundMessage
1522
- Fields: 16 (9 required)
1572
+ Fields: 18 (7 required)
1523
1573
 
1524
1574
  | Field | Type | Required | Description |
1525
1575
  |-------|------|----------|-------------|
1526
- | id | ['string', 'null'] | no | (Read-only) Firestore document ID — wamid on success, generated UUID on failure. |
1527
- | messageId | string | yes | (Immutable) WhatsApp message ID (wamid) on success; generated UUID on send failure. |
1528
- | to | string | yes | (Immutable) Recipient phone number in E.164 format. Mirrors inbound `from`. |
1529
- | waba | WabaLabel | yes | (Immutable) WABA that sent the message. Mirrors inbound `waba`. |
1576
+ | id | ['string', 'null'] | no | (Read-only) Firestore document ID — auto-generated at enqueue time. |
1577
+ | to | string | yes | (Immutable) Recipient phone number in E.164 format. Must match the inbound `from` for the same conversation. |
1578
+ | waba | WabaLabel | yes | (Immutable) WABA that will send the message. Mirrors inbound `waba`. |
1530
1579
  | wabaId | string | yes | (Immutable) Meta WABA ID. Mirrors inbound `wabaId`. |
1531
- | sentAt | FirestoreTimestamp | yes | (Read-only) Server-side send timestamp. Mirrors inbound `receivedAt`. |
1532
- | phoneNumberId | string | yes | (Immutable) Meta phone number ID used for the send (specific line within the WABA). |
1533
- | kind | OutboundMessageKind | yes | (Immutable) Message kind. |
1534
- | templateName | string | yes | (Immutable) WhatsApp template name used for the send. |
1535
- | status | OutboundMessageStatus | yes | Delivery status. Updated in-place by Meta delivery callbacks. |
1536
- | contactWaId | ['string', 'null'] | no | Normalized wa_id returned by Meta on success. May differ from `to`. |
1537
- | appId | ['string', 'null'] | no | Tenant appId when applicable. |
1538
- | orderUuid | ['string', 'null'] | no | Order reference. Present on review_request messages only. |
1539
- | statusUpdatedAt | any | no | Timestamp of the last status update from a Meta delivery callback. |
1540
- | failureCode | ['integer', 'null'] | no | Meta error code. Present on failed sends only. |
1541
- | failureErrors | ['array', 'null'] | no | Raw Meta error objects. Present on failed sends only. |
1580
+ | kind | OutboundMessageFormat | yes | (Immutable) Message format: `text` or `template`. Set `text` xor `template` to match. |
1581
+ | text | ['string', 'null'] | no | Free-form message body. Present only when kind=text. |
1582
+ | template | ['object', 'null'] | no | Template send payload. Present only when kind=template. |
1583
+ | purpose | any | no | Business purpose (otp | review_request | adhoc | conversational). Optional. |
1584
+ | orderUuid | ['string', 'null'] | no | Order reference. Present on review_request messages. |
1585
+ | sentBy | object | yes | (Immutable) Dashboard actor who enqueued the message. |
1586
+ | sentBy.uid | string | yes | Firebase Auth UID of the dashboard user who enqueued the message. |
1587
+ | sentBy.email | string | no | Email of the sender, if available. |
1588
+ | createdAt | FirestoreTimestamp | yes | (Immutable) Enqueue timestamp, set by the dashboard at create. |
1589
+ | status | OutboundMessageStatus | yes | Delivery status. Created as `queued` by the dashboard; updated in place by the backend. |
1590
+ | wamid | ['string', 'null'] | no | (Read-only) WhatsApp message ID returned by Meta once the backend sends. Absent while queued or on failure. |
1591
+ | error | ['string', 'null'] | no | (Read-only) Human-readable failure reason. Present on status=failed. Raw Meta error detail lives in the lifecycle_events subcollection. |
1592
+ | sentAt | any | no | (Read-only) When the backend sent the message to Meta. |
1593
+ | deliveredAt | any | no | (Read-only) When Meta reported delivery. |
1594
+ | readAt | any | no | (Read-only) When Meta reported the recipient read the message. |
1595
+ | failedAt | any | no | (Read-only) When the send failed. |
1542
1596
 
1543
1597
  Example:
1544
1598
  ```json
1545
1599
  {
1546
1600
  "id": null,
1547
- "messageId": "mes_ref123",
1548
1601
  "to": "to",
1549
1602
  "waba": "waba",
1550
1603
  "wabaId": "wab_ref123",
1551
- "sentAt": "sentAt",
1552
- "phoneNumberId": "pho_ref123",
1553
1604
  "kind": "kind",
1554
- "templateName": "templateName",
1555
- "status": "status",
1556
- "contactWaId": null,
1557
- "appId": null,
1605
+ "text": null,
1606
+ "template": null,
1607
+ "purpose": "purpose",
1558
1608
  "orderUuid": null,
1559
- "statusUpdatedAt": "statusUpdatedAt",
1560
- "failureCode": null,
1561
- "failureErrors": null
1609
+ "sentBy": {
1610
+ "uid": "user_u8x92kqm"
1611
+ },
1612
+ "createdAt": "createdAt",
1613
+ "status": "status",
1614
+ "wamid": null,
1615
+ "error": null,
1616
+ "sentAt": "sentAt",
1617
+ "deliveredAt": "deliveredAt",
1618
+ "readAt": "readAt",
1619
+ "failedAt": "failedAt"
1620
+ }
1621
+ ```
1622
+
1623
+ ### WhatsappTemplate
1624
+ Fields: 9 (8 required)
1625
+
1626
+ | Field | Type | Required | Description |
1627
+ |-------|------|----------|-------------|
1628
+ | id | ['string', 'null'] | no | (Read-only) Firestore document ID — composite `{waba}__{name}__{language}`. |
1629
+ | waba | WabaLabel | yes | (Read-only) WABA label this template is approved on. Templates are WABA-scoped. Mirrors WhatsappOutboundMessage.waba. |
1630
+ | wabaId | string | yes | (Read-only) Meta WABA ID this template belongs to. The sender must verify its phone number belongs to this WABA before using the template. |
1631
+ | name | string | yes | (Read-only) Template name as registered with Meta. |
1632
+ | language | string | yes | (Read-only) Template language/locale code (e.g. "en", "fr"). |
1633
+ | category | string | yes | (Read-only) Meta template category (e.g. MARKETING, UTILITY, AUTHENTICATION). |
1634
+ | status | WhatsappTemplateStatus | yes | (Read-only) Meta review status. Only APPROVED templates can be sent. |
1635
+ | parameters | array<object> | yes | (Read-only) Declared parameters with component placement. Supersedes the flat `variables` list (GH#46) — lets the send group values into the correct header/body/button components. A message supplies values keyed by `name` via WhatsappOutboundMessage.template.variables. |
1636
+ | parameters[].name | string | yes | Parameter name/placeholder (e.g. "1"). Matches a key in WhatsappOutboundMessage.template.variables. |
1637
+ | parameters[].component | WhatsappTemplateComponent | yes | Which template component this parameter targets: header | body | button. |
1638
+ | parameters[].buttonIndex | integer | no | 0-based button position. Present only when component=button (Meta requires a string index at send time). |
1639
+ | parameters[].buttonSubType | WhatsappButtonSubType | no | Button sub-type (url | quick_reply). Present only when component=button. |
1640
+ | preview | string | yes | (Read-only) Rendered preview text for display in the dashboard picker. |
1641
+
1642
+ Example:
1643
+ ```json
1644
+ {
1645
+ "id": null,
1646
+ "waba": "waba",
1647
+ "wabaId": "wab_ref123",
1648
+ "name": "Amadou Diallo",
1649
+ "language": "language",
1650
+ "category": "category",
1651
+ "status": "status",
1652
+ "parameters": [
1653
+ {
1654
+ "name": "Amadou Diallo",
1655
+ "component": "component"
1656
+ }
1657
+ ],
1658
+ "preview": "preview"
1562
1659
  }
1563
1660
  ```
1564
1661