@sentdm/sentdm 0.42.0 → 0.44.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 (44) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/client.d.mts +2 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -0
  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/calls/calls.d.mts +10 -8
  12. package/resources/calls/calls.d.mts.map +1 -1
  13. package/resources/calls/calls.d.ts +10 -8
  14. package/resources/calls/calls.d.ts.map +1 -1
  15. package/resources/calls/calls.js +5 -4
  16. package/resources/calls/calls.js.map +1 -1
  17. package/resources/calls/calls.mjs +5 -4
  18. package/resources/calls/calls.mjs.map +1 -1
  19. package/resources/calls/participants.d.mts +5 -5
  20. package/resources/calls/participants.d.ts +5 -5
  21. package/resources/calls/participants.js +5 -5
  22. package/resources/calls/participants.mjs +5 -5
  23. package/resources/messages.d.mts +89 -16
  24. package/resources/messages.d.mts.map +1 -1
  25. package/resources/messages.d.ts +89 -16
  26. package/resources/messages.d.ts.map +1 -1
  27. package/resources/messages.js +37 -12
  28. package/resources/messages.js.map +1 -1
  29. package/resources/messages.mjs +37 -12
  30. package/resources/messages.mjs.map +1 -1
  31. package/resources/webhooks.d.mts +8 -3
  32. package/resources/webhooks.d.mts.map +1 -1
  33. package/resources/webhooks.d.ts +8 -3
  34. package/resources/webhooks.d.ts.map +1 -1
  35. package/src/client.ts +2 -0
  36. package/src/resources/calls/calls.ts +10 -8
  37. package/src/resources/calls/participants.ts +5 -5
  38. package/src/resources/messages.ts +91 -16
  39. package/src/resources/webhooks.ts +8 -3
  40. package/src/version.ts +1 -1
  41. package/version.d.mts +1 -1
  42. package/version.d.ts +1 -1
  43. package/version.js +1 -1
  44. package/version.mjs +1 -1
@@ -50,11 +50,11 @@ export declare class Participants extends APIResource {
50
50
  * conference room, and answers with the participant's own call record. The
51
51
  * participant is a call of their own: it has its own id, can be looked up and hung
52
52
  * up, and is billed and reported through call.completed and call.failed like any
53
- * other call. A phone participant is called from caller_id, which must be one of
54
- * your numbers, or from the call's owning number when omitted, and needs a
55
- * destination you may call and a positive balance. Only a call your answer
56
- * connected to a conference can take participants: a call connected to a user or a
57
- * number answers 409.
53
+ * other call. Every participant needs a positive balance. A phone participant is
54
+ * called from caller_id, which must be one of your numbers, or from the call's
55
+ * owning number when omitted, and needs a destination you may call. Only a call
56
+ * your answer connected to a conference can take participants: a call connected to
57
+ * a user or a number answers 409.
58
58
  *
59
59
  * @example
60
60
  * ```ts
@@ -50,11 +50,11 @@ export declare class Participants extends APIResource {
50
50
  * conference room, and answers with the participant's own call record. The
51
51
  * participant is a call of their own: it has its own id, can be looked up and hung
52
52
  * up, and is billed and reported through call.completed and call.failed like any
53
- * other call. A phone participant is called from caller_id, which must be one of
54
- * your numbers, or from the call's owning number when omitted, and needs a
55
- * destination you may call and a positive balance. Only a call your answer
56
- * connected to a conference can take participants: a call connected to a user or a
57
- * number answers 409.
53
+ * other call. Every participant needs a positive balance. A phone participant is
54
+ * called from caller_id, which must be one of your numbers, or from the call's
55
+ * owning number when omitted, and needs a destination you may call. Only a call
56
+ * your answer connected to a conference can take participants: a call connected to
57
+ * a user or a number answers 409.
58
58
  *
59
59
  * @example
60
60
  * ```ts
@@ -75,11 +75,11 @@ class Participants extends resource_1.APIResource {
75
75
  * conference room, and answers with the participant's own call record. The
76
76
  * participant is a call of their own: it has its own id, can be looked up and hung
77
77
  * up, and is billed and reported through call.completed and call.failed like any
78
- * other call. A phone participant is called from caller_id, which must be one of
79
- * your numbers, or from the call's owning number when omitted, and needs a
80
- * destination you may call and a positive balance. Only a call your answer
81
- * connected to a conference can take participants: a call connected to a user or a
82
- * number answers 409.
78
+ * other call. Every participant needs a positive balance. A phone participant is
79
+ * called from caller_id, which must be one of your numbers, or from the call's
80
+ * owning number when omitted, and needs a destination you may call. Only a call
81
+ * your answer connected to a conference can take participants: a call connected to
82
+ * a user or a number answers 409.
83
83
  *
84
84
  * @example
85
85
  * ```ts
@@ -72,11 +72,11 @@ export class Participants extends APIResource {
72
72
  * conference room, and answers with the participant's own call record. The
73
73
  * participant is a call of their own: it has its own id, can be looked up and hung
74
74
  * up, and is billed and reported through call.completed and call.failed like any
75
- * other call. A phone participant is called from caller_id, which must be one of
76
- * your numbers, or from the call's owning number when omitted, and needs a
77
- * destination you may call and a positive balance. Only a call your answer
78
- * connected to a conference can take participants: a call connected to a user or a
79
- * number answers 409.
75
+ * other call. Every participant needs a positive balance. A phone participant is
76
+ * called from caller_id, which must be one of your numbers, or from the call's
77
+ * owning number when omitted, and needs a destination you may call. Only a call
78
+ * your answer connected to a conference can take participants: a call connected to
79
+ * a user or a number answers 409.
80
80
  *
81
81
  * @example
82
82
  * ```ts
@@ -10,6 +10,8 @@ import { RequestOptions } from "../internal/request-options.mjs";
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
11
  *
12
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.
13
+ *
14
+ * **A scheduled message can be called off.** `POST /v3/messages/{id}/cancel` cancels a send you scheduled with `scheduled_at`, as long as it has not been released yet. Cancelling is free, fires `message.cancelled`, and is final — a cancelled message cannot be resent.
13
15
  */
14
16
  export declare class Messages extends APIResource {
15
17
  /**
@@ -29,10 +31,11 @@ export declare class Messages extends APIResource {
29
31
  /**
30
32
  * Retrieves the current status and details of a message by ID. Includes delivery
31
33
  * 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.
34
+ * was held for a later time (a send you scheduled with scheduled_at, a quiet-hours
35
+ * hold, or a message you cancelled while it was held) is returned as a
36
+ * ScheduledMessageResponse: the same fields plus scheduled_at, the instant it is
37
+ * held for in UTC — or, on a CANCELLED message, the instant that was called off. A
38
+ * message sent immediately has no scheduled_at key.
36
39
  *
37
40
  * @example
38
41
  * ```ts
@@ -46,13 +49,27 @@ export declare class Messages extends APIResource {
46
49
  * Sends a message to one or more recipients using a template. Supports
47
50
  * multi-channel broadcast — when multiple channels are specified (e.g. ["sms",
48
51
  * "whatsapp"]), a separate message is created for each (recipient, channel) pair.
49
- * Returns immediately with per-recipient message IDs for async tracking via
50
- * webhooks or the GET /messages/{id} endpoint. Sends gated before any delivery
51
- * attempt do not reject the request — an account-level precondition such as
52
- * insufficient balance, a template not approved for sending, or free-form content
53
- * with no open conversation with the contact. The send is accepted with 202 and
54
- * the affected messages are reported as BLOCKED on GET /messages/{id} and the
55
- * message.blocked webhook. To send later, set scheduled_at (ISO-8601 with an
52
+ * To choose which of your own numbers a send goes out from, use 'channels':
53
+ * {"sms": [{"from": ["+12125550000", "+14155550000"]}]}. Each channel holds a list
54
+ * of entries, each with 'from' and optionally 'country' and 'strategy'; 'country'
55
+ * and 'strategy' are stored but not acted on yet, so every entry's numbers apply
56
+ * to every recipient on that channel. Every number listed must be an active sender
57
+ * on your account. Like the other account-level preconditions below, that is
58
+ * checked per message rather than when the request is received: the request is
59
+ * still accepted with 202, and each affected message is reported as BLOCKED with
60
+ * error code BUSINESS_029 on GET /messages/{id} and the message.blocked webhook.
61
+ * Each channel's numbers restrict which numbers that channel may use; it does not
62
+ * choose channels — 'channel' does, and the two can be combined. With 'channel'
63
+ * left at auto-detect, a recipient best served by a channel you listed no numbers
64
+ * for still goes out on it. Where several of the listed numbers could serve a
65
+ * recipient, routing prefers the one whose area code matches theirs. Keys: sms,
66
+ * whatsapp, rcs, mms. Returns immediately with per-recipient message IDs for async
67
+ * tracking via webhooks or the GET /messages/{id} endpoint. Sends gated before any
68
+ * delivery attempt do not reject the request — an account-level precondition such
69
+ * as insufficient balance, a template not approved for sending, or free-form
70
+ * content with no open conversation with the contact. The send is accepted with
71
+ * 202 and the affected messages are reported as BLOCKED on GET /messages/{id} and
72
+ * the message.blocked webhook. To send later, set scheduled_at (ISO-8601 with an
56
73
  * explicit UTC offset; a value without one is rejected) between 1 minute and 30
57
74
  * days ahead: the response is a ScheduledSendMessageResponse (the same fields plus
58
75
  * scheduled_at; status is still QUEUED), each message then moves to SCHEDULED, is
@@ -66,7 +83,15 @@ export declare class Messages extends APIResource {
66
83
  *
67
84
  * @example
68
85
  * ```ts
69
- * const response = await client.messages.send();
86
+ * const response = await client.messages.send({
87
+ * channel: ['sms', 'whatsapp'],
88
+ * template: {
89
+ * id: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
90
+ * name: 'order_confirmation',
91
+ * parameters: { name: 'John Doe', order_id: '12345' },
92
+ * },
93
+ * to: ['+14155551234', '+14155555678'],
94
+ * });
70
95
  * ```
71
96
  */
72
97
  send(params: MessageSendParams, options?: RequestOptions): APIPromise<MessageSendResponse>;
@@ -153,10 +178,12 @@ export declare namespace MessageRetrieveActivitiesResponse {
153
178
  */
154
179
  reason_code?: string | null;
155
180
  /**
156
- * SCHEDULED activities only: when the held message will be released for delivery,
157
- * in UTC. Same wire name as on the send response, the message and the webhook.
158
- * Omitted on every other activity. A message that quiet hours moved at release has
159
- * two SCHEDULED entries, each carrying the instant as it stood at that moment.
181
+ * SCHEDULED and CANCELLED activities only, in UTC: on a SCHEDULED entry, when the
182
+ * held message will be released for delivery; on a CANCELLED entry, the instant
183
+ * that was called off. Same wire name as on the send response, the message and the
184
+ * webhook. Omitted on every other activity. A message that quiet hours moved at
185
+ * release has two SCHEDULED entries, each carrying the instant as it stood at that
186
+ * moment.
160
187
  */
161
188
  scheduled_at?: string | null;
162
189
  /**
@@ -480,6 +507,29 @@ export interface MessageSendParams {
480
507
  * ["sent"] (auto-detect) if omitted.
481
508
  */
482
509
  channel?: Array<string> | null;
510
+ /**
511
+ * Body param: Which of your own numbers to send from, keyed by channel, each
512
+ * channel holding a list of entries: {"sms": [{"country": "US", "from":
513
+ * ["+12125550000", "+14155550000"]}, {"from": ["+447700800001"]}]}. Any real
514
+ * channel may be a key; sent, which is auto-detect rather than a channel, is
515
+ * rejected. country and strategy are accepted and stored but not acted on yet:
516
+ * every entry's numbers apply to every recipient on that channel.
517
+ *
518
+ * This does not choose channels — Channel does, and the two combine: "channel":
519
+ * ["sms"] with an sms list sends on SMS from those numbers. Each list only narrows
520
+ * which of its own channel's routes may win, so with Channel left at auto-detect a
521
+ * recipient best served by a channel with no list still goes out on it. Routing
522
+ * itself is unchanged: the same rules are scored and ranked the same way, with
523
+ * routes pinned to numbers you did not list removed from the running.
524
+ *
525
+ * Every number must be an active sender on your account. The request itself is
526
+ * still accepted (202) if one is not — like every other send-time rule, that is
527
+ * decided per message, so each affected message is recorded BLOCKED with error
528
+ * code BUSINESS_029 and reported on GET /v3/messages and the status webhook.
529
+ */
530
+ channels?: {
531
+ [key: string]: Array<MessageSendParams.Channel>;
532
+ } | null;
483
533
  /**
484
534
  * Body param: Attachments for this send, as publicly fetchable https URLs. Used by
485
535
  * the MMS channel and ignored by every other one.
@@ -550,6 +600,29 @@ export interface MessageSendParams {
550
600
  'x-profile-id'?: string;
551
601
  }
552
602
  export declare namespace MessageSendParams {
603
+ /**
604
+ * One entry of a channel's list in Channels, e.g. {"country": "US", "from":
605
+ * ["+15559990002", "+15559990003"], "strategy": "sticky"}.
606
+ */
607
+ interface Channel {
608
+ /**
609
+ * Recipient country this entry is meant for (ISO 3166-1 alpha-2, e.g. US).
610
+ * Optional. Accepted and stored, not acted on yet.
611
+ */
612
+ country?: string | null;
613
+ /**
614
+ * Sender numbers in E.164. Each must be an active sender on your account for this
615
+ * channel. That is account state rather than request shape, so it is decided per
616
+ * message: the request is accepted with 202 and a message naming an unusable
617
+ * number is recorded BLOCKED with error code BUSINESS_029.
618
+ */
619
+ from?: Array<string> | null;
620
+ /**
621
+ * How to pick a number from From, e.g. sticky or geo. Optional. Accepted and
622
+ * stored, not acted on yet.
623
+ */
624
+ strategy?: string | null;
625
+ }
553
626
  /**
554
627
  * SDK-style template reference: resolve by ID or by name, with optional
555
628
  * parameters.
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.mts","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAC/C,OAAO,KAAK,WAAW,uBAAmB;AAC1C,OAAO,EAAE,UAAU,EAAE,gCAA4B;AAEjD,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAG7D;;;;;;;;GAQG;AACH,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;;;OAYG;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;;;;;;;;;;;;;;OAcG;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;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;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,CAAC,IAAI,GAAG,IAAI,CAAC;IAErD;;OAEG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC;IAEvC;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW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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"}
@@ -10,6 +10,8 @@ import { RequestOptions } from "../internal/request-options.js";
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
11
  *
12
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.
13
+ *
14
+ * **A scheduled message can be called off.** `POST /v3/messages/{id}/cancel` cancels a send you scheduled with `scheduled_at`, as long as it has not been released yet. Cancelling is free, fires `message.cancelled`, and is final — a cancelled message cannot be resent.
13
15
  */
14
16
  export declare class Messages extends APIResource {
15
17
  /**
@@ -29,10 +31,11 @@ export declare class Messages extends APIResource {
29
31
  /**
30
32
  * Retrieves the current status and details of a message by ID. Includes delivery
31
33
  * 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.
34
+ * was held for a later time (a send you scheduled with scheduled_at, a quiet-hours
35
+ * hold, or a message you cancelled while it was held) is returned as a
36
+ * ScheduledMessageResponse: the same fields plus scheduled_at, the instant it is
37
+ * held for in UTC — or, on a CANCELLED message, the instant that was called off. A
38
+ * message sent immediately has no scheduled_at key.
36
39
  *
37
40
  * @example
38
41
  * ```ts
@@ -46,13 +49,27 @@ export declare class Messages extends APIResource {
46
49
  * Sends a message to one or more recipients using a template. Supports
47
50
  * multi-channel broadcast — when multiple channels are specified (e.g. ["sms",
48
51
  * "whatsapp"]), a separate message is created for each (recipient, channel) pair.
49
- * Returns immediately with per-recipient message IDs for async tracking via
50
- * webhooks or the GET /messages/{id} endpoint. Sends gated before any delivery
51
- * attempt do not reject the request — an account-level precondition such as
52
- * insufficient balance, a template not approved for sending, or free-form content
53
- * with no open conversation with the contact. The send is accepted with 202 and
54
- * the affected messages are reported as BLOCKED on GET /messages/{id} and the
55
- * message.blocked webhook. To send later, set scheduled_at (ISO-8601 with an
52
+ * To choose which of your own numbers a send goes out from, use 'channels':
53
+ * {"sms": [{"from": ["+12125550000", "+14155550000"]}]}. Each channel holds a list
54
+ * of entries, each with 'from' and optionally 'country' and 'strategy'; 'country'
55
+ * and 'strategy' are stored but not acted on yet, so every entry's numbers apply
56
+ * to every recipient on that channel. Every number listed must be an active sender
57
+ * on your account. Like the other account-level preconditions below, that is
58
+ * checked per message rather than when the request is received: the request is
59
+ * still accepted with 202, and each affected message is reported as BLOCKED with
60
+ * error code BUSINESS_029 on GET /messages/{id} and the message.blocked webhook.
61
+ * Each channel's numbers restrict which numbers that channel may use; it does not
62
+ * choose channels — 'channel' does, and the two can be combined. With 'channel'
63
+ * left at auto-detect, a recipient best served by a channel you listed no numbers
64
+ * for still goes out on it. Where several of the listed numbers could serve a
65
+ * recipient, routing prefers the one whose area code matches theirs. Keys: sms,
66
+ * whatsapp, rcs, mms. Returns immediately with per-recipient message IDs for async
67
+ * tracking via webhooks or the GET /messages/{id} endpoint. Sends gated before any
68
+ * delivery attempt do not reject the request — an account-level precondition such
69
+ * as insufficient balance, a template not approved for sending, or free-form
70
+ * content with no open conversation with the contact. The send is accepted with
71
+ * 202 and the affected messages are reported as BLOCKED on GET /messages/{id} and
72
+ * the message.blocked webhook. To send later, set scheduled_at (ISO-8601 with an
56
73
  * explicit UTC offset; a value without one is rejected) between 1 minute and 30
57
74
  * days ahead: the response is a ScheduledSendMessageResponse (the same fields plus
58
75
  * scheduled_at; status is still QUEUED), each message then moves to SCHEDULED, is
@@ -66,7 +83,15 @@ export declare class Messages extends APIResource {
66
83
  *
67
84
  * @example
68
85
  * ```ts
69
- * const response = await client.messages.send();
86
+ * const response = await client.messages.send({
87
+ * channel: ['sms', 'whatsapp'],
88
+ * template: {
89
+ * id: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
90
+ * name: 'order_confirmation',
91
+ * parameters: { name: 'John Doe', order_id: '12345' },
92
+ * },
93
+ * to: ['+14155551234', '+14155555678'],
94
+ * });
70
95
  * ```
71
96
  */
72
97
  send(params: MessageSendParams, options?: RequestOptions): APIPromise<MessageSendResponse>;
@@ -153,10 +178,12 @@ export declare namespace MessageRetrieveActivitiesResponse {
153
178
  */
154
179
  reason_code?: string | null;
155
180
  /**
156
- * SCHEDULED activities only: when the held message will be released for delivery,
157
- * in UTC. Same wire name as on the send response, the message and the webhook.
158
- * Omitted on every other activity. A message that quiet hours moved at release has
159
- * two SCHEDULED entries, each carrying the instant as it stood at that moment.
181
+ * SCHEDULED and CANCELLED activities only, in UTC: on a SCHEDULED entry, when the
182
+ * held message will be released for delivery; on a CANCELLED entry, the instant
183
+ * that was called off. Same wire name as on the send response, the message and the
184
+ * webhook. Omitted on every other activity. A message that quiet hours moved at
185
+ * release has two SCHEDULED entries, each carrying the instant as it stood at that
186
+ * moment.
160
187
  */
161
188
  scheduled_at?: string | null;
162
189
  /**
@@ -480,6 +507,29 @@ export interface MessageSendParams {
480
507
  * ["sent"] (auto-detect) if omitted.
481
508
  */
482
509
  channel?: Array<string> | null;
510
+ /**
511
+ * Body param: Which of your own numbers to send from, keyed by channel, each
512
+ * channel holding a list of entries: {"sms": [{"country": "US", "from":
513
+ * ["+12125550000", "+14155550000"]}, {"from": ["+447700800001"]}]}. Any real
514
+ * channel may be a key; sent, which is auto-detect rather than a channel, is
515
+ * rejected. country and strategy are accepted and stored but not acted on yet:
516
+ * every entry's numbers apply to every recipient on that channel.
517
+ *
518
+ * This does not choose channels — Channel does, and the two combine: "channel":
519
+ * ["sms"] with an sms list sends on SMS from those numbers. Each list only narrows
520
+ * which of its own channel's routes may win, so with Channel left at auto-detect a
521
+ * recipient best served by a channel with no list still goes out on it. Routing
522
+ * itself is unchanged: the same rules are scored and ranked the same way, with
523
+ * routes pinned to numbers you did not list removed from the running.
524
+ *
525
+ * Every number must be an active sender on your account. The request itself is
526
+ * still accepted (202) if one is not — like every other send-time rule, that is
527
+ * decided per message, so each affected message is recorded BLOCKED with error
528
+ * code BUSINESS_029 and reported on GET /v3/messages and the status webhook.
529
+ */
530
+ channels?: {
531
+ [key: string]: Array<MessageSendParams.Channel>;
532
+ } | null;
483
533
  /**
484
534
  * Body param: Attachments for this send, as publicly fetchable https URLs. Used by
485
535
  * the MMS channel and ignored by every other one.
@@ -550,6 +600,29 @@ export interface MessageSendParams {
550
600
  'x-profile-id'?: string;
551
601
  }
552
602
  export declare namespace MessageSendParams {
603
+ /**
604
+ * One entry of a channel's list in Channels, e.g. {"country": "US", "from":
605
+ * ["+15559990002", "+15559990003"], "strategy": "sticky"}.
606
+ */
607
+ interface Channel {
608
+ /**
609
+ * Recipient country this entry is meant for (ISO 3166-1 alpha-2, e.g. US).
610
+ * Optional. Accepted and stored, not acted on yet.
611
+ */
612
+ country?: string | null;
613
+ /**
614
+ * Sender numbers in E.164. Each must be an active sender on your account for this
615
+ * channel. That is account state rather than request shape, so it is decided per
616
+ * message: the request is accepted with 202 and a message naming an unusable
617
+ * number is recorded BLOCKED with error code BUSINESS_029.
618
+ */
619
+ from?: Array<string> | null;
620
+ /**
621
+ * How to pick a number from From, e.g. sticky or geo. Optional. Accepted and
622
+ * stored, not acted on yet.
623
+ */
624
+ strategy?: string | null;
625
+ }
553
626
  /**
554
627
  * SDK-style template reference: resolve by ID or by name, with optional
555
628
  * parameters.
@@ -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,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AC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEnB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,yBAAiB,iBAAiB,CAAC;IACjC;;;OAGG;IACH,UAAiB,OAAO;QACtB;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAExB;;;;;WAKG;QACH,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QAE5B;;;WAGG;QACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B;IAED;;;OAGG;IACH,UAAiB,QAAQ;QACvB;;WAEG;QACH,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAEnB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAErB;;;;;;;;;;;;;;;WAeG;QACH,UAAU,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC;KAC/C;CACF;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,iCAAiC,IAAI,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"}
@@ -13,6 +13,8 @@ const path_1 = require("../internal/utils/path.js");
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
14
  *
15
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.
16
+ *
17
+ * **A scheduled message can be called off.** `POST /v3/messages/{id}/cancel` cancels a send you scheduled with `scheduled_at`, as long as it has not been released yet. Cancelling is free, fires `message.cancelled`, and is final — a cancelled message cannot be resent.
16
18
  */
17
19
  class Messages extends resource_1.APIResource {
18
20
  /**
@@ -41,10 +43,11 @@ class Messages extends resource_1.APIResource {
41
43
  /**
42
44
  * Retrieves the current status and details of a message by ID. Includes delivery
43
45
  * 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.
46
+ * was held for a later time (a send you scheduled with scheduled_at, a quiet-hours
47
+ * hold, or a message you cancelled while it was held) is returned as a
48
+ * ScheduledMessageResponse: the same fields plus scheduled_at, the instant it is
49
+ * held for in UTC — or, on a CANCELLED message, the instant that was called off. A
50
+ * message sent immediately has no scheduled_at key.
48
51
  *
49
52
  * @example
50
53
  * ```ts
@@ -67,13 +70,27 @@ class Messages extends resource_1.APIResource {
67
70
  * Sends a message to one or more recipients using a template. Supports
68
71
  * multi-channel broadcast — when multiple channels are specified (e.g. ["sms",
69
72
  * "whatsapp"]), a separate message is created for each (recipient, channel) pair.
70
- * Returns immediately with per-recipient message IDs for async tracking via
71
- * webhooks or the GET /messages/{id} endpoint. Sends gated before any delivery
72
- * attempt do not reject the request — an account-level precondition such as
73
- * insufficient balance, a template not approved for sending, or free-form content
74
- * with no open conversation with the contact. The send is accepted with 202 and
75
- * the affected messages are reported as BLOCKED on GET /messages/{id} and the
76
- * message.blocked webhook. To send later, set scheduled_at (ISO-8601 with an
73
+ * To choose which of your own numbers a send goes out from, use 'channels':
74
+ * {"sms": [{"from": ["+12125550000", "+14155550000"]}]}. Each channel holds a list
75
+ * of entries, each with 'from' and optionally 'country' and 'strategy'; 'country'
76
+ * and 'strategy' are stored but not acted on yet, so every entry's numbers apply
77
+ * to every recipient on that channel. Every number listed must be an active sender
78
+ * on your account. Like the other account-level preconditions below, that is
79
+ * checked per message rather than when the request is received: the request is
80
+ * still accepted with 202, and each affected message is reported as BLOCKED with
81
+ * error code BUSINESS_029 on GET /messages/{id} and the message.blocked webhook.
82
+ * Each channel's numbers restrict which numbers that channel may use; it does not
83
+ * choose channels — 'channel' does, and the two can be combined. With 'channel'
84
+ * left at auto-detect, a recipient best served by a channel you listed no numbers
85
+ * for still goes out on it. Where several of the listed numbers could serve a
86
+ * recipient, routing prefers the one whose area code matches theirs. Keys: sms,
87
+ * whatsapp, rcs, mms. Returns immediately with per-recipient message IDs for async
88
+ * tracking via webhooks or the GET /messages/{id} endpoint. Sends gated before any
89
+ * delivery attempt do not reject the request — an account-level precondition such
90
+ * as insufficient balance, a template not approved for sending, or free-form
91
+ * content with no open conversation with the contact. The send is accepted with
92
+ * 202 and the affected messages are reported as BLOCKED on GET /messages/{id} and
93
+ * the message.blocked webhook. To send later, set scheduled_at (ISO-8601 with an
77
94
  * explicit UTC offset; a value without one is rejected) between 1 minute and 30
78
95
  * days ahead: the response is a ScheduledSendMessageResponse (the same fields plus
79
96
  * scheduled_at; status is still QUEUED), each message then moves to SCHEDULED, is
@@ -87,7 +104,15 @@ class Messages extends resource_1.APIResource {
87
104
  *
88
105
  * @example
89
106
  * ```ts
90
- * const response = await client.messages.send();
107
+ * const response = await client.messages.send({
108
+ * channel: ['sms', 'whatsapp'],
109
+ * template: {
110
+ * id: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
111
+ * name: 'order_confirmation',
112
+ * parameters: { name: 'John Doe', order_id: '12345' },
113
+ * },
114
+ * to: ['+14155551234', '+14155555678'],
115
+ * });
91
116
  * ```
92
117
  */
93
118
  send(params, options) {
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,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