@sentdm/sentdm 0.32.0 → 0.34.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 (94) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/client.d.mts +11 -8
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +11 -8
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/contacts.d.mts +66 -1
  12. package/resources/contacts.d.mts.map +1 -1
  13. package/resources/contacts.d.ts +66 -1
  14. package/resources/contacts.d.ts.map +1 -1
  15. package/resources/contacts.js +24 -0
  16. package/resources/contacts.js.map +1 -1
  17. package/resources/contacts.mjs +24 -0
  18. package/resources/contacts.mjs.map +1 -1
  19. package/resources/conversations.d.mts +160 -0
  20. package/resources/conversations.d.mts.map +1 -0
  21. package/resources/conversations.d.ts +160 -0
  22. package/resources/conversations.d.ts.map +1 -0
  23. package/resources/conversations.js +59 -0
  24. package/resources/conversations.js.map +1 -0
  25. package/resources/conversations.mjs +55 -0
  26. package/resources/conversations.mjs.map +1 -0
  27. package/resources/index.d.mts +5 -4
  28. package/resources/index.d.mts.map +1 -1
  29. package/resources/index.d.ts +5 -4
  30. package/resources/index.d.ts.map +1 -1
  31. package/resources/index.js +3 -1
  32. package/resources/index.js.map +1 -1
  33. package/resources/index.mjs +1 -0
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/messages.d.mts +7 -3
  36. package/resources/messages.d.mts.map +1 -1
  37. package/resources/messages.d.ts +7 -3
  38. package/resources/messages.d.ts.map +1 -1
  39. package/resources/messages.js +6 -1
  40. package/resources/messages.js.map +1 -1
  41. package/resources/messages.mjs +6 -1
  42. package/resources/messages.mjs.map +1 -1
  43. package/resources/profiles/campaigns.d.mts +112 -83
  44. package/resources/profiles/campaigns.d.mts.map +1 -1
  45. package/resources/profiles/campaigns.d.ts +112 -83
  46. package/resources/profiles/campaigns.d.ts.map +1 -1
  47. package/resources/profiles/campaigns.js +6 -5
  48. package/resources/profiles/campaigns.js.map +1 -1
  49. package/resources/profiles/campaigns.mjs +6 -5
  50. package/resources/profiles/campaigns.mjs.map +1 -1
  51. package/resources/profiles/index.d.mts +2 -2
  52. package/resources/profiles/index.d.mts.map +1 -1
  53. package/resources/profiles/index.d.ts +2 -2
  54. package/resources/profiles/index.d.ts.map +1 -1
  55. package/resources/profiles/profiles.d.mts +151 -139
  56. package/resources/profiles/profiles.d.mts.map +1 -1
  57. package/resources/profiles/profiles.d.ts +151 -139
  58. package/resources/profiles/profiles.d.ts.map +1 -1
  59. package/resources/profiles/profiles.js +39 -21
  60. package/resources/profiles/profiles.js.map +1 -1
  61. package/resources/profiles/profiles.mjs +39 -21
  62. package/resources/profiles/profiles.mjs.map +1 -1
  63. package/resources/templates.d.mts +87 -87
  64. package/resources/templates.d.mts.map +1 -1
  65. package/resources/templates.d.ts +87 -87
  66. package/resources/templates.d.ts.map +1 -1
  67. package/resources/users.d.mts +5 -3
  68. package/resources/users.d.mts.map +1 -1
  69. package/resources/users.d.ts +5 -3
  70. package/resources/users.d.ts.map +1 -1
  71. package/resources/users.js +5 -3
  72. package/resources/users.js.map +1 -1
  73. package/resources/users.mjs +5 -3
  74. package/resources/users.mjs.map +1 -1
  75. package/resources/webhooks.d.mts +226 -2
  76. package/resources/webhooks.d.mts.map +1 -1
  77. package/resources/webhooks.d.ts +226 -2
  78. package/resources/webhooks.d.ts.map +1 -1
  79. package/src/client.ts +53 -18
  80. package/src/resources/contacts.ts +96 -0
  81. package/src/resources/conversations.ts +238 -0
  82. package/src/resources/index.ts +25 -9
  83. package/src/resources/messages.ts +7 -3
  84. package/src/resources/profiles/campaigns.ts +160 -132
  85. package/src/resources/profiles/index.ts +8 -8
  86. package/src/resources/profiles/profiles.ts +185 -175
  87. package/src/resources/templates.ts +105 -105
  88. package/src/resources/users.ts +5 -3
  89. package/src/resources/webhooks.ts +269 -1
  90. package/src/version.ts +1 -1
  91. package/version.d.mts +1 -1
  92. package/version.d.ts +1 -1
  93. package/version.js +1 -1
  94. package/version.mjs +1 -1
@@ -5,18 +5,18 @@ import * as ProfilesAPI from './profiles';
5
5
  import * as WebhooksAPI from '../webhooks';
6
6
  import * as CampaignsAPI from './campaigns';
7
7
  import {
8
- APIResponseOfTcrCampaignWithUseCases,
9
- BaseDto,
8
+ APIResponseOfBrandCampaign,
9
+ APIResponseOfListOfBrandCampaign,
10
+ BrandCampaign,
10
11
  CampaignCreateParams,
11
12
  CampaignData,
12
13
  CampaignDeleteParams,
13
14
  CampaignListParams,
14
- CampaignListResponse,
15
15
  CampaignUpdateParams,
16
+ CampaignUseCase,
17
+ CampaignUseCaseData,
16
18
  Campaigns,
17
19
  MessagingUseCaseUs,
18
- SentDmServicesEndpointsCustomerApIv3ContractsRequestsCampaignsCampaignUseCaseData,
19
- TcrCampaignWithUseCases,
20
20
  } from './campaigns';
21
21
  import { APIPromise } from '../../core/api-promise';
22
22
  import { buildHeaders } from '../../internal/headers';
@@ -96,7 +96,9 @@ export class Profiles extends APIResource {
96
96
  * @example
97
97
  * ```ts
98
98
  * const apiResponseOfProfileDetail =
99
- * await client.profiles.retrieve('profileId');
99
+ * await client.profiles.retrieve(
100
+ * '770e8400-e29b-41d4-a716-446655440002',
101
+ * );
100
102
  * ```
101
103
  */
102
104
  retrieve(
@@ -137,7 +139,9 @@ export class Profiles extends APIResource {
137
139
  * @example
138
140
  * ```ts
139
141
  * const apiResponseOfProfileDetail =
140
- * await client.profiles.update('profileId');
142
+ * await client.profiles.update(
143
+ * '770e8400-e29b-41d4-a716-446655440002',
144
+ * );
141
145
  * ```
142
146
  */
143
147
  update(
@@ -190,7 +194,9 @@ export class Profiles extends APIResource {
190
194
  *
191
195
  * @example
192
196
  * ```ts
193
- * await client.profiles.delete('profileId');
197
+ * await client.profiles.delete(
198
+ * '770e8400-e29b-41d4-a716-446655440002',
199
+ * );
194
200
  * ```
195
201
  */
196
202
  delete(profileID: string, params: ProfileDeleteParams, options?: RequestOptions): APIPromise<void> {
@@ -206,24 +212,36 @@ export class Profiles extends APIResource {
206
212
  }
207
213
 
208
214
  /**
209
- * Final step in profile compliance workflow. Validates all prerequisites (general
210
- * data, brand, campaigns), connects profile to Telnyx/WhatsApp, and sets status
211
- * based on configuration. The process runs in the background and calls the
212
- * provided webhook URL when finished.
215
+ * Final step in the profile compliance workflow. Validates all prerequisites (KYC,
216
+ * brand, campaigns, required documents), connects the profile to the SMS and
217
+ * WhatsApp channels, and sets its status based on configuration. Prerequisites are
218
+ * always validated first: if any fail the call returns 400. If they pass and the
219
+ * profile is already completed, the call returns 200 and does nothing. Otherwise
220
+ * it returns 202 and calls the provided webhook URL when background processing
221
+ * finishes.
222
+ *
223
+ * Prerequisites:
213
224
  *
214
- * Prerequisites:
215
- * - Profile must be completed
216
- * - If inheritTcrBrand=false: Profile must have existing brand
217
- * - If inheritTcrBrand=true: Parent must have existing brand
218
- * - If TCR application: Must have at least one campaign (own or inherited)
219
- * - If inheritTcrCampaign=false: Profile should have campaigns
220
- * - If inheritTcrCampaign=true: Parent must have campaigns
225
+ * - Profile must have a name, short name, and description (short name max 50
226
+ * characters, description max 5000)
227
+ * - webHookUrl must be supplied on the request
228
+ * - A KYC form submission is required
229
+ * - A brand is required, either on the profile or inherited from the parent
230
+ * organization
231
+ * - TCR applications must have at least one campaign, own or inherited
232
+ * - Destination countries marked as main must have their required compliance
233
+ * documents uploaded
221
234
  *
222
- * Status Logic:
223
- * - If both SMS and WhatsApp channels are missing → SUBMITTED
224
- * - If TCR application and not inheriting brand/campaigns → SUBMITTED
225
- * - If non-TCR with destination country (IsMain=true) → SUBMITTED
226
- * - Otherwise → COMPLETED
235
+ * Resulting status:
236
+ *
237
+ * - If either the SMS or WhatsApp channel is unconfigured, the profile is
238
+ * SUBMITTED
239
+ * - For a TCR application that inherits both its brand and its campaigns, the
240
+ * profile is COMPLETED
241
+ * - For a TCR application that owns either its brand or its campaigns, the profile
242
+ * is COMPLETED once both have been submitted to TCR, and SUBMITTED until then
243
+ * - For a non-TCR application, the profile is SUBMITTED when a main destination
244
+ * country is set, and COMPLETED otherwise
227
245
  *
228
246
  * @example
229
247
  * ```ts
@@ -308,6 +326,132 @@ export interface BillingContactInfo {
308
326
  phone?: string | null;
309
327
  }
310
328
 
329
+ /**
330
+ * Business details and address for brand KYC
331
+ */
332
+ export interface BrandBusinessInfo {
333
+ /**
334
+ * City
335
+ */
336
+ city?: string | null;
337
+
338
+ /**
339
+ * Country code (e.g., US, CA)
340
+ */
341
+ country?: string | null;
342
+
343
+ /**
344
+ * Country where the business is registered
345
+ */
346
+ countryOfRegistration?: string | null;
347
+
348
+ entityType?: 'PRIVATE_PROFIT' | 'PUBLIC_PROFIT' | 'NON_PROFIT' | 'SOLE_PROPRIETOR' | 'GOVERNMENT' | null;
349
+
350
+ /**
351
+ * Legal business name
352
+ */
353
+ legalName?: string | null;
354
+
355
+ /**
356
+ * Postal/ZIP code
357
+ */
358
+ postalCode?: string | null;
359
+
360
+ /**
361
+ * State/province code
362
+ */
363
+ state?: string | null;
364
+
365
+ /**
366
+ * Street address
367
+ */
368
+ street?: string | null;
369
+
370
+ /**
371
+ * Tax ID/EIN number
372
+ */
373
+ taxId?: string | null;
374
+
375
+ /**
376
+ * Type of tax ID (e.g., us_ein, ca_bn)
377
+ */
378
+ taxIdType?: string | null;
379
+
380
+ /**
381
+ * Business website URL
382
+ */
383
+ url?: string | null;
384
+ }
385
+
386
+ /**
387
+ * Compliance and TCR information for brand registration
388
+ */
389
+ export interface BrandComplianceInfo {
390
+ brandRelationship: TcrBrandRelationship;
391
+
392
+ vertical: TcrVertical;
393
+
394
+ /**
395
+ * List of destination countries for messaging
396
+ */
397
+ destinationCountries?: Array<DestinationCountry> | null;
398
+
399
+ /**
400
+ * Whether this is a TCR (Campaign Registry) application
401
+ */
402
+ isTcrApplication?: boolean | null;
403
+
404
+ /**
405
+ * Additional notes about the business or use case
406
+ */
407
+ notes?: string | null;
408
+
409
+ /**
410
+ * Phone number prefix for messaging (e.g., "+1")
411
+ */
412
+ phoneNumberPrefix?: string | null;
413
+
414
+ /**
415
+ * Primary messaging use case description
416
+ */
417
+ primaryUseCase?: string | null;
418
+ }
419
+
420
+ /**
421
+ * Contact information for brand KYC
422
+ */
423
+ export interface BrandContactInfo {
424
+ /**
425
+ * Primary contact name (required)
426
+ */
427
+ name: string;
428
+
429
+ /**
430
+ * Business/brand name
431
+ */
432
+ businessName?: string | null;
433
+
434
+ /**
435
+ * Contact email address
436
+ */
437
+ email?: string | null;
438
+
439
+ /**
440
+ * Contact phone number in E.164 format
441
+ */
442
+ phone?: string | null;
443
+
444
+ /**
445
+ * Contact phone country code (e.g., "1" for US)
446
+ */
447
+ phoneCountryCode?: string | null;
448
+
449
+ /**
450
+ * Contact's role in the business
451
+ */
452
+ role?: string | null;
453
+ }
454
+
311
455
  /**
312
456
  * Brand and KYC data grouped into contact, business, and compliance sections
313
457
  */
@@ -315,17 +459,17 @@ export interface BrandsBrandData {
315
459
  /**
316
460
  * Compliance and TCR information for brand registration
317
461
  */
318
- compliance: SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandComplianceInfo;
462
+ compliance: BrandComplianceInfo;
319
463
 
320
464
  /**
321
465
  * Contact information for brand KYC
322
466
  */
323
- contact: SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandContactInfo;
467
+ contact: BrandContactInfo;
324
468
 
325
469
  /**
326
470
  * Business details and address for brand KYC
327
471
  */
328
- business?: SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandBusinessInfo | null;
472
+ business?: BrandBusinessInfo | null;
329
473
  }
330
474
 
331
475
  export interface DestinationCountry {
@@ -457,7 +601,7 @@ export interface ProfileDetail {
457
601
  sending_phone_number?: string | null;
458
602
 
459
603
  /**
460
- * Reference to another profile for SMS/Telnyx configuration
604
+ * Reference to another profile whose SMS configuration this profile uses
461
605
  */
462
606
  sending_phone_number_profile_id?: string | null;
463
607
 
@@ -539,7 +683,10 @@ export namespace ProfileDetail {
539
683
  created_at?: string;
540
684
 
541
685
  /**
542
- * CSP (Campaign Service Provider) ID
686
+ * @deprecated Deprecated and scheduled for removal. Identifies the Campaign
687
+ * Service Provider that registered the brand, which is Sent, so the value is the
688
+ * same for every brand and every account. Nothing on your side can act on it and
689
+ * there is no replacement. Stop reading it.
543
690
  */
544
691
  csp_id?: string | null;
545
692
 
@@ -650,11 +797,6 @@ export namespace ProfileDetail {
650
797
  */
651
798
  destination_countries?: Array<ProfilesAPI.DestinationCountry>;
652
799
 
653
- /**
654
- * Expected daily messaging volume
655
- */
656
- expected_messaging_volume?: string | null;
657
-
658
800
  /**
659
801
  * Whether this is a TCR (Campaign Registry) application
660
802
  */
@@ -715,137 +857,6 @@ export namespace ProfileDetail {
715
857
  }
716
858
  }
717
859
 
718
- /**
719
- * Business details and address for brand KYC
720
- */
721
- export interface SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandBusinessInfo {
722
- /**
723
- * City
724
- */
725
- city?: string | null;
726
-
727
- /**
728
- * Country code (e.g., US, CA)
729
- */
730
- country?: string | null;
731
-
732
- /**
733
- * Country where the business is registered
734
- */
735
- countryOfRegistration?: string | null;
736
-
737
- entityType?: 'PRIVATE_PROFIT' | 'PUBLIC_PROFIT' | 'NON_PROFIT' | 'SOLE_PROPRIETOR' | 'GOVERNMENT' | null;
738
-
739
- /**
740
- * Legal business name
741
- */
742
- legalName?: string | null;
743
-
744
- /**
745
- * Postal/ZIP code
746
- */
747
- postalCode?: string | null;
748
-
749
- /**
750
- * State/province code
751
- */
752
- state?: string | null;
753
-
754
- /**
755
- * Street address
756
- */
757
- street?: string | null;
758
-
759
- /**
760
- * Tax ID/EIN number
761
- */
762
- taxId?: string | null;
763
-
764
- /**
765
- * Type of tax ID (e.g., us_ein, ca_bn)
766
- */
767
- taxIdType?: string | null;
768
-
769
- /**
770
- * Business website URL
771
- */
772
- url?: string | null;
773
- }
774
-
775
- /**
776
- * Compliance and TCR information for brand registration
777
- */
778
- export interface SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandComplianceInfo {
779
- brandRelationship: TcrBrandRelationship;
780
-
781
- vertical: TcrVertical;
782
-
783
- /**
784
- * List of destination countries for messaging
785
- */
786
- destinationCountries?: Array<DestinationCountry> | null;
787
-
788
- /**
789
- * Expected daily messaging volume
790
- */
791
- expectedMessagingVolume?: string | null;
792
-
793
- /**
794
- * Whether this is a TCR (Campaign Registry) application
795
- */
796
- isTcrApplication?: boolean | null;
797
-
798
- /**
799
- * Additional notes about the business or use case
800
- */
801
- notes?: string | null;
802
-
803
- /**
804
- * Phone number prefix for messaging (e.g., "+1")
805
- */
806
- phoneNumberPrefix?: string | null;
807
-
808
- /**
809
- * Primary messaging use case description
810
- */
811
- primaryUseCase?: string | null;
812
- }
813
-
814
- /**
815
- * Contact information for brand KYC
816
- */
817
- export interface SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandContactInfo {
818
- /**
819
- * Primary contact name (required)
820
- */
821
- name: string;
822
-
823
- /**
824
- * Business/brand name
825
- */
826
- businessName?: string | null;
827
-
828
- /**
829
- * Contact email address
830
- */
831
- email?: string | null;
832
-
833
- /**
834
- * Contact phone number in E.164 format
835
- */
836
- phone?: string | null;
837
-
838
- /**
839
- * Contact phone country code (e.g., "1" for US)
840
- */
841
- phoneCountryCode?: string | null;
842
-
843
- /**
844
- * Contact's role in the business
845
- */
846
- role?: string | null;
847
- }
848
-
849
860
  export type TcrBrandRelationship =
850
861
  | 'BASIC_ACCOUNT'
851
862
  | 'MEDIUM_ACCOUNT'
@@ -1212,8 +1223,7 @@ export interface ProfileUpdateParams {
1212
1223
  sending_phone_number?: string | null;
1213
1224
 
1214
1225
  /**
1215
- * Body param: Reference to another profile to use for SMS/Telnyx configuration
1216
- * (optional)
1226
+ * Body param: Reference to another profile to use for SMS configuration (optional)
1217
1227
  */
1218
1228
  sending_phone_number_profile_id?: string | null;
1219
1229
 
@@ -1307,13 +1317,13 @@ export declare namespace Profiles {
1307
1317
  export {
1308
1318
  type APIResponseOfProfileDetail as APIResponseOfProfileDetail,
1309
1319
  type BillingContactInfo as BillingContactInfo,
1320
+ type BrandBusinessInfo as BrandBusinessInfo,
1321
+ type BrandComplianceInfo as BrandComplianceInfo,
1322
+ type BrandContactInfo as BrandContactInfo,
1310
1323
  type BrandsBrandData as BrandsBrandData,
1311
1324
  type DestinationCountry as DestinationCountry,
1312
1325
  type PaymentDetails as PaymentDetails,
1313
1326
  type ProfileDetail as ProfileDetail,
1314
- type SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandBusinessInfo as SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandBusinessInfo,
1315
- type SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandComplianceInfo as SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandComplianceInfo,
1316
- type SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandContactInfo as SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandContactInfo,
1317
1327
  type TcrBrandRelationship as TcrBrandRelationship,
1318
1328
  type TcrVertical as TcrVertical,
1319
1329
  type ProfileListResponse as ProfileListResponse,
@@ -1328,13 +1338,13 @@ export declare namespace Profiles {
1328
1338
 
1329
1339
  export {
1330
1340
  Campaigns as Campaigns,
1331
- type APIResponseOfTcrCampaignWithUseCases as APIResponseOfTcrCampaignWithUseCases,
1332
- type BaseDto as BaseDto,
1341
+ type APIResponseOfBrandCampaign as APIResponseOfBrandCampaign,
1342
+ type APIResponseOfListOfBrandCampaign as APIResponseOfListOfBrandCampaign,
1343
+ type BrandCampaign as BrandCampaign,
1333
1344
  type CampaignData as CampaignData,
1345
+ type CampaignUseCase as CampaignUseCase,
1346
+ type CampaignUseCaseData as CampaignUseCaseData,
1334
1347
  type MessagingUseCaseUs as MessagingUseCaseUs,
1335
- type SentDmServicesEndpointsCustomerApIv3ContractsRequestsCampaignsCampaignUseCaseData as SentDmServicesEndpointsCustomerApIv3ContractsRequestsCampaignsCampaignUseCaseData,
1336
- type TcrCampaignWithUseCases as TcrCampaignWithUseCases,
1337
- type CampaignListResponse as CampaignListResponse,
1338
1348
  type CampaignCreateParams as CampaignCreateParams,
1339
1349
  type CampaignUpdateParams as CampaignUpdateParams,
1340
1350
  type CampaignListParams as CampaignListParams,