@sentdm/sentdm 0.38.0 → 0.40.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 (51) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/client.d.mts +4 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +4 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +2 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +2 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/conversations.d.mts +71 -3
  12. package/resources/conversations.d.mts.map +1 -1
  13. package/resources/conversations.d.ts +71 -3
  14. package/resources/conversations.d.ts.map +1 -1
  15. package/resources/index.d.mts +1 -1
  16. package/resources/index.d.mts.map +1 -1
  17. package/resources/index.d.ts +1 -1
  18. package/resources/index.d.ts.map +1 -1
  19. package/resources/index.js.map +1 -1
  20. package/resources/index.mjs.map +1 -1
  21. package/resources/messages.d.mts +171 -14
  22. package/resources/messages.d.mts.map +1 -1
  23. package/resources/messages.d.ts +171 -14
  24. package/resources/messages.d.ts.map +1 -1
  25. package/resources/messages.js +21 -3
  26. package/resources/messages.js.map +1 -1
  27. package/resources/messages.mjs +21 -3
  28. package/resources/messages.mjs.map +1 -1
  29. package/resources/templates.d.mts +276 -14
  30. package/resources/templates.d.mts.map +1 -1
  31. package/resources/templates.d.ts +276 -14
  32. package/resources/templates.d.ts.map +1 -1
  33. package/resources/templates.js +28 -2
  34. package/resources/templates.js.map +1 -1
  35. package/resources/templates.mjs +28 -2
  36. package/resources/templates.mjs.map +1 -1
  37. package/resources/webhooks.d.mts +693 -22
  38. package/resources/webhooks.d.mts.map +1 -1
  39. package/resources/webhooks.d.ts +693 -22
  40. package/resources/webhooks.d.ts.map +1 -1
  41. package/src/client.ts +10 -0
  42. package/src/resources/conversations.ts +78 -3
  43. package/src/resources/index.ts +4 -0
  44. package/src/resources/messages.ts +182 -14
  45. package/src/resources/templates.ts +289 -14
  46. package/src/resources/webhooks.ts +764 -22
  47. package/src/version.ts +1 -1
  48. package/version.d.mts +1 -1
  49. package/version.d.ts +1 -1
  50. package/version.js +1 -1
  51. package/version.mjs +1 -1
@@ -8,11 +8,15 @@ import { RequestOptions } from "../internal/request-options.js";
8
8
  * One endpoint sends on any channel: pass `channel: "sent"` and we pick between SMS, WhatsApp and RCS per recipient using your routing rules, or name a channel to pin it. A send is accepted asynchronously — `POST /v3/messages` returns an id, and delivery is reported through `GET /v3/messages/{id}`, its activities, or a webhook.
9
9
  *
10
10
  * **A message needs a sender.** What you can send, where, and at what cost is decided by the markets under **Channels** — so a recipient in a country you hold no sender for is refused here rather than queued.
11
+ *
12
+ * **A message can be resent on its id.** `POST /v3/messages/{id}/resend` puts a finished message — typically one BLOCKED for insufficient balance — back through the send pipeline. It is a new attempt, not a free retry: every policy runs again, the message is billed again, and its status webhooks fire again. A FILTERED message is never resendable.
11
13
  */
12
14
  export declare class Messages extends APIResource {
13
15
  /**
14
16
  * Retrieves the activity log for a specific message. Activities track the message
15
- * lifecycle including acceptance, processing, sending, delivery, and any errors.
17
+ * lifecycle including acceptance, processing, sending, delivery, and any errors. A
18
+ * SCHEDULED entry carries scheduled_at, the release instant in UTC as it stood at
19
+ * that moment. Other entries have no scheduled_at key.
16
20
  *
17
21
  * @example
18
22
  * ```ts
@@ -24,7 +28,11 @@ export declare class Messages extends APIResource {
24
28
  retrieveActivities(id: string, params?: MessageRetrieveActivitiesParams | null | undefined, options?: RequestOptions): APIPromise<MessageRetrieveActivitiesResponse>;
25
29
  /**
26
30
  * Retrieves the current status and details of a message by ID. Includes delivery
27
- * status, timestamps, and error information if applicable.
31
+ * status, timestamps, and error information if applicable. A message that is or
32
+ * was held for a later time (a send you scheduled with scheduled_at, or a
33
+ * quiet-hours hold) is returned as a ScheduledMessageResponse: the same fields
34
+ * plus scheduled_at, the release instant in UTC. A message sent immediately has no
35
+ * scheduled_at key.
28
36
  *
29
37
  * @example
30
38
  * ```ts
@@ -44,7 +52,17 @@ export declare class Messages extends APIResource {
44
52
  * insufficient balance, a template not approved for sending, or free-form content
45
53
  * with no open conversation with the contact. The send is accepted with 202 and
46
54
  * the affected messages are reported as BLOCKED on GET /messages/{id} and the
47
- * message.blocked webhook.
55
+ * message.blocked webhook. To send later, set scheduled_at (ISO-8601 with an
56
+ * explicit UTC offset; a value without one is rejected) between 1 minute and 30
57
+ * days ahead: the response is a ScheduledSendMessageResponse (the same fields plus
58
+ * scheduled_at; status is still QUEUED), each message then moves to SCHEDULED, is
59
+ * held and released at that time (within a few minutes), and a message.scheduled
60
+ * webhook fires once it is held. Balance and template approval are evaluated at
61
+ * release, not at acceptance. Quiet hours are not checked when the request is
62
+ * accepted: if the time falls inside a legally protected quiet-hours window for a
63
+ * recipient, that message is moved to the next allowed time at release and a
64
+ * second message.scheduled webhook reports the new scheduled_at. An account may
65
+ * hold at most 1,000,000 scheduled messages at once (429 LIMIT_001).
48
66
  *
49
67
  * @example
50
68
  * ```ts
@@ -94,7 +112,11 @@ export declare namespace MessageRetrieveActivitiesResponse {
94
112
  }
95
113
  namespace Data {
96
114
  /**
97
- * A single message activity event for v3 API
115
+ * A single message activity event for v3 API.
116
+ *
117
+ * The activity list mixes statuses, so unlike a message it is one shape rather
118
+ * than two: a SCHEDULED entry carries scheduled_at, and every other entry has no
119
+ * such key.
98
120
  */
99
121
  interface Activity {
100
122
  /**
@@ -118,8 +140,15 @@ export declare namespace MessageRetrieveActivitiesResponse {
118
140
  */
119
141
  price?: string | null;
120
142
  /**
121
- * Activity status. Outbound: QUEUED, PROCESSED, ROUTED, SENT, DELIVERED, READ,
122
- * FAILED. Inbound (from contact): RECEIVED (terminal).
143
+ * SCHEDULED activities only: when the held message will be released for delivery,
144
+ * in UTC. Same wire name as on the send response, the message and the webhook.
145
+ * Omitted on every other activity. A message that quiet hours moved at release has
146
+ * two SCHEDULED entries, each carrying the instant as it stood at that moment.
147
+ */
148
+ scheduled_at?: string | null;
149
+ /**
150
+ * Activity status. Outbound: QUEUED, PROCESSED, ROUTED, SCHEDULED, SENT,
151
+ * DELIVERED, READ, FAILED. Inbound (from contact): RECEIVED (terminal).
123
152
  */
124
153
  status?: string;
125
154
  /**
@@ -134,7 +163,12 @@ export declare namespace MessageRetrieveActivitiesResponse {
134
163
  */
135
164
  export interface MessageRetrieveStatusResponse {
136
165
  /**
137
- * Message response for v3 API — same shape as v2 with snake_case JSON conventions
166
+ * Message response for v3 API — same shape as v2 with snake_case JSON conventions.
167
+ *
168
+ * The shape of a message that was sent immediately: it never has a scheduled_at
169
+ * key. A message that is or was held for a later instant is a
170
+ * ScheduledMessageResponse, and the endpoint decides which of the two to answer
171
+ * with. From always returns this type.
138
172
  */
139
173
  data?: MessageRetrieveStatusResponse.Data | null;
140
174
  /**
@@ -152,7 +186,12 @@ export interface MessageRetrieveStatusResponse {
152
186
  }
153
187
  export declare namespace MessageRetrieveStatusResponse {
154
188
  /**
155
- * Message response for v3 API — same shape as v2 with snake_case JSON conventions
189
+ * Message response for v3 API — same shape as v2 with snake_case JSON conventions.
190
+ *
191
+ * The shape of a message that was sent immediately: it never has a scheduled_at
192
+ * key. A message that is or was held for a later instant is a
193
+ * ScheduledMessageResponse, and the endpoint decides which of the two to answer
194
+ * with. From always returns this type.
156
195
  */
157
196
  interface Data {
158
197
  id?: string;
@@ -165,7 +204,14 @@ export declare namespace MessageRetrieveStatusResponse {
165
204
  events?: Array<Data.Event> | null;
166
205
  /**
167
206
  * Structured message body format for database storage. Preserves channel-specific
168
- * components (header, body, footer, buttons).
207
+ * components (header, header media, body, footer, buttons, MMS subject and media).
208
+ *
209
+ * Persisted as the messageBody jsonb column on Messages. Every write path goes
210
+ * through MessageUtils.MessageBodyJsonOptions, which writes nulls, so the envelope
211
+ * shape is stable regardless of channel or status. Anything that rebuilds this
212
+ * object field by field — the four IMessageBodyStrategy implementations and
213
+ * MessageUtils.BuildSegmentBody — has to carry every member, or that member is
214
+ * silently dropped on whichever path forgot it.
169
215
  */
170
216
  message_body?: Data.MessageBody | null;
171
217
  phone?: string;
@@ -188,13 +234,38 @@ export declare namespace MessageRetrieveStatusResponse {
188
234
  }
189
235
  /**
190
236
  * Structured message body format for database storage. Preserves channel-specific
191
- * components (header, body, footer, buttons).
237
+ * components (header, header media, body, footer, buttons, MMS subject and media).
238
+ *
239
+ * Persisted as the messageBody jsonb column on Messages. Every write path goes
240
+ * through MessageUtils.MessageBodyJsonOptions, which writes nulls, so the envelope
241
+ * shape is stable regardless of channel or status. Anything that rebuilds this
242
+ * object field by field — the four IMessageBodyStrategy implementations and
243
+ * MessageUtils.BuildSegmentBody — has to carry every member, or that member is
244
+ * silently dropped on whichever path forgot it.
192
245
  */
193
246
  interface MessageBody {
194
247
  buttons?: Array<MessageBody.Button> | null;
195
248
  content?: string;
196
249
  footer?: string | null;
197
250
  header?: string | null;
251
+ /**
252
+ * The media asset that rode a message's header, recorded as sent.
253
+ */
254
+ headerMedia?: MessageBody.HeaderMedia | null;
255
+ /**
256
+ * MMS attachments, as the publicly fetchable URLs handed to the carrier. Null on
257
+ * every other channel.
258
+ *
259
+ * Persisted rather than derived because a resend and a curfew release rebuild the
260
+ * send from the stored row — MessageReplayCommandBuilder reads templateId and
261
+ * templateVariables and nothing else — so media that lives only on the original
262
+ * request would silently turn a replayed MMS into a text message.
263
+ */
264
+ media?: Array<MessageBody.Media> | null;
265
+ /**
266
+ * MMS subject line. Null on every other channel.
267
+ */
268
+ subject?: string | null;
198
269
  }
199
270
  namespace MessageBody {
200
271
  interface Button {
@@ -203,6 +274,37 @@ export declare namespace MessageRetrieveStatusResponse {
203
274
  type?: string;
204
275
  value?: string;
205
276
  }
277
+ /**
278
+ * The media asset that rode a message's header, recorded as sent.
279
+ */
280
+ interface HeaderMedia {
281
+ /**
282
+ * "image", "video" or "document" — taken from the header's media variable.
283
+ */
284
+ type?: string;
285
+ /**
286
+ * The https URL the caller supplied for this send. Never the template's stored
287
+ * props.sample, which is Meta's expiring header_handle rather than what was
288
+ * delivered.
289
+ */
290
+ url?: string;
291
+ }
292
+ /**
293
+ * One attachment on a message: a customer-supplied public URL handed to the
294
+ * carrier as-is.
295
+ *
296
+ * A URL and nothing else. sent.dm never takes custody of MMS media — the customer hosts it and we
297
+ * pass the link through at send time — so there is no storage key, size or expiry to record. If we ever
298
+ * do host attachments, that belongs with the change that introduces the hosting, not here.
299
+ */
300
+ interface Media {
301
+ /**
302
+ * One of Constants.MmsMediaTypes when known. Advisory — the carrier reads the
303
+ * fetched object's Content-Type, not this.
304
+ */
305
+ mediaType?: string | null;
306
+ url?: string;
307
+ }
206
308
  }
207
309
  }
208
310
  }
@@ -220,7 +322,9 @@ export interface MessageSendResponse {
220
322
  * its result; this is what a caller sees, and the mapping between them is a
221
323
  * decision the endpoint makes.
222
324
  *
223
- * The wire is unchanged by the move: same names, same values.
325
+ * The shape of an immediate send: it never has a scheduled_at key. A send that
326
+ * carried scheduled_at is a ScheduledSendMessageResponse, and the endpoint decides
327
+ * which of the two to answer with. From always returns this type.
224
328
  */
225
329
  data?: MessageSendResponse.Data | null;
226
330
  /**
@@ -247,12 +351,16 @@ export declare namespace MessageSendResponse {
247
351
  * its result; this is what a caller sees, and the mapping between them is a
248
352
  * decision the endpoint makes.
249
353
  *
250
- * The wire is unchanged by the move: same names, same values.
354
+ * The shape of an immediate send: it never has a scheduled_at key. A send that
355
+ * carried scheduled_at is a ScheduledSendMessageResponse, and the endpoint decides
356
+ * which of the two to answer with. From always returns this type.
251
357
  */
252
358
  interface Data {
253
359
  recipients?: Array<Data.Recipient>;
254
360
  /**
255
- * Overall status — QUEUED once the batch is accepted for delivery.
361
+ * QUEUED: the batch is accepted. A request that carried scheduled_at is QUEUED
362
+ * here too; each message moves to SCHEDULED once it is held, as GET
363
+ * /v3/messages/{id} and the message.scheduled webhook report.
256
364
  */
257
365
  status?: string;
258
366
  template_id?: string;
@@ -304,11 +412,47 @@ export interface MessageSendParams {
304
412
  * ["sent"] (auto-detect) if omitted.
305
413
  */
306
414
  channel?: Array<string> | null;
415
+ /**
416
+ * Body param: Attachments for this send, as publicly fetchable https URLs. Used by
417
+ * the MMS channel and ignored by every other one.
418
+ *
419
+ * Supplying these replaces the media on the template's mms body rather than adding
420
+ * to it, so a template can hold a default creative while a caller still sends
421
+ * something recipient-specific.
422
+ *
423
+ * Their presence is also what makes a message eligible for MMS on an auto-detect
424
+ * send: a message with nothing attached is delivered as SMS, because an MMS with
425
+ * no media is a more expensive text message.
426
+ *
427
+ * The recipient's carrier fetches each URL after the send is accepted, so it must
428
+ * stay publicly reachable — a link that expires, or one behind auth, arrives as a
429
+ * failed message.
430
+ */
431
+ media_urls?: Array<string> | null;
307
432
  /**
308
433
  * Body param: Sandbox flag - when true, the operation is simulated without side
309
434
  * effects Useful for testing integrations without actual execution
310
435
  */
311
436
  sandbox?: boolean;
437
+ /**
438
+ * Body param: Optional future send time as an ISO-8601 timestamp with an explicit
439
+ * UTC offset, e.g. 2026-10-01T09:00:00+02:00 or 2026-10-01T07:00:00Z. A value
440
+ * without an offset is rejected (400) rather than read in the server's zone. The
441
+ * offset only fixes the instant: it is stored and echoed in UTC as scheduled_at.
442
+ * Omit to send now. Must be at least one minute ahead and at most 30 days ahead.
443
+ * Accepted messages report SCHEDULED and are released for delivery at this time.
444
+ * Quiet hours, balance and template approval are evaluated at release, not at
445
+ * acceptance: a message whose time falls inside a recipient's protected
446
+ * quiet-hours window is moved to the next allowed time and a second
447
+ * message.scheduled webhook reports the new scheduled_at.
448
+ */
449
+ scheduled_at?: string | null;
450
+ /**
451
+ * Body param: Subject line for this send, overriding the template's. MMS only;
452
+ * ignored on every other channel. Most handsets render it above the body, some
453
+ * ignore it entirely.
454
+ */
455
+ subject?: string | null;
312
456
  /**
313
457
  * Body param: SDK-style template reference: resolve by ID or by name, with
314
458
  * optional parameters.
@@ -352,7 +496,20 @@ export declare namespace MessageSendParams {
352
496
  */
353
497
  name?: string | null;
354
498
  /**
355
- * Template variable parameters for personalization
499
+ * Template variable parameters for personalization, keyed by variable name.
500
+ *
501
+ * Every variable the template declares is required; GET /v3/templates/{id} lists
502
+ * them. Supplying a key the template does not declare is ignored.
503
+ *
504
+ * Media headers. A template whose header is an image (designed in WhatsApp Manager
505
+ * and imported into Sent) declares a reserved header_image key. Its value is a
506
+ * publicly reachable https URL that Meta fetches at send time — Sent does not host
507
+ * the asset, and the sample approved with the template is not reused. The key is
508
+ * derived from the header's media type, so header_video and header_document follow
509
+ * the same shape when those formats ship.
510
+ *
511
+ * "parameters": { "header_image": "https://cdn.example.com/banner.jpg", "name":
512
+ * "John Doe" }
356
513
  */
357
514
  parameters?: {
358
515
  [key: string]: string;
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,KAAK,WAAW,sBAAmB;AAC1C,OAAO,EAAE,UAAU,EAAE,+BAA4B;AAEjD,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAG7D;;;;;;GAMG;AACH,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;OAUG;IACH,kBAAkB,CAChB,EAAE,EAAE,MAAM,EACV,MAAM,GAAE,+BAA+B,GAAG,IAAI,GAAG,SAAc,EAC/D,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,iCAAiC,CAAC;IAWhD;;;;;;;;;;OAUG;IACH,cAAc,CACZ,EAAE,EAAE,MAAM,EACV,MAAM,GAAE,2BAA2B,GAAG,IAAI,GAAG,SAAc,EAC3D,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,6BAA6B,CAAC;IAW5C;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;CAc3F;AAED;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD;;OAEG;IACH,IAAI,CAAC,EAAE,iCAAiC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,iCAAiC,EAC3E,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
@@ -11,11 +11,15 @@ const path_1 = require("../internal/utils/path.js");
11
11
  * One endpoint sends on any channel: pass `channel: "sent"` and we pick between SMS, WhatsApp and RCS per recipient using your routing rules, or name a channel to pin it. A send is accepted asynchronously — `POST /v3/messages` returns an id, and delivery is reported through `GET /v3/messages/{id}`, its activities, or a webhook.
12
12
  *
13
13
  * **A message needs a sender.** What you can send, where, and at what cost is decided by the markets under **Channels** — so a recipient in a country you hold no sender for is refused here rather than queued.
14
+ *
15
+ * **A message can be resent on its id.** `POST /v3/messages/{id}/resend` puts a finished message — typically one BLOCKED for insufficient balance — back through the send pipeline. It is a new attempt, not a free retry: every policy runs again, the message is billed again, and its status webhooks fire again. A FILTERED message is never resendable.
14
16
  */
15
17
  class Messages extends resource_1.APIResource {
16
18
  /**
17
19
  * Retrieves the activity log for a specific message. Activities track the message
18
- * lifecycle including acceptance, processing, sending, delivery, and any errors.
20
+ * lifecycle including acceptance, processing, sending, delivery, and any errors. A
21
+ * SCHEDULED entry carries scheduled_at, the release instant in UTC as it stood at
22
+ * that moment. Other entries have no scheduled_at key.
19
23
  *
20
24
  * @example
21
25
  * ```ts
@@ -36,7 +40,11 @@ class Messages extends resource_1.APIResource {
36
40
  }
37
41
  /**
38
42
  * Retrieves the current status and details of a message by ID. Includes delivery
39
- * status, timestamps, and error information if applicable.
43
+ * status, timestamps, and error information if applicable. A message that is or
44
+ * was held for a later time (a send you scheduled with scheduled_at, or a
45
+ * quiet-hours hold) is returned as a ScheduledMessageResponse: the same fields
46
+ * plus scheduled_at, the release instant in UTC. A message sent immediately has no
47
+ * scheduled_at key.
40
48
  *
41
49
  * @example
42
50
  * ```ts
@@ -65,7 +73,17 @@ class Messages extends resource_1.APIResource {
65
73
  * insufficient balance, a template not approved for sending, or free-form content
66
74
  * with no open conversation with the contact. The send is accepted with 202 and
67
75
  * the affected messages are reported as BLOCKED on GET /messages/{id} and the
68
- * message.blocked webhook.
76
+ * message.blocked webhook. To send later, set scheduled_at (ISO-8601 with an
77
+ * explicit UTC offset; a value without one is rejected) between 1 minute and 30
78
+ * days ahead: the response is a ScheduledSendMessageResponse (the same fields plus
79
+ * scheduled_at; status is still QUEUED), each message then moves to SCHEDULED, is
80
+ * held and released at that time (within a few minutes), and a message.scheduled
81
+ * webhook fires once it is held. Balance and template approval are evaluated at
82
+ * release, not at acceptance. Quiet hours are not checked when the request is
83
+ * accepted: if the time falls inside a legally protected quiet-hours window for a
84
+ * recipient, that message is moved to the next allowed time at release and a
85
+ * second message.scheduled webhook reports the new scheduled_at. An account may
86
+ * hold at most 1,000,000 scheduled messages at once (429 LIMIT_001).
69
87
  *
70
88
  * @example
71
89
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAAmD;AAEnD,oDAA8C;AAE9C;;;;;;GAMG;AACH,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;;;OAUG;IACH,kBAAkB,CAChB,EAAU,EACV,SAA6D,EAAE,EAC/D,OAAwB;QAExB,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gBAAgB,EAAE,aAAa,EAAE;YAC3D,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB,EAAE,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC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iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC1F,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE;YACvC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB;oBACE,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;oBAC/E,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;iBACrE;gBACD,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AApGD,4BAoGC"}
@@ -8,11 +8,15 @@ import { path } from "../internal/utils/path.mjs";
8
8
  * One endpoint sends on any channel: pass `channel: "sent"` and we pick between SMS, WhatsApp and RCS per recipient using your routing rules, or name a channel to pin it. A send is accepted asynchronously — `POST /v3/messages` returns an id, and delivery is reported through `GET /v3/messages/{id}`, its activities, or a webhook.
9
9
  *
10
10
  * **A message needs a sender.** What you can send, where, and at what cost is decided by the markets under **Channels** — so a recipient in a country you hold no sender for is refused here rather than queued.
11
+ *
12
+ * **A message can be resent on its id.** `POST /v3/messages/{id}/resend` puts a finished message — typically one BLOCKED for insufficient balance — back through the send pipeline. It is a new attempt, not a free retry: every policy runs again, the message is billed again, and its status webhooks fire again. A FILTERED message is never resendable.
11
13
  */
12
14
  export class Messages extends APIResource {
13
15
  /**
14
16
  * Retrieves the activity log for a specific message. Activities track the message
15
- * lifecycle including acceptance, processing, sending, delivery, and any errors.
17
+ * lifecycle including acceptance, processing, sending, delivery, and any errors. A
18
+ * SCHEDULED entry carries scheduled_at, the release instant in UTC as it stood at
19
+ * that moment. Other entries have no scheduled_at key.
16
20
  *
17
21
  * @example
18
22
  * ```ts
@@ -33,7 +37,11 @@ export class Messages extends APIResource {
33
37
  }
34
38
  /**
35
39
  * Retrieves the current status and details of a message by ID. Includes delivery
36
- * status, timestamps, and error information if applicable.
40
+ * status, timestamps, and error information if applicable. A message that is or
41
+ * was held for a later time (a send you scheduled with scheduled_at, or a
42
+ * quiet-hours hold) is returned as a ScheduledMessageResponse: the same fields
43
+ * plus scheduled_at, the release instant in UTC. A message sent immediately has no
44
+ * scheduled_at key.
37
45
  *
38
46
  * @example
39
47
  * ```ts
@@ -62,7 +70,17 @@ export class Messages extends APIResource {
62
70
  * insufficient balance, a template not approved for sending, or free-form content
63
71
  * with no open conversation with the contact. The send is accepted with 202 and
64
72
  * the affected messages are reported as BLOCKED on GET /messages/{id} and the
65
- * message.blocked webhook.
73
+ * message.blocked webhook. To send later, set scheduled_at (ISO-8601 with an
74
+ * explicit UTC offset; a value without one is rejected) between 1 minute and 30
75
+ * days ahead: the response is a ScheduledSendMessageResponse (the same fields plus
76
+ * scheduled_at; status is still QUEUED), each message then moves to SCHEDULED, is
77
+ * held and released at that time (within a few minutes), and a message.scheduled
78
+ * webhook fires once it is held. Balance and template approval are evaluated at
79
+ * release, not at acceptance. Quiet hours are not checked when the request is
80
+ * accepted: if the time falls inside a legally protected quiet-hours window for a
81
+ * recipient, that message is moved to the next allowed time at release and a
82
+ * second message.scheduled webhook reports the new scheduled_at. An account may
83
+ * hold at most 1,000,000 scheduled messages at once (429 LIMIT_001).
66
84
  *
67
85
  * @example
68
86
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAG/C,OAAO,EAAE,YAAY,EAAE,gCAA4B;AAEnD,OAAO,EAAE,IAAI,EAAE,mCAA+B;AAE9C;;;;;;GAMG;AACH,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;OA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