@sentdm/sentdm 0.7.2 → 0.14.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 (161) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/README.md +71 -34
  3. package/client.d.mts +49 -21
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +49 -21
  6. package/client.d.ts.map +1 -1
  7. package/client.js +52 -38
  8. package/client.js.map +1 -1
  9. package/client.mjs +52 -38
  10. package/client.mjs.map +1 -1
  11. package/internal/tslib.js +17 -17
  12. package/internal/utils/log.d.mts.map +1 -1
  13. package/internal/utils/log.d.ts.map +1 -1
  14. package/internal/utils/log.js +0 -1
  15. package/internal/utils/log.js.map +1 -1
  16. package/internal/utils/log.mjs +0 -1
  17. package/internal/utils/log.mjs.map +1 -1
  18. package/internal/utils/query.d.mts +5 -0
  19. package/internal/utils/query.d.mts.map +1 -0
  20. package/internal/utils/query.d.ts +5 -0
  21. package/internal/utils/query.d.ts.map +1 -0
  22. package/internal/utils/query.js +23 -0
  23. package/internal/utils/query.js.map +1 -0
  24. package/internal/utils/query.mjs +20 -0
  25. package/internal/utils/query.mjs.map +1 -0
  26. package/internal/utils.d.mts +1 -0
  27. package/internal/utils.d.ts +1 -0
  28. package/internal/utils.js +1 -0
  29. package/internal/utils.js.map +1 -1
  30. package/internal/utils.mjs +1 -0
  31. package/package.json +7 -1
  32. package/resources/contacts.d.mts +243 -49
  33. package/resources/contacts.d.mts.map +1 -1
  34. package/resources/contacts.d.ts +243 -49
  35. package/resources/contacts.d.ts.map +1 -1
  36. package/resources/contacts.js +112 -15
  37. package/resources/contacts.js.map +1 -1
  38. package/resources/contacts.mjs +112 -15
  39. package/resources/contacts.mjs.map +1 -1
  40. package/resources/index.d.mts +8 -4
  41. package/resources/index.d.mts.map +1 -1
  42. package/resources/index.d.ts +8 -4
  43. package/resources/index.d.ts.map +1 -1
  44. package/resources/index.js +11 -3
  45. package/resources/index.js.map +1 -1
  46. package/resources/index.mjs +5 -1
  47. package/resources/index.mjs.map +1 -1
  48. package/resources/me.d.mts +269 -0
  49. package/resources/me.d.mts.map +1 -0
  50. package/resources/me.d.ts +269 -0
  51. package/resources/me.d.ts.map +1 -0
  52. package/resources/me.js +40 -0
  53. package/resources/me.js.map +1 -0
  54. package/resources/me.mjs +36 -0
  55. package/resources/me.mjs.map +1 -0
  56. package/resources/messages.d.mts +239 -133
  57. package/resources/messages.d.mts.map +1 -1
  58. package/resources/messages.d.ts +239 -133
  59. package/resources/messages.d.ts.map +1 -1
  60. package/resources/messages.js +42 -50
  61. package/resources/messages.js.map +1 -1
  62. package/resources/messages.mjs +42 -50
  63. package/resources/messages.mjs.map +1 -1
  64. package/resources/numbers.d.mts +70 -0
  65. package/resources/numbers.d.mts.map +1 -0
  66. package/resources/numbers.d.ts +70 -0
  67. package/resources/numbers.d.ts.map +1 -0
  68. package/resources/numbers.js +36 -0
  69. package/resources/numbers.js.map +1 -0
  70. package/resources/numbers.mjs +32 -0
  71. package/resources/numbers.mjs.map +1 -0
  72. package/resources/profiles/campaigns.d.mts +339 -0
  73. package/resources/profiles/campaigns.d.mts.map +1 -0
  74. package/resources/profiles/campaigns.d.ts +339 -0
  75. package/resources/profiles/campaigns.d.ts.map +1 -0
  76. package/resources/profiles/campaigns.js +148 -0
  77. package/resources/profiles/campaigns.js.map +1 -0
  78. package/resources/profiles/campaigns.mjs +144 -0
  79. package/resources/profiles/campaigns.mjs.map +1 -0
  80. package/resources/profiles/index.d.mts +3 -0
  81. package/resources/profiles/index.d.mts.map +1 -0
  82. package/resources/profiles/index.d.ts +3 -0
  83. package/resources/profiles/index.d.ts.map +1 -0
  84. package/resources/profiles/index.js +9 -0
  85. package/resources/profiles/index.js.map +1 -0
  86. package/resources/profiles/index.mjs +4 -0
  87. package/resources/profiles/index.mjs.map +1 -0
  88. package/resources/profiles/profiles.d.mts +967 -0
  89. package/resources/profiles/profiles.d.mts.map +1 -0
  90. package/resources/profiles/profiles.d.ts +967 -0
  91. package/resources/profiles/profiles.d.ts.map +1 -0
  92. package/resources/profiles/profiles.js +227 -0
  93. package/resources/profiles/profiles.js.map +1 -0
  94. package/resources/profiles/profiles.mjs +222 -0
  95. package/resources/profiles/profiles.mjs.map +1 -0
  96. package/resources/profiles.d.mts +2 -0
  97. package/resources/profiles.d.mts.map +1 -0
  98. package/resources/profiles.d.ts +2 -0
  99. package/resources/profiles.d.ts.map +1 -0
  100. package/resources/profiles.js +6 -0
  101. package/resources/profiles.js.map +1 -0
  102. package/resources/profiles.mjs +3 -0
  103. package/resources/profiles.mjs.map +1 -0
  104. package/resources/templates.d.mts +327 -191
  105. package/resources/templates.d.mts.map +1 -1
  106. package/resources/templates.d.ts +327 -191
  107. package/resources/templates.d.ts.map +1 -1
  108. package/resources/templates.js +80 -35
  109. package/resources/templates.js.map +1 -1
  110. package/resources/templates.mjs +80 -35
  111. package/resources/templates.mjs.map +1 -1
  112. package/resources/users.d.mts +251 -0
  113. package/resources/users.d.mts.map +1 -0
  114. package/resources/users.d.ts +251 -0
  115. package/resources/users.d.ts.map +1 -0
  116. package/resources/users.js +124 -0
  117. package/resources/users.js.map +1 -0
  118. package/resources/users.mjs +120 -0
  119. package/resources/users.mjs.map +1 -0
  120. package/resources/webhooks.d.mts +639 -0
  121. package/resources/webhooks.d.mts.map +1 -0
  122. package/resources/webhooks.d.ts +639 -0
  123. package/resources/webhooks.d.ts.map +1 -0
  124. package/resources/webhooks.js +237 -0
  125. package/resources/webhooks.js.map +1 -0
  126. package/resources/webhooks.mjs +233 -0
  127. package/resources/webhooks.mjs.map +1 -0
  128. package/src/client.ts +228 -80
  129. package/src/internal/utils/log.ts +0 -1
  130. package/src/internal/utils/query.ts +23 -0
  131. package/src/internal/utils.ts +1 -0
  132. package/src/resources/contacts.ts +335 -57
  133. package/src/resources/index.ts +81 -12
  134. package/src/resources/me.ts +333 -0
  135. package/src/resources/messages.ts +306 -147
  136. package/src/resources/numbers.ts +102 -0
  137. package/src/resources/profiles/campaigns.ts +501 -0
  138. package/src/resources/profiles/index.ts +38 -0
  139. package/src/resources/profiles/profiles.ts +1302 -0
  140. package/src/resources/profiles.ts +3 -0
  141. package/src/resources/templates.ts +424 -202
  142. package/src/resources/users.ts +366 -0
  143. package/src/resources/webhooks.ts +923 -0
  144. package/src/version.ts +1 -1
  145. package/version.d.mts +1 -1
  146. package/version.d.mts.map +1 -1
  147. package/version.d.ts +1 -1
  148. package/version.d.ts.map +1 -1
  149. package/version.js +1 -1
  150. package/version.js.map +1 -1
  151. package/version.mjs +1 -1
  152. package/version.mjs.map +1 -1
  153. package/resources/number-lookup.d.mts +0 -59
  154. package/resources/number-lookup.d.mts.map +0 -1
  155. package/resources/number-lookup.d.ts +0 -59
  156. package/resources/number-lookup.d.ts.map +0 -1
  157. package/resources/number-lookup.js +0 -17
  158. package/resources/number-lookup.js.map +0 -1
  159. package/resources/number-lookup.mjs +0 -13
  160. package/resources/number-lookup.mjs.map +0 -1
  161. package/src/resources/number-lookup.ts +0 -80
@@ -1,283 +1,442 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
+ import * as WebhooksAPI from './webhooks';
4
5
  import { APIPromise } from '../core/api-promise';
5
6
  import { buildHeaders } from '../internal/headers';
6
7
  import { RequestOptions } from '../internal/request-options';
7
8
  import { path } from '../internal/utils/path';
8
9
 
10
+ /**
11
+ * Send and track SMS and WhatsApp messages
12
+ */
9
13
  export class Messages extends APIResource {
10
14
  /**
11
- * Retrieves comprehensive details about a specific message using the message ID.
12
- * Returns complete message data including delivery status, channel information,
13
- * template details, contact information, and pricing. The customer ID is extracted
14
- * from the authentication token to ensure the message belongs to the authenticated
15
- * customer.
15
+ * Retrieves the activity log for a specific message. Activities track the message
16
+ * lifecycle including acceptance, processing, sending, delivery, and any errors.
16
17
  *
17
18
  * @example
18
19
  * ```ts
19
- * const message = await client.messages.retrieve(
20
- * '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
20
+ * const response = await client.messages.retrieveActivities(
21
+ * '8ba7b830-9dad-11d1-80b4-00c04fd430c8',
21
22
  * );
22
23
  * ```
23
24
  */
24
- retrieve(id: string, options?: RequestOptions): APIPromise<MessageRetrieveResponse> {
25
- return this._client.get(path`/v2/messages/${id}`, options);
26
- }
27
-
28
- /**
29
- * Sends a message to a phone number using the default template. This endpoint is
30
- * rate limited to 5 messages per customer per day. The customer ID is extracted
31
- * from the authentication token.
32
- *
33
- * @example
34
- * ```ts
35
- * await client.messages.sendQuickMessage({
36
- * customMessage: 'Hello, this is a test message!',
37
- * phoneNumber: '+1234567890',
38
- * });
39
- * ```
40
- */
41
- sendQuickMessage(body: MessageSendQuickMessageParams, options?: RequestOptions): APIPromise<void> {
42
- return this._client.post('/v2/messages/quick-message', {
43
- body,
25
+ retrieveActivities(
26
+ id: string,
27
+ params: MessageRetrieveActivitiesParams | null | undefined = {},
28
+ options?: RequestOptions,
29
+ ): APIPromise<MessageRetrieveActivitiesResponse> {
30
+ const { 'x-profile-id': xProfileID } = params ?? {};
31
+ return this._client.get(path`/v3/messages/${id}/activities`, {
44
32
  ...options,
45
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
33
+ headers: buildHeaders([
34
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
35
+ options?.headers,
36
+ ]),
46
37
  });
47
38
  }
48
39
 
49
40
  /**
50
- * Sends a message to a specific contact using a template. The message can be sent
51
- * via SMS or WhatsApp depending on the contact's capabilities. Optionally specify
52
- * a webhook URL to receive delivery status updates. The customer ID is extracted
53
- * from the authentication token.
41
+ * Retrieves the current status and details of a message by ID. Includes delivery
42
+ * status, timestamps, and error information if applicable.
54
43
  *
55
44
  * @example
56
45
  * ```ts
57
- * await client.messages.sendToContact({
58
- * contactId: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
59
- * templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
60
- * });
46
+ * const response = await client.messages.retrieveStatus(
47
+ * '8ba7b830-9dad-11d1-80b4-00c04fd430c8',
48
+ * );
61
49
  * ```
62
50
  */
63
- sendToContact(body: MessageSendToContactParams, options?: RequestOptions): APIPromise<void> {
64
- return this._client.post('/v2/messages/contact', {
65
- body,
51
+ retrieveStatus(
52
+ id: string,
53
+ params: MessageRetrieveStatusParams | null | undefined = {},
54
+ options?: RequestOptions,
55
+ ): APIPromise<MessageRetrieveStatusResponse> {
56
+ const { 'x-profile-id': xProfileID } = params ?? {};
57
+ return this._client.get(path`/v3/messages/${id}`, {
66
58
  ...options,
67
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
59
+ headers: buildHeaders([
60
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
61
+ options?.headers,
62
+ ]),
68
63
  });
69
64
  }
70
65
 
71
66
  /**
72
- * Sends a message to a phone number using a template. The phone number doesn't
73
- * need to be a pre-existing contact. The message can be sent via SMS or WhatsApp.
74
- * Optionally specify a webhook URL to receive delivery status updates. The
75
- * customer ID is extracted from the authentication token.
67
+ * Sends a message to one or more recipients using a template. Supports
68
+ * multi-channel broadcast — when multiple channels are specified (e.g. ["sms",
69
+ * "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.
76
72
  *
77
73
  * @example
78
74
  * ```ts
79
- * await client.messages.sendToPhone({
80
- * phoneNumber: '+1234567890',
81
- * templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
82
- * });
75
+ * const response = await client.messages.send();
83
76
  * ```
84
77
  */
85
- sendToPhone(body: MessageSendToPhoneParams, options?: RequestOptions): APIPromise<void> {
86
- return this._client.post('/v2/messages/phone', {
78
+ send(params: MessageSendParams, options?: RequestOptions): APIPromise<MessageSendResponse> {
79
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
80
+ return this._client.post('/v3/messages', {
87
81
  body,
88
82
  ...options,
89
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
83
+ headers: buildHeaders([
84
+ {
85
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
86
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
87
+ },
88
+ options?.headers,
89
+ ]),
90
90
  });
91
91
  }
92
92
  }
93
93
 
94
94
  /**
95
- * Represents a sent message with comprehensive delivery and template information
96
- * (v2)
95
+ * Standard API response envelope for all v3 endpoints
97
96
  */
98
- export interface MessageRetrieveResponse {
97
+ export interface MessageRetrieveActivitiesResponse {
99
98
  /**
100
- * The unique identifier of the message
99
+ * Response for GET /messages/{id}/activities
101
100
  */
102
- id?: string;
101
+ data?: MessageRetrieveActivitiesResponse.Data | null;
103
102
 
104
103
  /**
105
- * The messaging channel used (e.g., SMS, WhatsApp)
104
+ * Error information
106
105
  */
107
- channel?: string;
106
+ error?: WebhooksAPI.ErrorDetail | null;
108
107
 
109
108
  /**
110
- * The unique identifier of the contact who received the message
109
+ * Request and response metadata
111
110
  */
112
- contactId?: string;
111
+ meta?: WebhooksAPI.APIMeta;
113
112
 
114
113
  /**
115
- * The final price charged for sending this message
114
+ * Indicates whether the request was successful
116
115
  */
117
- correctedPrice?: number | null;
116
+ success?: boolean;
117
+ }
118
118
 
119
+ export namespace MessageRetrieveActivitiesResponse {
119
120
  /**
120
- * The date and time when the message was created
121
+ * Response for GET /messages/{id}/activities
121
122
  */
122
- createdAt?: string;
123
+ export interface Data {
124
+ /**
125
+ * List of activity events ordered by most recent first
126
+ */
127
+ activities?: Array<Data.Activity>;
123
128
 
124
- /**
125
- * The unique identifier of the customer who sent the message
126
- */
127
- customerId?: string;
129
+ /**
130
+ * The message ID these activities belong to
131
+ */
132
+ message_id?: string;
133
+ }
128
134
 
135
+ export namespace Data {
136
+ /**
137
+ * A single message activity event for v3 API
138
+ */
139
+ export interface Activity {
140
+ /**
141
+ * Active contact markup applied on top of the channel cost, formatted to 4 decimal
142
+ * places.
143
+ */
144
+ active_contact_price?: string | null;
145
+
146
+ /**
147
+ * Human-readable description of the activity
148
+ */
149
+ description?: string;
150
+
151
+ /**
152
+ * Channel cost for this activity (e.g., SMS/WhatsApp provider cost), formatted to
153
+ * 4 decimal places.
154
+ */
155
+ price?: string | null;
156
+
157
+ /**
158
+ * Activity status (e.g., ACCEPTED, PROCESSED, SENT, DELIVERED, FAILED)
159
+ */
160
+ status?: string;
161
+
162
+ /**
163
+ * When this activity occurred
164
+ */
165
+ timestamp?: string;
166
+ }
167
+ }
168
+ }
169
+
170
+ /**
171
+ * Standard API response envelope for all v3 endpoints
172
+ */
173
+ export interface MessageRetrieveStatusResponse {
129
174
  /**
130
- * A chronological list of status change events for this message. Each event
131
- * includes a status and timestamp, following industry standards (Twilio, SendGrid,
132
- * Mailgun). Events are ordered chronologically from oldest to newest.
175
+ * Message response for v3 API — same shape as v2 with snake_case JSON conventions
133
176
  */
134
- events?: Array<MessageRetrieveResponse.Event> | null;
177
+ data?: MessageRetrieveStatusResponse.Data | null;
135
178
 
136
179
  /**
137
- * The message body content with variables substituted
180
+ * Error information
138
181
  */
139
- messageBody?: MessageRetrieveResponse.MessageBody | null;
182
+ error?: WebhooksAPI.ErrorDetail | null;
140
183
 
141
184
  /**
142
- * The phone number of the recipient (E.164 format)
185
+ * Request and response metadata
143
186
  */
144
- phoneNumber?: string;
187
+ meta?: WebhooksAPI.APIMeta;
145
188
 
146
189
  /**
147
- * The phone number in international format
190
+ * Indicates whether the request was successful
148
191
  */
149
- phoneNumberInternational?: string;
192
+ success?: boolean;
193
+ }
150
194
 
195
+ export namespace MessageRetrieveStatusResponse {
151
196
  /**
152
- * The region code of the phone number (e.g., US, GB, DE)
197
+ * Message response for v3 API — same shape as v2 with snake_case JSON conventions
153
198
  */
154
- regionCode?: string;
199
+ export interface Data {
200
+ id?: string;
201
+
202
+ active_contact_price?: number | null;
203
+
204
+ channel?: string;
205
+
206
+ contact_id?: string;
207
+
208
+ created_at?: string;
209
+
210
+ customer_id?: string;
211
+
212
+ events?: Array<Data.Event> | null;
213
+
214
+ /**
215
+ * Structured message body format for database storage. Preserves channel-specific
216
+ * components (header, body, footer, buttons).
217
+ */
218
+ message_body?: Data.MessageBody | null;
219
+
220
+ phone?: string;
221
+
222
+ phone_international?: string;
223
+
224
+ price?: number | null;
225
+
226
+ region_code?: string;
227
+
228
+ status?: string;
229
+
230
+ template_category?: string;
231
+
232
+ template_id?: string | null;
233
+
234
+ template_name?: string;
235
+ }
155
236
 
237
+ export namespace Data {
238
+ /**
239
+ * Represents a status change event in a message's lifecycle (v3)
240
+ */
241
+ export interface Event {
242
+ description?: string | null;
243
+
244
+ status?: string;
245
+
246
+ timestamp?: string;
247
+ }
248
+
249
+ /**
250
+ * Structured message body format for database storage. Preserves channel-specific
251
+ * components (header, body, footer, buttons).
252
+ */
253
+ export interface MessageBody {
254
+ buttons?: Array<MessageBody.Button> | null;
255
+
256
+ content?: string;
257
+
258
+ footer?: string | null;
259
+
260
+ header?: string | null;
261
+ }
262
+
263
+ export namespace MessageBody {
264
+ export interface Button {
265
+ type?: string;
266
+
267
+ value?: string;
268
+ }
269
+ }
270
+ }
271
+ }
272
+
273
+ /**
274
+ * Standard API response envelope for all v3 endpoints
275
+ */
276
+ export interface MessageSendResponse {
156
277
  /**
157
- * The delivery status of the message (e.g., sent, delivered, failed, read)
278
+ * Response for the multi-recipient send message endpoint
158
279
  */
159
- status?: string;
280
+ data?: MessageSendResponse.Data | null;
160
281
 
161
282
  /**
162
- * The category of the template (e.g., MARKETING, UTILITY, AUTHENTICATION)
283
+ * Error information
163
284
  */
164
- templateCategory?: string;
285
+ error?: WebhooksAPI.ErrorDetail | null;
165
286
 
166
287
  /**
167
- * The unique identifier of the template used for this message (null if no template
168
- * was used)
288
+ * Request and response metadata
169
289
  */
170
- templateId?: string | null;
290
+ meta?: WebhooksAPI.APIMeta;
171
291
 
172
292
  /**
173
- * The display name of the template
293
+ * Indicates whether the request was successful
174
294
  */
175
- templateName?: string;
295
+ success?: boolean;
176
296
  }
177
297
 
178
- export namespace MessageRetrieveResponse {
298
+ export namespace MessageSendResponse {
179
299
  /**
180
- * Represents a status change event in a message's lifecycle Follows industry
181
- * standards (Twilio, SendGrid, Mailgun pattern)
300
+ * Response for the multi-recipient send message endpoint
182
301
  */
183
- export interface Event {
302
+ export interface Data {
184
303
  /**
185
- * Optional human-readable description of the event Useful for error messages or
186
- * additional context
304
+ * Resolved template body text
187
305
  */
188
- description?: string | null;
306
+ body?: string | null;
189
307
 
190
308
  /**
191
- * The status of the message at this point in time Examples: "queued", "sent",
192
- * "delivered", "read", "failed"
309
+ * Per-recipient message results
193
310
  */
194
- status?: string;
311
+ recipients?: Array<Data.Recipient>;
195
312
 
196
313
  /**
197
- * When this status change occurred (ISO 8601 format)
314
+ * Overall request status (e.g. "accepted")
198
315
  */
199
- timestamp?: string;
200
- }
201
-
202
- /**
203
- * The message body content with variables substituted
204
- */
205
- export interface MessageBody {
206
- buttons?: Array<MessageBody.Button> | null;
207
-
208
- content?: string;
316
+ status?: string;
209
317
 
210
- footer?: string | null;
318
+ /**
319
+ * Template ID that was used
320
+ */
321
+ template_id?: string;
211
322
 
212
- header?: string | null;
323
+ /**
324
+ * Template display name
325
+ */
326
+ template_name?: string;
213
327
  }
214
328
 
215
- export namespace MessageBody {
216
- export interface Button {
217
- type?: string;
218
-
219
- value?: string;
329
+ export namespace Data {
330
+ /**
331
+ * Per-recipient result in the send message response
332
+ */
333
+ export interface Recipient {
334
+ /**
335
+ * Channel this message will be sent on (e.g. "sms", "whatsapp"), or null for
336
+ * auto-detect
337
+ */
338
+ channel?: string | null;
339
+
340
+ /**
341
+ * Unique message identifier for tracking this recipient's message
342
+ */
343
+ message_id?: string;
344
+
345
+ /**
346
+ * Phone number in E.164 format
347
+ */
348
+ to?: string;
220
349
  }
221
350
  }
222
351
  }
223
352
 
224
- export interface MessageSendQuickMessageParams {
353
+ export interface MessageRetrieveActivitiesParams {
225
354
  /**
226
- * The custom message content to include in the template
355
+ * Profile UUID to scope the request to a child profile. Only organization API keys
356
+ * can use this header. The profile must belong to the calling organization.
227
357
  */
228
- customMessage: string;
358
+ 'x-profile-id'?: string;
359
+ }
229
360
 
361
+ export interface MessageRetrieveStatusParams {
230
362
  /**
231
- * The phone number to send the message to, in international format (e.g.,
232
- * +1234567890)
363
+ * Profile UUID to scope the request to a child profile. Only organization API keys
364
+ * can use this header. The profile must belong to the calling organization.
233
365
  */
234
- phoneNumber: string;
366
+ 'x-profile-id'?: string;
235
367
  }
236
368
 
237
- export interface MessageSendToContactParams {
369
+ export interface MessageSendParams {
238
370
  /**
239
- * The unique identifier of the contact to send the message to
371
+ * Body param: Channels to broadcast on, e.g. ["whatsapp", "sms"]. Each channel
372
+ * produces a separate message per recipient. "sent" = auto-detect, "rcs" =
373
+ * reserved (skipped). Defaults to ["sent"] (auto-detect) if omitted.
240
374
  */
241
- contactId: string;
375
+ channel?: Array<string> | null;
242
376
 
243
377
  /**
244
- * The unique identifier of the template to use for the message
378
+ * Body param: Sandbox flag - when true, the operation is simulated without side
379
+ * effects Useful for testing integrations without actual execution
245
380
  */
246
- templateId: string;
381
+ sandbox?: boolean;
247
382
 
248
383
  /**
249
- * Optional key-value pairs of template variables to replace in the template body.
250
- * For example, if your template contains "Hello {{name}}", you would provide {
251
- * "name": "John Doe" }
384
+ * Body param: SDK-style template reference: resolve by ID or by name, with
385
+ * optional parameters.
252
386
  */
253
- templateVariables?: { [key: string]: string } | null;
254
- }
387
+ template?: MessageSendParams.Template;
388
+
389
+ /**
390
+ * Body param: List of recipient phone numbers in E.164 format (multi-recipient
391
+ * fan-out)
392
+ */
393
+ to?: Array<string>;
255
394
 
256
- export interface MessageSendToPhoneParams {
257
395
  /**
258
- * The phone number to send the message to, in international format (e.g.,
259
- * +1234567890)
396
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
397
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
398
+ * hours per key per customer.
260
399
  */
261
- phoneNumber: string;
400
+ 'Idempotency-Key'?: string;
262
401
 
263
402
  /**
264
- * The unique identifier of the template to use for the message
403
+ * Header param: Profile UUID to scope the request to a child profile. Only
404
+ * organization API keys can use this header. The profile must belong to the
405
+ * calling organization.
265
406
  */
266
- templateId: string;
407
+ 'x-profile-id'?: string;
408
+ }
267
409
 
410
+ export namespace MessageSendParams {
268
411
  /**
269
- * Optional key-value pairs of template variables to replace in the template body.
270
- * For example, if your template contains "Hello {{name}}", you would provide {
271
- * "name": "John Doe" }
412
+ * SDK-style template reference: resolve by ID or by name, with optional
413
+ * parameters.
272
414
  */
273
- templateVariables?: { [key: string]: string } | null;
415
+ export interface Template {
416
+ /**
417
+ * Template ID (mutually exclusive with name)
418
+ */
419
+ id?: string | null;
420
+
421
+ /**
422
+ * Template name (mutually exclusive with id)
423
+ */
424
+ name?: string | null;
425
+
426
+ /**
427
+ * Template variable parameters for personalization
428
+ */
429
+ parameters?: { [key: string]: string } | null;
430
+ }
274
431
  }
275
432
 
276
433
  export declare namespace Messages {
277
434
  export {
278
- type MessageRetrieveResponse as MessageRetrieveResponse,
279
- type MessageSendQuickMessageParams as MessageSendQuickMessageParams,
280
- type MessageSendToContactParams as MessageSendToContactParams,
281
- type MessageSendToPhoneParams as MessageSendToPhoneParams,
435
+ type MessageRetrieveActivitiesResponse as MessageRetrieveActivitiesResponse,
436
+ type MessageRetrieveStatusResponse as MessageRetrieveStatusResponse,
437
+ type MessageSendResponse as MessageSendResponse,
438
+ type MessageRetrieveActivitiesParams as MessageRetrieveActivitiesParams,
439
+ type MessageRetrieveStatusParams as MessageRetrieveStatusParams,
440
+ type MessageSendParams as MessageSendParams,
282
441
  };
283
442
  }