@sentdm/sentdm 0.34.0 → 0.36.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 (120) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/client.d.mts +53 -22
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +53 -22
  5. package/client.d.ts.map +1 -1
  6. package/client.js +39 -8
  7. package/client.js.map +1 -1
  8. package/client.mjs +39 -8
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/contacts.d.mts +606 -89
  12. package/resources/contacts.d.mts.map +1 -1
  13. package/resources/contacts.d.ts +606 -89
  14. package/resources/contacts.d.ts.map +1 -1
  15. package/resources/contacts.js +21 -15
  16. package/resources/contacts.js.map +1 -1
  17. package/resources/contacts.mjs +21 -15
  18. package/resources/contacts.mjs.map +1 -1
  19. package/resources/conversations.d.mts +335 -69
  20. package/resources/conversations.d.mts.map +1 -1
  21. package/resources/conversations.d.ts +335 -69
  22. package/resources/conversations.d.ts.map +1 -1
  23. package/resources/conversations.js +15 -10
  24. package/resources/conversations.js.map +1 -1
  25. package/resources/conversations.mjs +15 -10
  26. package/resources/conversations.mjs.map +1 -1
  27. package/resources/index.d.mts +7 -7
  28. package/resources/index.d.mts.map +1 -1
  29. package/resources/index.d.ts +7 -7
  30. package/resources/index.d.ts.map +1 -1
  31. package/resources/index.js.map +1 -1
  32. package/resources/index.mjs.map +1 -1
  33. package/resources/me.d.mts +165 -41
  34. package/resources/me.d.mts.map +1 -1
  35. package/resources/me.d.ts +165 -41
  36. package/resources/me.d.ts.map +1 -1
  37. package/resources/me.js +14 -1
  38. package/resources/me.js.map +1 -1
  39. package/resources/me.mjs +14 -1
  40. package/resources/me.mjs.map +1 -1
  41. package/resources/messages.d.mts +206 -27
  42. package/resources/messages.d.mts.map +1 -1
  43. package/resources/messages.d.ts +206 -27
  44. package/resources/messages.d.ts.map +1 -1
  45. package/resources/messages.js +5 -1
  46. package/resources/messages.js.map +1 -1
  47. package/resources/messages.mjs +5 -1
  48. package/resources/messages.mjs.map +1 -1
  49. package/resources/numbers.d.mts +45 -4
  50. package/resources/numbers.d.mts.map +1 -1
  51. package/resources/numbers.d.ts +45 -4
  52. package/resources/numbers.d.ts.map +1 -1
  53. package/resources/numbers.js +3 -1
  54. package/resources/numbers.js.map +1 -1
  55. package/resources/numbers.mjs +3 -1
  56. package/resources/numbers.mjs.map +1 -1
  57. package/resources/profiles/campaigns.d.mts +579 -209
  58. package/resources/profiles/campaigns.d.mts.map +1 -1
  59. package/resources/profiles/campaigns.d.ts +579 -209
  60. package/resources/profiles/campaigns.d.ts.map +1 -1
  61. package/resources/profiles/campaigns.js +33 -64
  62. package/resources/profiles/campaigns.js.map +1 -1
  63. package/resources/profiles/campaigns.mjs +33 -64
  64. package/resources/profiles/campaigns.mjs.map +1 -1
  65. package/resources/profiles/index.d.mts +2 -2
  66. package/resources/profiles/index.d.mts.map +1 -1
  67. package/resources/profiles/index.d.ts +2 -2
  68. package/resources/profiles/index.d.ts.map +1 -1
  69. package/resources/profiles/index.js.map +1 -1
  70. package/resources/profiles/index.mjs.map +1 -1
  71. package/resources/profiles/profiles.d.mts +2006 -508
  72. package/resources/profiles/profiles.d.mts.map +1 -1
  73. package/resources/profiles/profiles.d.ts +2006 -508
  74. package/resources/profiles/profiles.d.ts.map +1 -1
  75. package/resources/profiles/profiles.js +98 -75
  76. package/resources/profiles/profiles.js.map +1 -1
  77. package/resources/profiles/profiles.mjs +98 -75
  78. package/resources/profiles/profiles.mjs.map +1 -1
  79. package/resources/templates.d.mts +497 -84
  80. package/resources/templates.d.mts.map +1 -1
  81. package/resources/templates.d.ts +497 -84
  82. package/resources/templates.d.ts.map +1 -1
  83. package/resources/templates.js +6 -4
  84. package/resources/templates.js.map +1 -1
  85. package/resources/templates.mjs +6 -4
  86. package/resources/templates.mjs.map +1 -1
  87. package/resources/users.d.mts +444 -43
  88. package/resources/users.d.mts.map +1 -1
  89. package/resources/users.d.ts +444 -43
  90. package/resources/users.d.ts.map +1 -1
  91. package/resources/users.js +6 -4
  92. package/resources/users.js.map +1 -1
  93. package/resources/users.mjs +6 -4
  94. package/resources/users.mjs.map +1 -1
  95. package/resources/webhooks.d.mts +791 -190
  96. package/resources/webhooks.d.mts.map +1 -1
  97. package/resources/webhooks.d.ts +791 -190
  98. package/resources/webhooks.d.ts.map +1 -1
  99. package/resources/webhooks.js +11 -8
  100. package/resources/webhooks.js.map +1 -1
  101. package/resources/webhooks.mjs +11 -8
  102. package/resources/webhooks.mjs.map +1 -1
  103. package/src/client.ts +78 -60
  104. package/src/resources/contacts.ts +696 -92
  105. package/src/resources/conversations.ts +400 -77
  106. package/src/resources/index.ts +20 -26
  107. package/src/resources/me.ts +186 -52
  108. package/src/resources/messages.ts +230 -27
  109. package/src/resources/numbers.ts +50 -4
  110. package/src/resources/profiles/campaigns.ts +706 -232
  111. package/src/resources/profiles/index.ts +6 -14
  112. package/src/resources/profiles/profiles.ts +2421 -646
  113. package/src/resources/templates.ts +583 -99
  114. package/src/resources/users.ts +514 -44
  115. package/src/resources/webhooks.ts +964 -241
  116. package/src/version.ts +1 -1
  117. package/version.d.mts +1 -1
  118. package/version.d.ts +1 -1
  119. package/version.js +1 -1
  120. package/version.mjs +1 -1
@@ -1,15 +1,17 @@
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 ContactsAPI from './contacts';
5
- import * as WebhooksAPI from './webhooks';
6
4
  import { APIPromise } from '../core/api-promise';
7
5
  import { buildHeaders } from '../internal/headers';
8
6
  import { RequestOptions } from '../internal/request-options';
9
7
  import { path } from '../internal/utils/path';
10
8
 
11
9
  /**
12
- * Create, update, and manage customer contact lists
10
+ * The people you message, and their channel identities.
11
+ *
12
+ * A contact holds one identity per channel — a phone number, a WhatsApp number — so routing can choose between them for the same person. Opt-out is recorded against the contact and honoured on every send, whichever channel it came through.
13
+ *
14
+ * `GET /v3/contacts/{id}/message-summary` is the per-contact view of what you have sent and what happened to it.
13
15
  */
14
16
  export class Contacts extends APIResource {
15
17
  /**
@@ -18,12 +20,12 @@ export class Contacts extends APIResource {
18
20
  *
19
21
  * @example
20
22
  * ```ts
21
- * const apiResponseOfContact = await client.contacts.create({
23
+ * const contact = await client.contacts.create({
22
24
  * phone_number: '+1234567890',
23
25
  * });
24
26
  * ```
25
27
  */
26
- create(params: ContactCreateParams, options?: RequestOptions): APIPromise<APIResponseOfContact> {
28
+ create(params: ContactCreateParams, options?: RequestOptions): APIPromise<ContactCreateResponse> {
27
29
  const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
28
30
  return this._client.post('/v3/contacts', {
29
31
  body,
@@ -45,7 +47,7 @@ export class Contacts extends APIResource {
45
47
  *
46
48
  * @example
47
49
  * ```ts
48
- * const apiResponseOfContact = await client.contacts.retrieve(
50
+ * const contact = await client.contacts.retrieve(
49
51
  * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
50
52
  * );
51
53
  * ```
@@ -54,7 +56,7 @@ export class Contacts extends APIResource {
54
56
  id: string,
55
57
  params: ContactRetrieveParams | null | undefined = {},
56
58
  options?: RequestOptions,
57
- ): APIPromise<APIResponseOfContact> {
59
+ ): APIPromise<ContactRetrieveResponse> {
58
60
  const { 'x-profile-id': xProfileID } = params ?? {};
59
61
  return this._client.get(path`/v3/contacts/${id}`, {
60
62
  ...options,
@@ -66,12 +68,11 @@ export class Contacts extends APIResource {
66
68
  }
67
69
 
68
70
  /**
69
- * Updates a contact's default channel and/or opt-out status. Inherited contacts
70
- * cannot be updated.
71
+ * Updates a contact's default channel and/or opt-out status.
71
72
  *
72
73
  * @example
73
74
  * ```ts
74
- * const apiResponseOfContact = await client.contacts.update(
75
+ * const contact = await client.contacts.update(
75
76
  * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
76
77
  * );
77
78
  * ```
@@ -80,7 +81,7 @@ export class Contacts extends APIResource {
80
81
  id: string,
81
82
  params: ContactUpdateParams,
82
83
  options?: RequestOptions,
83
- ): APIPromise<APIResponseOfContact> {
84
+ ): APIPromise<ContactUpdateResponse> {
84
85
  const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
85
86
  return this._client.patch(path`/v3/contacts/${id}`, {
86
87
  body,
@@ -120,15 +121,18 @@ export class Contacts extends APIResource {
120
121
  }
121
122
 
122
123
  /**
123
- * Dissociates a contact from the authenticated customer. Inherited contacts cannot
124
- * be deleted.
124
+ * **Deprecated.** Use `PATCH /v3/contacts/{id}` with `{"opt_out": true}` instead,
125
+ * and expect this to be removed in a future release. It still behaves exactly as
126
+ * before, so nothing needs to change today.
125
127
  *
126
- * @example
127
- * ```ts
128
- * await client.contacts.delete(
129
- * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
130
- * );
131
- * ```
128
+ * Opting a contact out stops every send to them, which is what deleting one was
129
+ * mostly used for — and it keeps the record of who they were and that they asked.
130
+ * A delete discards the consent history along with the contact, which is the part
131
+ * you need if anyone ever asks why you stopped, or why you started again.
132
+ *
133
+ * Dissociates a contact from the authenticated customer.
134
+ *
135
+ * @deprecated
132
136
  */
133
137
  delete(id: string, params: ContactDeleteParams, options?: RequestOptions): APIPromise<void> {
134
138
  const { 'x-profile-id': xProfileID, ...body } = params;
@@ -150,7 +154,7 @@ export class Contacts extends APIResource {
150
154
  *
151
155
  * @example
152
156
  * ```ts
153
- * const apiResponseOfContactMessageSummary =
157
+ * const response =
154
158
  * await client.contacts.retrieveMessageSummary(
155
159
  * '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
156
160
  * );
@@ -160,7 +164,7 @@ export class Contacts extends APIResource {
160
164
  contactID: string,
161
165
  params: ContactRetrieveMessageSummaryParams | null | undefined = {},
162
166
  options?: RequestOptions,
163
- ): APIPromise<APIResponseOfContactMessageSummary> {
167
+ ): APIPromise<ContactRetrieveMessageSummaryResponse> {
164
168
  const { 'x-profile-id': xProfileID } = params ?? {};
165
169
  return this._client.get(path`/v3/contacts/${contactID}/message-summary`, {
166
170
  ...options,
@@ -175,21 +179,21 @@ export class Contacts extends APIResource {
175
179
  /**
176
180
  * Standard API response envelope for all v3 endpoints
177
181
  */
178
- export interface APIResponseOfContact {
182
+ export interface ContactCreateResponse {
179
183
  /**
180
184
  * Contact response for v3 API Uses snake_case for JSON property names
181
185
  */
182
- data?: ContactResponse | null;
186
+ data?: ContactCreateResponse.Data | null;
183
187
 
184
188
  /**
185
189
  * Error information
186
190
  */
187
- error?: WebhooksAPI.ErrorDetail | null;
191
+ error?: ContactCreateResponse.Error | null;
188
192
 
189
193
  /**
190
194
  * Request and response metadata
191
195
  */
192
- meta?: WebhooksAPI.APIMeta;
196
+ meta?: ContactCreateResponse.Meta;
193
197
 
194
198
  /**
195
199
  * Indicates whether the request was successful
@@ -197,24 +201,155 @@ export interface APIResponseOfContact {
197
201
  success?: boolean;
198
202
  }
199
203
 
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
+
200
335
  /**
201
336
  * Standard API response envelope for all v3 endpoints
202
337
  */
203
- export interface APIResponseOfContactMessageSummary {
338
+ export interface ContactRetrieveResponse {
204
339
  /**
205
- * The response data (null if error)
340
+ * Contact response for v3 API Uses snake_case for JSON property names
206
341
  */
207
- data?: ContactMessageSummary | null;
342
+ data?: ContactRetrieveResponse.Data | null;
208
343
 
209
344
  /**
210
345
  * Error information
211
346
  */
212
- error?: WebhooksAPI.ErrorDetail | null;
347
+ error?: ContactRetrieveResponse.Error | null;
213
348
 
214
349
  /**
215
350
  * Request and response metadata
216
351
  */
217
- meta?: WebhooksAPI.APIMeta;
352
+ meta?: ContactRetrieveResponse.Meta;
218
353
 
219
354
  /**
220
355
  * Indicates whether the request was successful
@@ -222,131 +357,536 @@ export interface APIResponseOfContactMessageSummary {
222
357
  success?: boolean;
223
358
  }
224
359
 
225
- export interface ContactMessageSummary {
226
- channel_scores?: Array<ContactMessageSummary.ChannelScore>;
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;
384
+
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;
390
+
391
+ /**
392
+ * Default messaging channel to use (e.g., "sms" or "whatsapp")
393
+ */
394
+ default_channel?: string;
227
395
 
228
- channels_used?: Array<string>;
396
+ /**
397
+ * Phone number in E.164 format (e.g., +1234567890)
398
+ */
399
+ format_e164?: string;
229
400
 
230
- contact_id?: string;
401
+ /**
402
+ * Phone number in international format (e.g., +1 234-567-890)
403
+ */
404
+ format_international?: string;
231
405
 
232
- first_message_at?: string | null;
406
+ /**
407
+ * Phone number in national format (e.g., (234) 567-890)
408
+ */
409
+ format_national?: string;
233
410
 
234
- last_message_at?: string | null;
411
+ /**
412
+ * Phone number in RFC 3966 format (e.g., tel:+1-234-567-890)
413
+ */
414
+ format_rfc?: string;
235
415
 
236
- message_count?: number;
237
- }
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;
238
453
 
239
- export namespace ContactMessageSummary {
240
- export interface ChannelScore {
241
- channel?: string;
454
+ /**
455
+ * Additional validation error details (field-level errors)
456
+ */
457
+ details?: { [key: string]: Array<string> } | null;
458
+
459
+ /**
460
+ * URL to documentation about this error
461
+ */
462
+ doc_url?: string | null;
463
+
464
+ /**
465
+ * Human-readable error message
466
+ */
467
+ message?: string;
468
+ }
469
+
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;
242
478
 
243
479
  /**
244
- * Percentage (0-100) of messages on this channel that ended in FAILED.
480
+ * Server timestamp when the response was generated
245
481
  */
246
- fail_score?: number;
482
+ timestamp?: string;
247
483
 
248
484
  /**
249
- * Percentage (0-100) of messages on this channel that reached a successful
250
- * terminal state: SENT/DELIVERED/READ for outbound, RECEIVED for inbound.
485
+ * API version used for this request
251
486
  */
252
- success_score?: number;
487
+ version?: string;
253
488
  }
254
489
  }
255
490
 
256
491
  /**
257
- * Contact response for v3 API Uses snake_case for JSON property names
492
+ * Standard API response envelope for all v3 endpoints
258
493
  */
259
- export interface ContactResponse {
494
+ export interface ContactUpdateResponse {
260
495
  /**
261
- * Unique identifier for the contact
496
+ * Contact response for v3 API Uses snake_case for JSON property names
262
497
  */
263
- id?: string;
498
+ data?: ContactUpdateResponse.Data | null;
264
499
 
265
500
  /**
266
- * Comma-separated list of available messaging channels (e.g., "sms,whatsapp")
501
+ * Error information
267
502
  */
268
- available_channels?: string;
503
+ error?: ContactUpdateResponse.Error | null;
269
504
 
270
505
  /**
271
- * Country calling code (e.g., 1 for US/Canada)
506
+ * Request and response metadata
272
507
  */
273
- country_code?: string;
508
+ meta?: ContactUpdateResponse.Meta;
274
509
 
275
510
  /**
276
- * When the contact was created
511
+ * Indicates whether the request was successful
277
512
  */
278
- created_at?: string;
513
+ success?: boolean;
514
+ }
279
515
 
516
+ export namespace ContactUpdateResponse {
280
517
  /**
281
- * Default messaging channel to use (e.g., "sms" or "whatsapp")
518
+ * Contact response for v3 API Uses snake_case for JSON property names
282
519
  */
283
- default_channel?: string;
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
+ }
284
600
 
285
601
  /**
286
- * Phone number in E.164 format (e.g., +1234567890)
602
+ * Error information
287
603
  */
288
- format_e164?: string;
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
+ }
289
625
 
290
626
  /**
291
- * Phone number in international format (e.g., +1 234-567-890)
627
+ * Request and response metadata
292
628
  */
293
- format_international?: string;
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
+ }
294
646
 
647
+ /**
648
+ * Standard API response envelope for all v3 endpoints
649
+ */
650
+ export interface ContactListResponse {
295
651
  /**
296
- * Phone number in national format (e.g., (234) 567-890)
652
+ * A paginated list of contacts.
297
653
  */
298
- format_national?: string;
654
+ data?: ContactListResponse.Data | null;
299
655
 
300
656
  /**
301
- * Phone number in RFC 3966 format (e.g., tel:+1-234-567-890)
657
+ * Error information
302
658
  */
303
- format_rfc?: string;
659
+ error?: ContactListResponse.Error | null;
304
660
 
305
661
  /**
306
- * Whether this is an inherited contact (read-only)
662
+ * Request and response metadata
307
663
  */
308
- is_inherited?: boolean;
664
+ meta?: ContactListResponse.Meta;
309
665
 
310
666
  /**
311
- * Whether the contact has opted out of messaging. Single source of truth — opt-out
312
- * is per-contact, not per-channel.
667
+ * Indicates whether the request was successful
313
668
  */
314
- opt_out?: boolean;
669
+ success?: boolean;
670
+ }
315
671
 
672
+ export namespace ContactListResponse {
316
673
  /**
317
- * Phone number in original format
674
+ * A paginated list of contacts.
318
675
  */
319
- phone_number?: string;
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
+ }
320
825
 
321
826
  /**
322
- * ISO 3166-1 alpha-2 country code (e.g., US, CA, GB)
827
+ * Error information
323
828
  */
324
- region_code?: string;
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
+ }
325
850
 
326
851
  /**
327
- * When the contact was last updated
852
+ * Request and response metadata
328
853
  */
329
- updated_at?: string | null;
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
+ }
330
870
  }
331
871
 
332
872
  /**
333
873
  * Standard API response envelope for all v3 endpoints
334
874
  */
335
- export interface ContactListResponse {
875
+ export interface ContactRetrieveMessageSummaryResponse {
336
876
  /**
337
- * Paginated list of contacts response
877
+ * The response data (null if error)
338
878
  */
339
- data?: ContactListResponse.Data | null;
879
+ data?: ContactRetrieveMessageSummaryResponse.Data | null;
340
880
 
341
881
  /**
342
882
  * Error information
343
883
  */
344
- error?: WebhooksAPI.ErrorDetail | null;
884
+ error?: ContactRetrieveMessageSummaryResponse.Error | null;
345
885
 
346
886
  /**
347
887
  * Request and response metadata
348
888
  */
349
- meta?: WebhooksAPI.APIMeta;
889
+ meta?: ContactRetrieveMessageSummaryResponse.Meta;
350
890
 
351
891
  /**
352
892
  * Indicates whether the request was successful
@@ -354,20 +894,84 @@ export interface ContactListResponse {
354
894
  success?: boolean;
355
895
  }
356
896
 
357
- export namespace ContactListResponse {
897
+ export namespace ContactRetrieveMessageSummaryResponse {
358
898
  /**
359
- * Paginated list of contacts response
899
+ * The response data (null if error)
360
900
  */
361
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 {
362
936
  /**
363
- * List of contacts
937
+ * Machine-readable error code (e.g., "RESOURCE_001")
364
938
  */
365
- contacts?: Array<ContactsAPI.ContactResponse>;
939
+ code?: string;
366
940
 
367
941
  /**
368
- * Pagination metadata for list responses
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
369
973
  */
370
- pagination?: WebhooksAPI.PaginationMeta;
974
+ version?: string;
371
975
  }
372
976
  }
373
977
 
@@ -498,11 +1102,11 @@ export interface ContactRetrieveMessageSummaryParams {
498
1102
 
499
1103
  export declare namespace Contacts {
500
1104
  export {
501
- type APIResponseOfContact as APIResponseOfContact,
502
- type APIResponseOfContactMessageSummary as APIResponseOfContactMessageSummary,
503
- type ContactMessageSummary as ContactMessageSummary,
504
- type ContactResponse as ContactResponse,
1105
+ type ContactCreateResponse as ContactCreateResponse,
1106
+ type ContactRetrieveResponse as ContactRetrieveResponse,
1107
+ type ContactUpdateResponse as ContactUpdateResponse,
505
1108
  type ContactListResponse as ContactListResponse,
1109
+ type ContactRetrieveMessageSummaryResponse as ContactRetrieveMessageSummaryResponse,
506
1110
  type ContactCreateParams as ContactCreateParams,
507
1111
  type ContactRetrieveParams as ContactRetrieveParams,
508
1112
  type ContactUpdateParams as ContactUpdateParams,