@sentdm/sentdm 0.36.0 → 0.38.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 (137) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +31 -0
  3. package/client.d.mts +28 -14
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +28 -14
  6. package/client.d.ts.map +1 -1
  7. package/client.js +10 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +10 -0
  10. package/client.mjs.map +1 -1
  11. package/core/pagination.d.mts +164 -0
  12. package/core/pagination.d.mts.map +1 -0
  13. package/core/pagination.d.ts +164 -0
  14. package/core/pagination.d.ts.map +1 -0
  15. package/core/pagination.js +212 -0
  16. package/core/pagination.js.map +1 -0
  17. package/core/pagination.mjs +202 -0
  18. package/core/pagination.mjs.map +1 -0
  19. package/index.d.mts +1 -0
  20. package/index.d.mts.map +1 -1
  21. package/index.d.ts +1 -0
  22. package/index.d.ts.map +1 -1
  23. package/index.js +3 -1
  24. package/index.js.map +1 -1
  25. package/index.mjs +1 -0
  26. package/index.mjs.map +1 -1
  27. package/internal/tslib.js +17 -17
  28. package/package.json +11 -1
  29. package/pagination.d.mts +3 -0
  30. package/pagination.d.mts.map +1 -0
  31. package/pagination.d.ts +3 -0
  32. package/pagination.d.ts.map +1 -0
  33. package/pagination.js +6 -0
  34. package/pagination.js.map +1 -0
  35. package/pagination.mjs +3 -0
  36. package/pagination.mjs.map +1 -0
  37. package/resources/contacts.d.mts +79 -626
  38. package/resources/contacts.d.mts.map +1 -1
  39. package/resources/contacts.d.ts +79 -626
  40. package/resources/contacts.d.ts.map +1 -1
  41. package/resources/contacts.js +12 -11
  42. package/resources/contacts.js.map +1 -1
  43. package/resources/contacts.mjs +12 -11
  44. package/resources/contacts.mjs.map +1 -1
  45. package/resources/conversations.d.mts +72 -346
  46. package/resources/conversations.d.mts.map +1 -1
  47. package/resources/conversations.d.ts +72 -346
  48. package/resources/conversations.d.ts.map +1 -1
  49. package/resources/conversations.js +16 -13
  50. package/resources/conversations.js.map +1 -1
  51. package/resources/conversations.mjs +16 -13
  52. package/resources/conversations.mjs.map +1 -1
  53. package/resources/index.d.mts +7 -7
  54. package/resources/index.d.mts.map +1 -1
  55. package/resources/index.d.ts +7 -7
  56. package/resources/index.d.ts.map +1 -1
  57. package/resources/index.js.map +1 -1
  58. package/resources/index.mjs.map +1 -1
  59. package/resources/me.d.mts +48 -129
  60. package/resources/me.d.mts.map +1 -1
  61. package/resources/me.d.ts +48 -129
  62. package/resources/me.d.ts.map +1 -1
  63. package/resources/me.js.map +1 -1
  64. package/resources/me.mjs.map +1 -1
  65. package/resources/messages.d.mts +8 -171
  66. package/resources/messages.d.mts.map +1 -1
  67. package/resources/messages.d.ts +8 -171
  68. package/resources/messages.d.ts.map +1 -1
  69. package/resources/messages.js.map +1 -1
  70. package/resources/messages.mjs.map +1 -1
  71. package/resources/numbers.d.mts +3 -42
  72. package/resources/numbers.d.mts.map +1 -1
  73. package/resources/numbers.d.ts +3 -42
  74. package/resources/numbers.d.ts.map +1 -1
  75. package/resources/numbers.js.map +1 -1
  76. package/resources/numbers.mjs.map +1 -1
  77. package/resources/profiles/campaigns.d.mts +149 -544
  78. package/resources/profiles/campaigns.d.mts.map +1 -1
  79. package/resources/profiles/campaigns.d.ts +149 -544
  80. package/resources/profiles/campaigns.d.ts.map +1 -1
  81. package/resources/profiles/index.d.mts +2 -2
  82. package/resources/profiles/index.d.mts.map +1 -1
  83. package/resources/profiles/index.d.ts +2 -2
  84. package/resources/profiles/index.d.ts.map +1 -1
  85. package/resources/profiles/index.js.map +1 -1
  86. package/resources/profiles/index.mjs.map +1 -1
  87. package/resources/profiles/profiles.d.mts +411 -1821
  88. package/resources/profiles/profiles.d.mts.map +1 -1
  89. package/resources/profiles/profiles.d.ts +411 -1821
  90. package/resources/profiles/profiles.d.ts.map +1 -1
  91. package/resources/profiles/profiles.js.map +1 -1
  92. package/resources/profiles/profiles.mjs.map +1 -1
  93. package/resources/templates.d.mts +87 -532
  94. package/resources/templates.d.mts.map +1 -1
  95. package/resources/templates.d.ts +87 -532
  96. package/resources/templates.d.ts.map +1 -1
  97. package/resources/templates.js +11 -10
  98. package/resources/templates.js.map +1 -1
  99. package/resources/templates.mjs +11 -10
  100. package/resources/templates.mjs.map +1 -1
  101. package/resources/users.d.mts +47 -437
  102. package/resources/users.d.mts.map +1 -1
  103. package/resources/users.d.ts +47 -437
  104. package/resources/users.d.ts.map +1 -1
  105. package/resources/users.js +3 -3
  106. package/resources/users.js.map +1 -1
  107. package/resources/users.mjs +3 -3
  108. package/resources/users.mjs.map +1 -1
  109. package/resources/webhooks.d.mts +192 -856
  110. package/resources/webhooks.d.mts.map +1 -1
  111. package/resources/webhooks.d.ts +192 -856
  112. package/resources/webhooks.d.ts.map +1 -1
  113. package/resources/webhooks.js +23 -19
  114. package/resources/webhooks.js.map +1 -1
  115. package/resources/webhooks.mjs +23 -19
  116. package/resources/webhooks.mjs.map +1 -1
  117. package/src/client.ts +124 -45
  118. package/src/core/pagination.ts +428 -0
  119. package/src/index.ts +1 -0
  120. package/src/pagination.ts +2 -0
  121. package/src/resources/contacts.ts +89 -726
  122. package/src/resources/conversations.ts +99 -427
  123. package/src/resources/index.ts +31 -23
  124. package/src/resources/me.ts +59 -148
  125. package/src/resources/messages.ts +8 -194
  126. package/src/resources/numbers.ts +3 -47
  127. package/src/resources/profiles/campaigns.ts +174 -673
  128. package/src/resources/profiles/index.ts +14 -6
  129. package/src/resources/profiles/profiles.ts +529 -2216
  130. package/src/resources/templates.ts +110 -629
  131. package/src/resources/users.ts +48 -505
  132. package/src/resources/webhooks.ts +307 -1091
  133. package/src/version.ts +1 -1
  134. package/version.d.mts +1 -1
  135. package/version.d.ts +1 -1
  136. package/version.js +1 -1
  137. package/version.mjs +1 -1
@@ -1,7 +1,9 @@
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';
6
+ import { ContactsPage, type ContactsPageParams, PagePromise } from '../core/pagination';
5
7
  import { buildHeaders } from '../internal/headers';
6
8
  import { RequestOptions } from '../internal/request-options';
7
9
  import { path } from '../internal/utils/path';
@@ -20,12 +22,12 @@ export class Contacts extends APIResource {
20
22
  *
21
23
  * @example
22
24
  * ```ts
23
- * const contact = await client.contacts.create({
25
+ * const apiResponseOfContact = await client.contacts.create({
24
26
  * phone_number: '+1234567890',
25
27
  * });
26
28
  * ```
27
29
  */
28
- create(params: ContactCreateParams, options?: RequestOptions): APIPromise<ContactCreateResponse> {
30
+ create(params: ContactCreateParams, options?: RequestOptions): APIPromise<APIResponseOfContact> {
29
31
  const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
30
32
  return this._client.post('/v3/contacts', {
31
33
  body,
@@ -47,7 +49,7 @@ export class Contacts extends APIResource {
47
49
  *
48
50
  * @example
49
51
  * ```ts
50
- * const contact = await client.contacts.retrieve(
52
+ * const apiResponseOfContact = await client.contacts.retrieve(
51
53
  * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
52
54
  * );
53
55
  * ```
@@ -56,7 +58,7 @@ export class Contacts extends APIResource {
56
58
  id: string,
57
59
  params: ContactRetrieveParams | null | undefined = {},
58
60
  options?: RequestOptions,
59
- ): APIPromise<ContactRetrieveResponse> {
61
+ ): APIPromise<APIResponseOfContact> {
60
62
  const { 'x-profile-id': xProfileID } = params ?? {};
61
63
  return this._client.get(path`/v3/contacts/${id}`, {
62
64
  ...options,
@@ -72,7 +74,7 @@ export class Contacts extends APIResource {
72
74
  *
73
75
  * @example
74
76
  * ```ts
75
- * const contact = await client.contacts.update(
77
+ * const apiResponseOfContact = await client.contacts.update(
76
78
  * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
77
79
  * );
78
80
  * ```
@@ -81,7 +83,7 @@ export class Contacts extends APIResource {
81
83
  id: string,
82
84
  params: ContactUpdateParams,
83
85
  options?: RequestOptions,
84
- ): APIPromise<ContactUpdateResponse> {
86
+ ): APIPromise<APIResponseOfContact> {
85
87
  const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
86
88
  return this._client.patch(path`/v3/contacts/${id}`, {
87
89
  body,
@@ -102,15 +104,18 @@ export class Contacts extends APIResource {
102
104
  *
103
105
  * @example
104
106
  * ```ts
105
- * const contacts = await client.contacts.list({
106
- * page: 0,
107
- * page_size: 0,
108
- * });
107
+ * // Automatically fetches more pages as needed.
108
+ * for await (const contactResponse of client.contacts.list()) {
109
+ * // ...
110
+ * }
109
111
  * ```
110
112
  */
111
- list(params: ContactListParams, options?: RequestOptions): APIPromise<ContactListResponse> {
112
- const { 'x-profile-id': xProfileID, ...query } = params;
113
- return this._client.get('/v3/contacts', {
113
+ list(
114
+ params: ContactListParams | null | undefined = {},
115
+ options?: RequestOptions,
116
+ ): PagePromise<ContactResponsesContactsPage, ContactResponse> {
117
+ const { 'x-profile-id': xProfileID, ...query } = params ?? {};
118
+ return this._client.getAPIList('/v3/contacts', ContactsPage<ContactResponse>, {
114
119
  query,
115
120
  ...options,
116
121
  headers: buildHeaders([
@@ -154,7 +159,7 @@ export class Contacts extends APIResource {
154
159
  *
155
160
  * @example
156
161
  * ```ts
157
- * const response =
162
+ * const apiResponseOfContactMessageSummary =
158
163
  * await client.contacts.retrieveMessageSummary(
159
164
  * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
160
165
  * );
@@ -164,7 +169,7 @@ export class Contacts extends APIResource {
164
169
  contactID: string,
165
170
  params: ContactRetrieveMessageSummaryParams | null | undefined = {},
166
171
  options?: RequestOptions,
167
- ): APIPromise<ContactRetrieveMessageSummaryResponse> {
172
+ ): APIPromise<APIResponseOfContactMessageSummary> {
168
173
  const { 'x-profile-id': xProfileID } = params ?? {};
169
174
  return this._client.get(path`/v3/contacts/${contactID}/message-summary`, {
170
175
  ...options,
@@ -176,24 +181,26 @@ export class Contacts extends APIResource {
176
181
  }
177
182
  }
178
183
 
184
+ export type ContactResponsesContactsPage = ContactsPage<ContactResponse>;
185
+
179
186
  /**
180
187
  * Standard API response envelope for all v3 endpoints
181
188
  */
182
- export interface ContactCreateResponse {
189
+ export interface APIResponseOfContact {
183
190
  /**
184
191
  * Contact response for v3 API Uses snake_case for JSON property names
185
192
  */
186
- data?: ContactCreateResponse.Data | null;
193
+ data?: ContactResponse | null;
187
194
 
188
195
  /**
189
196
  * Error information
190
197
  */
191
- error?: ContactCreateResponse.Error | null;
198
+ error?: WebhooksAPI.ErrorDetail | null;
192
199
 
193
200
  /**
194
201
  * Request and response metadata
195
202
  */
196
- meta?: ContactCreateResponse.Meta;
203
+ meta?: WebhooksAPI.APIMeta;
197
204
 
198
205
  /**
199
206
  * Indicates whether the request was successful
@@ -201,155 +208,24 @@ export interface ContactCreateResponse {
201
208
  success?: boolean;
202
209
  }
203
210
 
204
- export namespace ContactCreateResponse {
205
- /**
206
- * Contact response for v3 API Uses snake_case for JSON property names
207
- */
208
- export interface Data {
209
- /**
210
- * Unique identifier for the contact
211
- */
212
- id?: string;
213
-
214
- /**
215
- * Comma-separated list of available messaging channels (e.g., "sms,whatsapp")
216
- */
217
- available_channels?: string;
218
-
219
- /**
220
- * Country calling code (e.g., 1 for US/Canada)
221
- */
222
- country_code?: string;
223
-
224
- /**
225
- * When the contact was created
226
- */
227
- created_at?: string;
228
-
229
- /**
230
- * Which customer owns this — the key's own, or the profile named in x-profile-id.
231
- * Says whose resource this is, which the resource's own id does not.
232
- */
233
- customer_id?: string;
234
-
235
- /**
236
- * Default messaging channel to use (e.g., "sms" or "whatsapp")
237
- */
238
- default_channel?: string;
239
-
240
- /**
241
- * Phone number in E.164 format (e.g., +1234567890)
242
- */
243
- format_e164?: string;
244
-
245
- /**
246
- * Phone number in international format (e.g., +1 234-567-890)
247
- */
248
- format_international?: string;
249
-
250
- /**
251
- * Phone number in national format (e.g., (234) 567-890)
252
- */
253
- format_national?: string;
254
-
255
- /**
256
- * Phone number in RFC 3966 format (e.g., tel:+1-234-567-890)
257
- */
258
- format_rfc?: string;
259
-
260
- /**
261
- * @deprecated Always false. Contacts are no longer shared or inherited between
262
- * sender profiles — a profile sees only the contacts it owns. Retained so existing
263
- * v3 clients reading is_inherited keep deserializing; it carries no information.
264
- */
265
- is_inherited?: boolean;
266
-
267
- /**
268
- * Whether the contact has opted out of messaging. Single source of truth — opt-out
269
- * is per-contact, not per-channel.
270
- */
271
- opt_out?: boolean;
272
-
273
- /**
274
- * Phone number in original format
275
- */
276
- phone_number?: string;
277
-
278
- /**
279
- * ISO 3166-1 alpha-2 country code (e.g., US, CA, GB)
280
- */
281
- region_code?: string;
282
-
283
- /**
284
- * When the contact was last updated
285
- */
286
- updated_at?: string | null;
287
- }
288
-
289
- /**
290
- * Error information
291
- */
292
- export interface Error {
293
- /**
294
- * Machine-readable error code (e.g., "RESOURCE_001")
295
- */
296
- code?: string;
297
-
298
- /**
299
- * Additional validation error details (field-level errors)
300
- */
301
- details?: { [key: string]: Array<string> } | null;
302
-
303
- /**
304
- * URL to documentation about this error
305
- */
306
- doc_url?: string | null;
307
-
308
- /**
309
- * Human-readable error message
310
- */
311
- message?: string;
312
- }
313
-
314
- /**
315
- * Request and response metadata
316
- */
317
- export interface Meta {
318
- /**
319
- * Unique identifier for this request (for tracing and support)
320
- */
321
- request_id?: string;
322
-
323
- /**
324
- * Server timestamp when the response was generated
325
- */
326
- timestamp?: string;
327
-
328
- /**
329
- * API version used for this request
330
- */
331
- version?: string;
332
- }
333
- }
334
-
335
211
  /**
336
212
  * Standard API response envelope for all v3 endpoints
337
213
  */
338
- export interface ContactRetrieveResponse {
214
+ export interface APIResponseOfContactMessageSummary {
339
215
  /**
340
- * Contact response for v3 API Uses snake_case for JSON property names
216
+ * The response data (null if error)
341
217
  */
342
- data?: ContactRetrieveResponse.Data | null;
218
+ data?: ContactMessageSummary | null;
343
219
 
344
220
  /**
345
221
  * Error information
346
222
  */
347
- error?: ContactRetrieveResponse.Error | null;
223
+ error?: WebhooksAPI.ErrorDetail | null;
348
224
 
349
225
  /**
350
226
  * Request and response metadata
351
227
  */
352
- meta?: ContactRetrieveResponse.Meta;
228
+ meta?: WebhooksAPI.APIMeta;
353
229
 
354
230
  /**
355
231
  * Indicates whether the request was successful
@@ -357,622 +233,119 @@ export interface ContactRetrieveResponse {
357
233
  success?: boolean;
358
234
  }
359
235
 
360
- export namespace ContactRetrieveResponse {
361
- /**
362
- * Contact response for v3 API Uses snake_case for JSON property names
363
- */
364
- export interface Data {
365
- /**
366
- * Unique identifier for the contact
367
- */
368
- id?: string;
369
-
370
- /**
371
- * Comma-separated list of available messaging channels (e.g., "sms,whatsapp")
372
- */
373
- available_channels?: string;
374
-
375
- /**
376
- * Country calling code (e.g., 1 for US/Canada)
377
- */
378
- country_code?: string;
379
-
380
- /**
381
- * When the contact was created
382
- */
383
- created_at?: string;
236
+ export interface ContactMessageSummary {
237
+ channel_scores?: Array<ContactMessageSummary.ChannelScore>;
384
238
 
385
- /**
386
- * Which customer owns this — the key's own, or the profile named in x-profile-id.
387
- * Says whose resource this is, which the resource's own id does not.
388
- */
389
- customer_id?: string;
239
+ channels_used?: Array<string>;
390
240
 
391
- /**
392
- * Default messaging channel to use (e.g., "sms" or "whatsapp")
393
- */
394
- default_channel?: string;
395
-
396
- /**
397
- * Phone number in E.164 format (e.g., +1234567890)
398
- */
399
- format_e164?: string;
400
-
401
- /**
402
- * Phone number in international format (e.g., +1 234-567-890)
403
- */
404
- format_international?: string;
405
-
406
- /**
407
- * Phone number in national format (e.g., (234) 567-890)
408
- */
409
- format_national?: string;
410
-
411
- /**
412
- * Phone number in RFC 3966 format (e.g., tel:+1-234-567-890)
413
- */
414
- format_rfc?: string;
415
-
416
- /**
417
- * @deprecated Always false. Contacts are no longer shared or inherited between
418
- * sender profiles — a profile sees only the contacts it owns. Retained so existing
419
- * v3 clients reading is_inherited keep deserializing; it carries no information.
420
- */
421
- is_inherited?: boolean;
422
-
423
- /**
424
- * Whether the contact has opted out of messaging. Single source of truth — opt-out
425
- * is per-contact, not per-channel.
426
- */
427
- opt_out?: boolean;
428
-
429
- /**
430
- * Phone number in original format
431
- */
432
- phone_number?: string;
433
-
434
- /**
435
- * ISO 3166-1 alpha-2 country code (e.g., US, CA, GB)
436
- */
437
- region_code?: string;
438
-
439
- /**
440
- * When the contact was last updated
441
- */
442
- updated_at?: string | null;
443
- }
444
-
445
- /**
446
- * Error information
447
- */
448
- export interface Error {
449
- /**
450
- * Machine-readable error code (e.g., "RESOURCE_001")
451
- */
452
- code?: string;
241
+ contact_id?: string;
453
242
 
454
- /**
455
- * Additional validation error details (field-level errors)
456
- */
457
- details?: { [key: string]: Array<string> } | null;
243
+ first_message_at?: string | null;
458
244
 
459
- /**
460
- * URL to documentation about this error
461
- */
462
- doc_url?: string | null;
245
+ last_message_at?: string | null;
463
246
 
464
- /**
465
- * Human-readable error message
466
- */
467
- message?: string;
468
- }
247
+ message_count?: number;
248
+ }
469
249
 
470
- /**
471
- * Request and response metadata
472
- */
473
- export interface Meta {
474
- /**
475
- * Unique identifier for this request (for tracing and support)
476
- */
477
- request_id?: string;
250
+ export namespace ContactMessageSummary {
251
+ export interface ChannelScore {
252
+ channel?: string;
478
253
 
479
254
  /**
480
- * Server timestamp when the response was generated
255
+ * Percentage (0-100) of messages on this channel that ended in FAILED.
481
256
  */
482
- timestamp?: string;
257
+ fail_score?: number;
483
258
 
484
259
  /**
485
- * API version used for this request
260
+ * Percentage (0-100) of messages on this channel that reached a successful
261
+ * terminal state: SENT/DELIVERED/READ for outbound, RECEIVED for inbound.
486
262
  */
487
- version?: string;
263
+ success_score?: number;
488
264
  }
489
265
  }
490
266
 
491
267
  /**
492
- * Standard API response envelope for all v3 endpoints
268
+ * Contact response for v3 API Uses snake_case for JSON property names
493
269
  */
494
- export interface ContactUpdateResponse {
270
+ export interface ContactResponse {
495
271
  /**
496
- * Contact response for v3 API Uses snake_case for JSON property names
272
+ * Unique identifier for the contact
497
273
  */
498
- data?: ContactUpdateResponse.Data | null;
274
+ id?: string;
499
275
 
500
276
  /**
501
- * Error information
277
+ * Comma-separated list of available messaging channels (e.g., "sms,whatsapp")
502
278
  */
503
- error?: ContactUpdateResponse.Error | null;
279
+ available_channels?: string;
504
280
 
505
281
  /**
506
- * Request and response metadata
282
+ * Country calling code (e.g., 1 for US/Canada)
507
283
  */
508
- meta?: ContactUpdateResponse.Meta;
284
+ country_code?: string;
509
285
 
510
286
  /**
511
- * Indicates whether the request was successful
287
+ * When the contact was created
512
288
  */
513
- success?: boolean;
514
- }
289
+ created_at?: string;
515
290
 
516
- export namespace ContactUpdateResponse {
517
291
  /**
518
- * Contact response for v3 API Uses snake_case for JSON property names
292
+ * Which customer owns this — the key's own, or the profile named in x-profile-id.
293
+ * Says whose resource this is, which the resource's own id does not.
519
294
  */
520
- export interface Data {
521
- /**
522
- * Unique identifier for the contact
523
- */
524
- id?: string;
525
-
526
- /**
527
- * Comma-separated list of available messaging channels (e.g., "sms,whatsapp")
528
- */
529
- available_channels?: string;
530
-
531
- /**
532
- * Country calling code (e.g., 1 for US/Canada)
533
- */
534
- country_code?: string;
535
-
536
- /**
537
- * When the contact was created
538
- */
539
- created_at?: string;
540
-
541
- /**
542
- * Which customer owns this — the key's own, or the profile named in x-profile-id.
543
- * Says whose resource this is, which the resource's own id does not.
544
- */
545
- customer_id?: string;
546
-
547
- /**
548
- * Default messaging channel to use (e.g., "sms" or "whatsapp")
549
- */
550
- default_channel?: string;
551
-
552
- /**
553
- * Phone number in E.164 format (e.g., +1234567890)
554
- */
555
- format_e164?: string;
556
-
557
- /**
558
- * Phone number in international format (e.g., +1 234-567-890)
559
- */
560
- format_international?: string;
561
-
562
- /**
563
- * Phone number in national format (e.g., (234) 567-890)
564
- */
565
- format_national?: string;
566
-
567
- /**
568
- * Phone number in RFC 3966 format (e.g., tel:+1-234-567-890)
569
- */
570
- format_rfc?: string;
571
-
572
- /**
573
- * @deprecated Always false. Contacts are no longer shared or inherited between
574
- * sender profiles — a profile sees only the contacts it owns. Retained so existing
575
- * v3 clients reading is_inherited keep deserializing; it carries no information.
576
- */
577
- is_inherited?: boolean;
578
-
579
- /**
580
- * Whether the contact has opted out of messaging. Single source of truth — opt-out
581
- * is per-contact, not per-channel.
582
- */
583
- opt_out?: boolean;
584
-
585
- /**
586
- * Phone number in original format
587
- */
588
- phone_number?: string;
589
-
590
- /**
591
- * ISO 3166-1 alpha-2 country code (e.g., US, CA, GB)
592
- */
593
- region_code?: string;
594
-
595
- /**
596
- * When the contact was last updated
597
- */
598
- updated_at?: string | null;
599
- }
295
+ customer_id?: string;
600
296
 
601
297
  /**
602
- * Error information
298
+ * Default messaging channel to use (e.g., "sms" or "whatsapp")
603
299
  */
604
- export interface Error {
605
- /**
606
- * Machine-readable error code (e.g., "RESOURCE_001")
607
- */
608
- code?: string;
609
-
610
- /**
611
- * Additional validation error details (field-level errors)
612
- */
613
- details?: { [key: string]: Array<string> } | null;
614
-
615
- /**
616
- * URL to documentation about this error
617
- */
618
- doc_url?: string | null;
619
-
620
- /**
621
- * Human-readable error message
622
- */
623
- message?: string;
624
- }
300
+ default_channel?: string;
625
301
 
626
302
  /**
627
- * Request and response metadata
303
+ * Phone number in E.164 format (e.g., +1234567890)
628
304
  */
629
- export interface Meta {
630
- /**
631
- * Unique identifier for this request (for tracing and support)
632
- */
633
- request_id?: string;
634
-
635
- /**
636
- * Server timestamp when the response was generated
637
- */
638
- timestamp?: string;
639
-
640
- /**
641
- * API version used for this request
642
- */
643
- version?: string;
644
- }
645
- }
305
+ format_e164?: string;
646
306
 
647
- /**
648
- * Standard API response envelope for all v3 endpoints
649
- */
650
- export interface ContactListResponse {
651
307
  /**
652
- * A paginated list of contacts.
308
+ * Phone number in international format (e.g., +1 234-567-890)
653
309
  */
654
- data?: ContactListResponse.Data | null;
310
+ format_international?: string;
655
311
 
656
312
  /**
657
- * Error information
313
+ * Phone number in national format (e.g., (234) 567-890)
658
314
  */
659
- error?: ContactListResponse.Error | null;
315
+ format_national?: string;
660
316
 
661
317
  /**
662
- * Request and response metadata
318
+ * Phone number in RFC 3966 format (e.g., tel:+1-234-567-890)
663
319
  */
664
- meta?: ContactListResponse.Meta;
320
+ format_rfc?: string;
665
321
 
666
322
  /**
667
- * Indicates whether the request was successful
323
+ * @deprecated Always false. Contacts are no longer shared or inherited between
324
+ * sender profiles — a profile sees only the contacts it owns. Retained so existing
325
+ * v3 clients reading is_inherited keep deserializing; it carries no information.
668
326
  */
669
- success?: boolean;
670
- }
327
+ is_inherited?: boolean;
671
328
 
672
- export namespace ContactListResponse {
673
329
  /**
674
- * A paginated list of contacts.
330
+ * Whether the contact has opted out of messaging. Single source of truth — opt-out
331
+ * is per-contact, not per-channel.
675
332
  */
676
- export interface Data {
677
- /**
678
- * The contacts on this page.
679
- */
680
- contacts?: Array<Data.Contact>;
681
-
682
- /**
683
- * Pagination metadata for list responses
684
- */
685
- pagination?: Data.Pagination;
686
- }
687
-
688
- export namespace Data {
689
- /**
690
- * Contact response for v3 API Uses snake_case for JSON property names
691
- */
692
- export interface Contact {
693
- /**
694
- * Unique identifier for the contact
695
- */
696
- id?: string;
697
-
698
- /**
699
- * Comma-separated list of available messaging channels (e.g., "sms,whatsapp")
700
- */
701
- available_channels?: string;
702
-
703
- /**
704
- * Country calling code (e.g., 1 for US/Canada)
705
- */
706
- country_code?: string;
707
-
708
- /**
709
- * When the contact was created
710
- */
711
- created_at?: string;
712
-
713
- /**
714
- * Which customer owns this — the key's own, or the profile named in x-profile-id.
715
- * Says whose resource this is, which the resource's own id does not.
716
- */
717
- customer_id?: string;
718
-
719
- /**
720
- * Default messaging channel to use (e.g., "sms" or "whatsapp")
721
- */
722
- default_channel?: string;
723
-
724
- /**
725
- * Phone number in E.164 format (e.g., +1234567890)
726
- */
727
- format_e164?: string;
728
-
729
- /**
730
- * Phone number in international format (e.g., +1 234-567-890)
731
- */
732
- format_international?: string;
733
-
734
- /**
735
- * Phone number in national format (e.g., (234) 567-890)
736
- */
737
- format_national?: string;
738
-
739
- /**
740
- * Phone number in RFC 3966 format (e.g., tel:+1-234-567-890)
741
- */
742
- format_rfc?: string;
743
-
744
- /**
745
- * @deprecated Always false. Contacts are no longer shared or inherited between
746
- * sender profiles — a profile sees only the contacts it owns. Retained so existing
747
- * v3 clients reading is_inherited keep deserializing; it carries no information.
748
- */
749
- is_inherited?: boolean;
750
-
751
- /**
752
- * Whether the contact has opted out of messaging. Single source of truth — opt-out
753
- * is per-contact, not per-channel.
754
- */
755
- opt_out?: boolean;
756
-
757
- /**
758
- * Phone number in original format
759
- */
760
- phone_number?: string;
761
-
762
- /**
763
- * ISO 3166-1 alpha-2 country code (e.g., US, CA, GB)
764
- */
765
- region_code?: string;
766
-
767
- /**
768
- * When the contact was last updated
769
- */
770
- updated_at?: string | null;
771
- }
772
-
773
- /**
774
- * Pagination metadata for list responses
775
- */
776
- export interface Pagination {
777
- /**
778
- * @deprecated Cursor-based pagination. Never populated — see Cursors.
779
- */
780
- cursors?: Pagination.Cursors | null;
781
-
782
- /**
783
- * Whether there are more pages after this one
784
- */
785
- has_more?: boolean;
786
-
787
- /**
788
- * Current page number (1-indexed)
789
- */
790
- page?: number;
791
-
792
- /**
793
- * Number of items per page
794
- */
795
- page_size?: number;
796
-
797
- /**
798
- * Total number of items across all pages
799
- */
800
- total_count?: number;
801
-
802
- /**
803
- * Total number of pages
804
- */
805
- total_pages?: number;
806
- }
807
-
808
- export namespace Pagination {
809
- /**
810
- * @deprecated Cursor-based pagination. Never populated — see Cursors.
811
- */
812
- export interface Cursors {
813
- /**
814
- * Cursor to fetch the next page.
815
- */
816
- after?: string | null;
817
-
818
- /**
819
- * Cursor to fetch the previous page.
820
- */
821
- before?: string | null;
822
- }
823
- }
824
- }
333
+ opt_out?: boolean;
825
334
 
826
335
  /**
827
- * Error information
336
+ * Phone number in original format
828
337
  */
829
- export interface Error {
830
- /**
831
- * Machine-readable error code (e.g., "RESOURCE_001")
832
- */
833
- code?: string;
834
-
835
- /**
836
- * Additional validation error details (field-level errors)
837
- */
838
- details?: { [key: string]: Array<string> } | null;
839
-
840
- /**
841
- * URL to documentation about this error
842
- */
843
- doc_url?: string | null;
844
-
845
- /**
846
- * Human-readable error message
847
- */
848
- message?: string;
849
- }
338
+ phone_number?: string;
850
339
 
851
340
  /**
852
- * Request and response metadata
341
+ * ISO 3166-1 alpha-2 country code (e.g., US, CA, GB)
853
342
  */
854
- export interface Meta {
855
- /**
856
- * Unique identifier for this request (for tracing and support)
857
- */
858
- request_id?: string;
859
-
860
- /**
861
- * Server timestamp when the response was generated
862
- */
863
- timestamp?: string;
864
-
865
- /**
866
- * API version used for this request
867
- */
868
- version?: string;
869
- }
870
- }
871
-
872
- /**
873
- * Standard API response envelope for all v3 endpoints
874
- */
875
- export interface ContactRetrieveMessageSummaryResponse {
876
- /**
877
- * The response data (null if error)
878
- */
879
- data?: ContactRetrieveMessageSummaryResponse.Data | null;
880
-
881
- /**
882
- * Error information
883
- */
884
- error?: ContactRetrieveMessageSummaryResponse.Error | null;
885
-
886
- /**
887
- * Request and response metadata
888
- */
889
- meta?: ContactRetrieveMessageSummaryResponse.Meta;
343
+ region_code?: string;
890
344
 
891
345
  /**
892
- * Indicates whether the request was successful
346
+ * When the contact was last updated
893
347
  */
894
- success?: boolean;
895
- }
896
-
897
- export namespace ContactRetrieveMessageSummaryResponse {
898
- /**
899
- * The response data (null if error)
900
- */
901
- export interface Data {
902
- channel_scores?: Array<Data.ChannelScore>;
903
-
904
- channels_used?: Array<string>;
905
-
906
- contact_id?: string;
907
-
908
- first_message_at?: string | null;
909
-
910
- last_message_at?: string | null;
911
-
912
- message_count?: number;
913
- }
914
-
915
- export namespace Data {
916
- export interface ChannelScore {
917
- channel?: string;
918
-
919
- /**
920
- * Percentage (0-100) of messages on this channel that ended in FAILED.
921
- */
922
- fail_score?: number;
923
-
924
- /**
925
- * Percentage (0-100) of messages on this channel that reached a successful
926
- * terminal state: SENT/DELIVERED/READ for outbound, RECEIVED for inbound.
927
- */
928
- success_score?: number;
929
- }
930
- }
931
-
932
- /**
933
- * Error information
934
- */
935
- export interface Error {
936
- /**
937
- * Machine-readable error code (e.g., "RESOURCE_001")
938
- */
939
- code?: string;
940
-
941
- /**
942
- * Additional validation error details (field-level errors)
943
- */
944
- details?: { [key: string]: Array<string> } | null;
945
-
946
- /**
947
- * URL to documentation about this error
948
- */
949
- doc_url?: string | null;
950
-
951
- /**
952
- * Human-readable error message
953
- */
954
- message?: string;
955
- }
956
-
957
- /**
958
- * Request and response metadata
959
- */
960
- export interface Meta {
961
- /**
962
- * Unique identifier for this request (for tracing and support)
963
- */
964
- request_id?: string;
965
-
966
- /**
967
- * Server timestamp when the response was generated
968
- */
969
- timestamp?: string;
970
-
971
- /**
972
- * API version used for this request
973
- */
974
- version?: string;
975
- }
348
+ updated_at?: string | null;
976
349
  }
977
350
 
978
351
  export interface ContactCreateParams {
@@ -1043,17 +416,7 @@ export interface ContactUpdateParams {
1043
416
  'x-profile-id'?: string;
1044
417
  }
1045
418
 
1046
- export interface ContactListParams {
1047
- /**
1048
- * Query param: Page number (1-indexed)
1049
- */
1050
- page: number;
1051
-
1052
- /**
1053
- * Query param: Number of items per page
1054
- */
1055
- page_size: number;
1056
-
419
+ export interface ContactListParams extends ContactsPageParams {
1057
420
  /**
1058
421
  * Query param: Optional channel filter (sms, whatsapp)
1059
422
  */
@@ -1102,11 +465,11 @@ export interface ContactRetrieveMessageSummaryParams {
1102
465
 
1103
466
  export declare namespace Contacts {
1104
467
  export {
1105
- type ContactCreateResponse as ContactCreateResponse,
1106
- type ContactRetrieveResponse as ContactRetrieveResponse,
1107
- type ContactUpdateResponse as ContactUpdateResponse,
1108
- type ContactListResponse as ContactListResponse,
1109
- type ContactRetrieveMessageSummaryResponse as ContactRetrieveMessageSummaryResponse,
468
+ type APIResponseOfContact as APIResponseOfContact,
469
+ type APIResponseOfContactMessageSummary as APIResponseOfContactMessageSummary,
470
+ type ContactMessageSummary as ContactMessageSummary,
471
+ type ContactResponse as ContactResponse,
472
+ type ContactResponsesContactsPage as ContactResponsesContactsPage,
1110
473
  type ContactCreateParams as ContactCreateParams,
1111
474
  type ContactRetrieveParams as ContactRetrieveParams,
1112
475
  type ContactUpdateParams as ContactUpdateParams,