@sendly/node 3.12.3 → 3.13.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.
package/dist/index.d.mts CHANGED
@@ -1075,6 +1075,320 @@ interface ValidateSessionTokenResponse {
1075
1075
  verifiedAt?: string;
1076
1076
  metadata?: Record<string, unknown>;
1077
1077
  }
1078
+ /**
1079
+ * Campaign status values
1080
+ */
1081
+ type CampaignStatus = "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "failed";
1082
+ /**
1083
+ * A bulk SMS campaign
1084
+ */
1085
+ interface Campaign {
1086
+ /** Unique campaign identifier */
1087
+ id: string;
1088
+ /** Campaign name */
1089
+ name: string;
1090
+ /** Message text with optional {{variables}} */
1091
+ text: string;
1092
+ /** Template ID if using a template */
1093
+ templateId?: string | null;
1094
+ /** Contact list IDs to send to */
1095
+ contactListIds: string[];
1096
+ /** Current status */
1097
+ status: CampaignStatus;
1098
+ /** Total recipients */
1099
+ recipientCount: number;
1100
+ /** Messages sent so far */
1101
+ sentCount: number;
1102
+ /** Messages delivered */
1103
+ deliveredCount: number;
1104
+ /** Messages failed */
1105
+ failedCount: number;
1106
+ /** Estimated credits needed */
1107
+ estimatedCredits: number;
1108
+ /** Credits actually used */
1109
+ creditsUsed: number;
1110
+ /** Scheduled send time (ISO string) */
1111
+ scheduledAt?: string | null;
1112
+ /** Timezone for scheduled send */
1113
+ timezone?: string | null;
1114
+ /** When campaign started sending */
1115
+ startedAt?: string | null;
1116
+ /** When campaign finished */
1117
+ completedAt?: string | null;
1118
+ /** Creation timestamp */
1119
+ createdAt: string;
1120
+ /** Last update timestamp */
1121
+ updatedAt: string;
1122
+ }
1123
+ /**
1124
+ * Request to create a new campaign
1125
+ */
1126
+ interface CreateCampaignRequest {
1127
+ /** Campaign name */
1128
+ name: string;
1129
+ /** Message text with optional {{variables}} */
1130
+ text: string;
1131
+ /** Template ID to use (optional) */
1132
+ templateId?: string;
1133
+ /** Contact list IDs to send to */
1134
+ contactListIds: string[];
1135
+ }
1136
+ /**
1137
+ * Request to update a campaign
1138
+ */
1139
+ interface UpdateCampaignRequest {
1140
+ /** Campaign name */
1141
+ name?: string;
1142
+ /** Message text */
1143
+ text?: string;
1144
+ /** Template ID */
1145
+ templateId?: string | null;
1146
+ /** Contact list IDs */
1147
+ contactListIds?: string[];
1148
+ }
1149
+ /**
1150
+ * Request to schedule a campaign
1151
+ */
1152
+ interface ScheduleCampaignRequest {
1153
+ /** When to send (ISO 8601 string) */
1154
+ scheduledAt: string;
1155
+ /** Timezone (e.g., "America/New_York") */
1156
+ timezone?: string;
1157
+ }
1158
+ /**
1159
+ * Campaign preview with recipient count and cost estimate
1160
+ */
1161
+ interface CampaignPreview {
1162
+ /** Campaign ID */
1163
+ id: string;
1164
+ /** Total recipients */
1165
+ recipientCount: number;
1166
+ /** Estimated segments (based on message length) */
1167
+ estimatedSegments: number;
1168
+ /** Estimated credits needed */
1169
+ estimatedCredits: number;
1170
+ /** Current credit balance */
1171
+ currentBalance: number;
1172
+ /** Whether user has enough credits */
1173
+ hasEnoughCredits: boolean;
1174
+ /** Breakdown by country/pricing tier */
1175
+ breakdown?: Array<{
1176
+ country: string;
1177
+ count: number;
1178
+ creditsPerMessage: number;
1179
+ totalCredits: number;
1180
+ }>;
1181
+ }
1182
+ /**
1183
+ * Options for listing campaigns
1184
+ */
1185
+ interface ListCampaignsOptions {
1186
+ /** Maximum campaigns to return */
1187
+ limit?: number;
1188
+ /** Offset for pagination */
1189
+ offset?: number;
1190
+ /** Filter by status */
1191
+ status?: CampaignStatus;
1192
+ }
1193
+ /**
1194
+ * Response from listing campaigns
1195
+ */
1196
+ interface CampaignListResponse {
1197
+ /** List of campaigns */
1198
+ campaigns: Campaign[];
1199
+ /** Total count (for pagination) */
1200
+ total: number;
1201
+ /** Current limit */
1202
+ limit: number;
1203
+ /** Current offset */
1204
+ offset: number;
1205
+ }
1206
+ /**
1207
+ * A contact in your address book
1208
+ */
1209
+ interface Contact {
1210
+ /**
1211
+ * Unique contact identifier
1212
+ */
1213
+ id: string;
1214
+ /**
1215
+ * Phone number in E.164 format
1216
+ */
1217
+ phoneNumber: string;
1218
+ /**
1219
+ * Contact name
1220
+ */
1221
+ name?: string | null;
1222
+ /**
1223
+ * Contact email
1224
+ */
1225
+ email?: string | null;
1226
+ /**
1227
+ * Custom metadata (key-value pairs)
1228
+ */
1229
+ metadata?: Record<string, any>;
1230
+ /**
1231
+ * Whether the contact has opted out
1232
+ */
1233
+ optedOut?: boolean;
1234
+ /**
1235
+ * When the contact was created
1236
+ */
1237
+ createdAt: string;
1238
+ /**
1239
+ * When the contact was last updated
1240
+ */
1241
+ updatedAt?: string;
1242
+ /**
1243
+ * Lists the contact belongs to (when fetching a single contact)
1244
+ */
1245
+ lists?: Array<{
1246
+ id: string;
1247
+ name: string;
1248
+ }>;
1249
+ }
1250
+ /**
1251
+ * Request to create a contact
1252
+ */
1253
+ interface CreateContactRequest {
1254
+ /**
1255
+ * Phone number in E.164 format (e.g., +15551234567)
1256
+ */
1257
+ phoneNumber: string;
1258
+ /**
1259
+ * Contact name
1260
+ */
1261
+ name?: string;
1262
+ /**
1263
+ * Contact email
1264
+ */
1265
+ email?: string;
1266
+ /**
1267
+ * Custom metadata
1268
+ */
1269
+ metadata?: Record<string, any>;
1270
+ }
1271
+ /**
1272
+ * Request to update a contact
1273
+ */
1274
+ interface UpdateContactRequest {
1275
+ /**
1276
+ * Contact name
1277
+ */
1278
+ name?: string;
1279
+ /**
1280
+ * Contact email
1281
+ */
1282
+ email?: string;
1283
+ /**
1284
+ * Custom metadata
1285
+ */
1286
+ metadata?: Record<string, any>;
1287
+ }
1288
+ /**
1289
+ * Options for listing contacts
1290
+ */
1291
+ interface ListContactsOptions {
1292
+ /**
1293
+ * Max contacts to return (default 50, max 100)
1294
+ */
1295
+ limit?: number;
1296
+ /**
1297
+ * Offset for pagination
1298
+ */
1299
+ offset?: number;
1300
+ /**
1301
+ * Search query (searches name, phone, email)
1302
+ */
1303
+ search?: string;
1304
+ /**
1305
+ * Filter by contact list ID
1306
+ */
1307
+ listId?: string;
1308
+ }
1309
+ /**
1310
+ * Response from listing contacts
1311
+ */
1312
+ interface ContactListResponse {
1313
+ contacts: Contact[];
1314
+ total: number;
1315
+ limit: number;
1316
+ offset: number;
1317
+ }
1318
+ /**
1319
+ * A contact list for organizing contacts
1320
+ */
1321
+ interface ContactList {
1322
+ /**
1323
+ * Unique list identifier
1324
+ */
1325
+ id: string;
1326
+ /**
1327
+ * List name
1328
+ */
1329
+ name: string;
1330
+ /**
1331
+ * List description
1332
+ */
1333
+ description?: string | null;
1334
+ /**
1335
+ * Number of contacts in the list
1336
+ */
1337
+ contactCount: number;
1338
+ /**
1339
+ * When the list was created
1340
+ */
1341
+ createdAt: string;
1342
+ /**
1343
+ * When the list was last updated
1344
+ */
1345
+ updatedAt?: string;
1346
+ /**
1347
+ * Contacts in the list (when fetching a single list with members)
1348
+ */
1349
+ contacts?: Array<{
1350
+ id: string;
1351
+ phoneNumber: string;
1352
+ name?: string | null;
1353
+ email?: string | null;
1354
+ }>;
1355
+ /**
1356
+ * Total contacts in the list (for pagination)
1357
+ */
1358
+ contactsTotal?: number;
1359
+ }
1360
+ /**
1361
+ * Request to create a contact list
1362
+ */
1363
+ interface CreateContactListRequest {
1364
+ /**
1365
+ * List name
1366
+ */
1367
+ name: string;
1368
+ /**
1369
+ * List description
1370
+ */
1371
+ description?: string;
1372
+ }
1373
+ /**
1374
+ * Request to update a contact list
1375
+ */
1376
+ interface UpdateContactListRequest {
1377
+ /**
1378
+ * List name
1379
+ */
1380
+ name?: string;
1381
+ /**
1382
+ * List description
1383
+ */
1384
+ description?: string;
1385
+ }
1386
+ /**
1387
+ * Response from listing contact lists
1388
+ */
1389
+ interface ContactListsResponse {
1390
+ lists: ContactList[];
1391
+ }
1078
1392
 
1079
1393
  /**
1080
1394
  * HTTP Client Utility
@@ -1765,6 +2079,48 @@ declare class AccountResource {
1765
2079
  * ```
1766
2080
  */
1767
2081
  revokeApiKey(id: string): Promise<void>;
2082
+ /**
2083
+ * Rename an API key
2084
+ *
2085
+ * @param id - API key ID
2086
+ * @param name - New name for the API key
2087
+ * @returns Updated API key
2088
+ *
2089
+ * @example
2090
+ * ```typescript
2091
+ * const key = await sendly.account.renameApiKey('key_xxx', 'Production Key');
2092
+ * console.log(`Renamed to: ${key.name}`);
2093
+ * ```
2094
+ */
2095
+ renameApiKey(id: string, name: string): Promise<ApiKey>;
2096
+ /**
2097
+ * Rotate an API key
2098
+ *
2099
+ * Creates a new key while optionally keeping the old one active for a grace period.
2100
+ *
2101
+ * @param id - API key ID to rotate
2102
+ * @param options - Rotation options
2103
+ * @returns New API key with the full key value
2104
+ *
2105
+ * @example
2106
+ * ```typescript
2107
+ * // Rotate immediately (old key stops working instantly)
2108
+ * const { newKey, key } = await sendly.account.rotateApiKey('key_xxx');
2109
+ * console.log(`New key: ${key}`); // Save this!
2110
+ *
2111
+ * // Rotate with 24-hour grace period (both keys work for 24h)
2112
+ * const { newKey, key } = await sendly.account.rotateApiKey('key_xxx', {
2113
+ * gracePeriodHours: 24
2114
+ * });
2115
+ * ```
2116
+ */
2117
+ rotateApiKey(id: string, options?: {
2118
+ gracePeriodHours?: number;
2119
+ }): Promise<{
2120
+ newKey: ApiKey;
2121
+ key: string;
2122
+ oldKeyExpiresAt?: string;
2123
+ }>;
1768
2124
  }
1769
2125
 
1770
2126
  /**
@@ -2045,9 +2401,456 @@ declare class TemplatesResource {
2045
2401
  * ```
2046
2402
  */
2047
2403
  delete(id: string): Promise<void>;
2404
+ /**
2405
+ * Clone a template
2406
+ *
2407
+ * Creates a copy of an existing template (including presets).
2408
+ *
2409
+ * @param id - Template ID to clone
2410
+ * @param options - Optional clone options
2411
+ * @returns The cloned template (as draft)
2412
+ *
2413
+ * @example
2414
+ * ```typescript
2415
+ * // Clone a preset template
2416
+ * const myOtp = await sendly.templates.clone('tpl_preset_otp', {
2417
+ * name: 'My Custom OTP'
2418
+ * });
2419
+ *
2420
+ * // Modify and publish
2421
+ * await sendly.templates.update(myOtp.id, {
2422
+ * text: 'Your {{app_name}} code: {{code}}. Expires in 5 min.'
2423
+ * });
2424
+ * await sendly.templates.publish(myOtp.id);
2425
+ * ```
2426
+ */
2427
+ clone(id: string, options?: {
2428
+ name?: string;
2429
+ }): Promise<Template>;
2048
2430
  private transformTemplate;
2049
2431
  }
2050
2432
 
2433
+ /**
2434
+ * Campaigns Resource - Bulk SMS Campaign Management
2435
+ * @packageDocumentation
2436
+ */
2437
+
2438
+ /**
2439
+ * Campaigns API resource for managing bulk SMS campaigns
2440
+ *
2441
+ * @example
2442
+ * ```typescript
2443
+ * // Create a campaign
2444
+ * const campaign = await sendly.campaigns.create({
2445
+ * name: 'Welcome Campaign',
2446
+ * text: 'Hello {{name}}, welcome to our service!',
2447
+ * contactListIds: ['lst_xxx']
2448
+ * });
2449
+ *
2450
+ * // Preview before sending
2451
+ * const preview = await sendly.campaigns.preview(campaign.id);
2452
+ * console.log(`Will send to ${preview.recipientCount} recipients`);
2453
+ * console.log(`Cost: ${preview.estimatedCredits} credits`);
2454
+ *
2455
+ * // Send immediately or schedule
2456
+ * await sendly.campaigns.send(campaign.id);
2457
+ * // or
2458
+ * await sendly.campaigns.schedule(campaign.id, {
2459
+ * scheduledAt: '2024-01-15T10:00:00Z',
2460
+ * timezone: 'America/New_York'
2461
+ * });
2462
+ * ```
2463
+ */
2464
+ declare class CampaignsResource {
2465
+ private readonly http;
2466
+ constructor(http: HttpClient);
2467
+ /**
2468
+ * Create a new campaign
2469
+ *
2470
+ * @param request - Campaign details
2471
+ * @returns The created campaign (as draft)
2472
+ *
2473
+ * @example
2474
+ * ```typescript
2475
+ * const campaign = await sendly.campaigns.create({
2476
+ * name: 'Black Friday Sale',
2477
+ * text: 'Hi {{name}}! 50% off everything today only. Shop now!',
2478
+ * contactListIds: ['lst_customers', 'lst_subscribers']
2479
+ * });
2480
+ * ```
2481
+ */
2482
+ create(request: CreateCampaignRequest): Promise<Campaign>;
2483
+ /**
2484
+ * List campaigns with optional filtering
2485
+ *
2486
+ * @param options - Filter and pagination options
2487
+ * @returns List of campaigns
2488
+ *
2489
+ * @example
2490
+ * ```typescript
2491
+ * // List all campaigns
2492
+ * const { campaigns } = await sendly.campaigns.list();
2493
+ *
2494
+ * // List only scheduled campaigns
2495
+ * const { campaigns } = await sendly.campaigns.list({ status: 'scheduled' });
2496
+ *
2497
+ * // Paginate
2498
+ * const { campaigns, total } = await sendly.campaigns.list({ limit: 10, offset: 20 });
2499
+ * ```
2500
+ */
2501
+ list(options?: ListCampaignsOptions): Promise<CampaignListResponse>;
2502
+ /**
2503
+ * Get a campaign by ID
2504
+ *
2505
+ * @param id - Campaign ID
2506
+ * @returns The campaign
2507
+ *
2508
+ * @example
2509
+ * ```typescript
2510
+ * const campaign = await sendly.campaigns.get('cmp_xxx');
2511
+ * console.log(`Status: ${campaign.status}`);
2512
+ * console.log(`Delivered: ${campaign.deliveredCount}/${campaign.recipientCount}`);
2513
+ * ```
2514
+ */
2515
+ get(id: string): Promise<Campaign>;
2516
+ /**
2517
+ * Update a campaign (draft or scheduled only)
2518
+ *
2519
+ * @param id - Campaign ID
2520
+ * @param request - Fields to update
2521
+ * @returns The updated campaign
2522
+ *
2523
+ * @example
2524
+ * ```typescript
2525
+ * const campaign = await sendly.campaigns.update('cmp_xxx', {
2526
+ * name: 'Updated Campaign Name',
2527
+ * text: 'New message text with {{variable}}'
2528
+ * });
2529
+ * ```
2530
+ */
2531
+ update(id: string, request: UpdateCampaignRequest): Promise<Campaign>;
2532
+ /**
2533
+ * Delete a campaign
2534
+ *
2535
+ * Only draft and cancelled campaigns can be deleted.
2536
+ *
2537
+ * @param id - Campaign ID
2538
+ *
2539
+ * @example
2540
+ * ```typescript
2541
+ * await sendly.campaigns.delete('cmp_xxx');
2542
+ * ```
2543
+ */
2544
+ delete(id: string): Promise<void>;
2545
+ /**
2546
+ * Preview a campaign before sending
2547
+ *
2548
+ * Returns recipient count, credit estimate, and breakdown by country.
2549
+ *
2550
+ * @param id - Campaign ID
2551
+ * @returns Campaign preview with cost estimate
2552
+ *
2553
+ * @example
2554
+ * ```typescript
2555
+ * const preview = await sendly.campaigns.preview('cmp_xxx');
2556
+ *
2557
+ * console.log(`Recipients: ${preview.recipientCount}`);
2558
+ * console.log(`Estimated cost: ${preview.estimatedCredits} credits`);
2559
+ * console.log(`Your balance: ${preview.currentBalance} credits`);
2560
+ *
2561
+ * if (!preview.hasEnoughCredits) {
2562
+ * console.log('Not enough credits! Please top up.');
2563
+ * }
2564
+ * ```
2565
+ */
2566
+ preview(id: string): Promise<CampaignPreview>;
2567
+ /**
2568
+ * Send a campaign immediately
2569
+ *
2570
+ * @param id - Campaign ID
2571
+ * @returns The updated campaign (status: sending)
2572
+ *
2573
+ * @example
2574
+ * ```typescript
2575
+ * const campaign = await sendly.campaigns.send('cmp_xxx');
2576
+ * console.log(`Campaign is now ${campaign.status}`);
2577
+ * ```
2578
+ */
2579
+ send(id: string): Promise<Campaign>;
2580
+ /**
2581
+ * Schedule a campaign for later
2582
+ *
2583
+ * @param id - Campaign ID
2584
+ * @param request - Schedule details
2585
+ * @returns The updated campaign (status: scheduled)
2586
+ *
2587
+ * @example
2588
+ * ```typescript
2589
+ * const campaign = await sendly.campaigns.schedule('cmp_xxx', {
2590
+ * scheduledAt: '2024-01-15T10:00:00Z',
2591
+ * timezone: 'America/New_York'
2592
+ * });
2593
+ *
2594
+ * console.log(`Scheduled for ${campaign.scheduledAt}`);
2595
+ * ```
2596
+ */
2597
+ schedule(id: string, request: ScheduleCampaignRequest): Promise<Campaign>;
2598
+ /**
2599
+ * Cancel a scheduled campaign
2600
+ *
2601
+ * @param id - Campaign ID
2602
+ * @returns The updated campaign (status: cancelled)
2603
+ *
2604
+ * @example
2605
+ * ```typescript
2606
+ * const campaign = await sendly.campaigns.cancel('cmp_xxx');
2607
+ * console.log(`Campaign cancelled`);
2608
+ * ```
2609
+ */
2610
+ cancel(id: string): Promise<Campaign>;
2611
+ /**
2612
+ * Clone a campaign
2613
+ *
2614
+ * Creates a new draft campaign with the same settings.
2615
+ *
2616
+ * @param id - Campaign ID to clone
2617
+ * @returns The new campaign (as draft)
2618
+ *
2619
+ * @example
2620
+ * ```typescript
2621
+ * const cloned = await sendly.campaigns.clone('cmp_xxx');
2622
+ * console.log(`Created clone: ${cloned.id}`);
2623
+ * ```
2624
+ */
2625
+ clone(id: string): Promise<Campaign>;
2626
+ private transformCampaign;
2627
+ }
2628
+
2629
+ /**
2630
+ * Contacts Resource - Contact & List Management
2631
+ * @packageDocumentation
2632
+ */
2633
+
2634
+ /**
2635
+ * Contacts API resource for managing contacts and contact lists
2636
+ *
2637
+ * @example
2638
+ * ```typescript
2639
+ * // Create a contact
2640
+ * const contact = await sendly.contacts.create({
2641
+ * phoneNumber: '+15551234567',
2642
+ * name: 'John Doe',
2643
+ * email: 'john@example.com'
2644
+ * });
2645
+ *
2646
+ * // Create a list and add contacts
2647
+ * const list = await sendly.contacts.lists.create({ name: 'Newsletter Subscribers' });
2648
+ * await sendly.contacts.lists.addContacts(list.id, [contact.id]);
2649
+ * ```
2650
+ */
2651
+ declare class ContactsResource {
2652
+ private readonly http;
2653
+ readonly lists: ContactListsResource;
2654
+ constructor(http: HttpClient);
2655
+ /**
2656
+ * List contacts with optional filtering
2657
+ *
2658
+ * @param options - Filter and pagination options
2659
+ * @returns List of contacts
2660
+ *
2661
+ * @example
2662
+ * ```typescript
2663
+ * // List all contacts
2664
+ * const { contacts, total } = await sendly.contacts.list();
2665
+ *
2666
+ * // Search contacts
2667
+ * const { contacts } = await sendly.contacts.list({ search: 'john' });
2668
+ *
2669
+ * // List contacts in a specific list
2670
+ * const { contacts } = await sendly.contacts.list({ listId: 'lst_xxx' });
2671
+ * ```
2672
+ */
2673
+ list(options?: ListContactsOptions): Promise<ContactListResponse>;
2674
+ /**
2675
+ * Get a contact by ID
2676
+ *
2677
+ * @param id - Contact ID
2678
+ * @returns The contact with associated lists
2679
+ *
2680
+ * @example
2681
+ * ```typescript
2682
+ * const contact = await sendly.contacts.get('cnt_xxx');
2683
+ * console.log(`${contact.name}: ${contact.phoneNumber}`);
2684
+ * console.log(`In ${contact.lists?.length || 0} lists`);
2685
+ * ```
2686
+ */
2687
+ get(id: string): Promise<Contact>;
2688
+ /**
2689
+ * Create a new contact
2690
+ *
2691
+ * @param request - Contact details
2692
+ * @returns The created contact
2693
+ *
2694
+ * @example
2695
+ * ```typescript
2696
+ * const contact = await sendly.contacts.create({
2697
+ * phoneNumber: '+15551234567',
2698
+ * name: 'Jane Smith',
2699
+ * email: 'jane@example.com',
2700
+ * metadata: { source: 'signup_form', plan: 'premium' }
2701
+ * });
2702
+ * ```
2703
+ */
2704
+ create(request: CreateContactRequest): Promise<Contact>;
2705
+ /**
2706
+ * Update a contact
2707
+ *
2708
+ * @param id - Contact ID
2709
+ * @param request - Fields to update
2710
+ * @returns The updated contact
2711
+ *
2712
+ * @example
2713
+ * ```typescript
2714
+ * const contact = await sendly.contacts.update('cnt_xxx', {
2715
+ * name: 'Jane Doe',
2716
+ * metadata: { plan: 'enterprise' }
2717
+ * });
2718
+ * ```
2719
+ */
2720
+ update(id: string, request: UpdateContactRequest): Promise<Contact>;
2721
+ /**
2722
+ * Delete a contact
2723
+ *
2724
+ * @param id - Contact ID
2725
+ *
2726
+ * @example
2727
+ * ```typescript
2728
+ * await sendly.contacts.delete('cnt_xxx');
2729
+ * ```
2730
+ */
2731
+ delete(id: string): Promise<void>;
2732
+ private transformContact;
2733
+ }
2734
+ /**
2735
+ * Contact Lists sub-resource
2736
+ */
2737
+ declare class ContactListsResource {
2738
+ private readonly http;
2739
+ constructor(http: HttpClient);
2740
+ /**
2741
+ * List all contact lists
2742
+ *
2743
+ * @returns All contact lists
2744
+ *
2745
+ * @example
2746
+ * ```typescript
2747
+ * const { lists } = await sendly.contacts.lists.list();
2748
+ * for (const list of lists) {
2749
+ * console.log(`${list.name}: ${list.contactCount} contacts`);
2750
+ * }
2751
+ * ```
2752
+ */
2753
+ list(): Promise<ContactListsResponse>;
2754
+ /**
2755
+ * Get a contact list by ID
2756
+ *
2757
+ * @param id - Contact list ID
2758
+ * @param options - Pagination options for contacts
2759
+ * @returns The contact list with members
2760
+ *
2761
+ * @example
2762
+ * ```typescript
2763
+ * const list = await sendly.contacts.lists.get('lst_xxx');
2764
+ * console.log(`${list.name}: ${list.contactCount} contacts`);
2765
+ *
2766
+ * // Get list with paginated contacts
2767
+ * const list = await sendly.contacts.lists.get('lst_xxx', { limit: 100 });
2768
+ * console.log(`Showing ${list.contacts?.length} of ${list.contactsTotal}`);
2769
+ * ```
2770
+ */
2771
+ get(id: string, options?: {
2772
+ limit?: number;
2773
+ offset?: number;
2774
+ }): Promise<ContactList>;
2775
+ /**
2776
+ * Create a new contact list
2777
+ *
2778
+ * @param request - List details
2779
+ * @returns The created list
2780
+ *
2781
+ * @example
2782
+ * ```typescript
2783
+ * const list = await sendly.contacts.lists.create({
2784
+ * name: 'VIP Customers',
2785
+ * description: 'High-value customers for priority messaging'
2786
+ * });
2787
+ * ```
2788
+ */
2789
+ create(request: CreateContactListRequest): Promise<ContactList>;
2790
+ /**
2791
+ * Update a contact list
2792
+ *
2793
+ * @param id - Contact list ID
2794
+ * @param request - Fields to update
2795
+ * @returns The updated list
2796
+ *
2797
+ * @example
2798
+ * ```typescript
2799
+ * const list = await sendly.contacts.lists.update('lst_xxx', {
2800
+ * name: 'Premium Subscribers',
2801
+ * description: 'Updated description'
2802
+ * });
2803
+ * ```
2804
+ */
2805
+ update(id: string, request: UpdateContactListRequest): Promise<ContactList>;
2806
+ /**
2807
+ * Delete a contact list
2808
+ *
2809
+ * This does not delete the contacts in the list.
2810
+ *
2811
+ * @param id - Contact list ID
2812
+ *
2813
+ * @example
2814
+ * ```typescript
2815
+ * await sendly.contacts.lists.delete('lst_xxx');
2816
+ * ```
2817
+ */
2818
+ delete(id: string): Promise<void>;
2819
+ /**
2820
+ * Add contacts to a list
2821
+ *
2822
+ * @param listId - Contact list ID
2823
+ * @param contactIds - Array of contact IDs to add
2824
+ * @returns Number of contacts added
2825
+ *
2826
+ * @example
2827
+ * ```typescript
2828
+ * const result = await sendly.contacts.lists.addContacts('lst_xxx', [
2829
+ * 'cnt_abc',
2830
+ * 'cnt_def',
2831
+ * 'cnt_ghi'
2832
+ * ]);
2833
+ * console.log(`Added ${result.addedCount} contacts`);
2834
+ * ```
2835
+ */
2836
+ addContacts(listId: string, contactIds: string[]): Promise<{
2837
+ addedCount: number;
2838
+ }>;
2839
+ /**
2840
+ * Remove a contact from a list
2841
+ *
2842
+ * @param listId - Contact list ID
2843
+ * @param contactId - Contact ID to remove
2844
+ *
2845
+ * @example
2846
+ * ```typescript
2847
+ * await sendly.contacts.lists.removeContact('lst_xxx', 'cnt_abc');
2848
+ * ```
2849
+ */
2850
+ removeContact(listId: string, contactId: string): Promise<void>;
2851
+ private transformList;
2852
+ }
2853
+
2051
2854
  /**
2052
2855
  * Sendly Client
2053
2856
  * @packageDocumentation
@@ -2177,6 +2980,47 @@ declare class Sendly {
2177
2980
  * ```
2178
2981
  */
2179
2982
  readonly templates: TemplatesResource;
2983
+ /**
2984
+ * Campaigns API resource - Bulk SMS campaign management
2985
+ *
2986
+ * @example
2987
+ * ```typescript
2988
+ * // Create a campaign
2989
+ * const campaign = await sendly.campaigns.create({
2990
+ * name: 'Welcome Campaign',
2991
+ * text: 'Hello {{name}}!',
2992
+ * contactListIds: ['lst_xxx']
2993
+ * });
2994
+ *
2995
+ * // Preview cost
2996
+ * const preview = await sendly.campaigns.preview(campaign.id);
2997
+ * console.log(`Cost: ${preview.estimatedCredits} credits`);
2998
+ *
2999
+ * // Send or schedule
3000
+ * await sendly.campaigns.send(campaign.id);
3001
+ * ```
3002
+ */
3003
+ readonly campaigns: CampaignsResource;
3004
+ /**
3005
+ * Contacts API resource - Contact and list management
3006
+ *
3007
+ * @example
3008
+ * ```typescript
3009
+ * // Create a contact
3010
+ * const contact = await sendly.contacts.create({
3011
+ * phoneNumber: '+15551234567',
3012
+ * name: 'John Doe'
3013
+ * });
3014
+ *
3015
+ * // Create a list and add contacts
3016
+ * const list = await sendly.contacts.lists.create({ name: 'VIPs' });
3017
+ * await sendly.contacts.lists.addContacts(list.id, [contact.id]);
3018
+ *
3019
+ * // List all contacts
3020
+ * const { contacts } = await sendly.contacts.list();
3021
+ * ```
3022
+ */
3023
+ readonly contacts: ContactsResource;
2180
3024
  private readonly http;
2181
3025
  private readonly config;
2182
3026
  /**
@@ -2627,4 +3471,4 @@ declare class Webhooks {
2627
3471
  */
2628
3472
  type WebhookMessageData = WebhookMessageObject;
2629
3473
 
2630
- export { ALL_SUPPORTED_COUNTRIES, type Account, type ApiErrorResponse, type ApiKey, AuthenticationError, type BatchListResponse, type BatchMessageItem, type BatchMessageRequest, type BatchMessageResponse, type BatchMessageResult, type BatchStatus, CREDITS_PER_SMS, type CancelledMessageResponse, type CheckVerificationRequest, type CheckVerificationResponse, type CircuitState, type CreateTemplateRequest, type CreateVerifySessionRequest, type CreateWebhookOptions, type CreditTransaction, type Credits, type DeliveryStatus, InsufficientCreditsError, type ListBatchesOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, type ListVerificationsOptions, type Message, type MessageListResponse, type MessageStatus, type MessageType, NetworkError, NotFoundError, type PricingTier, RateLimitError, type RateLimitInfo, SANDBOX_TEST_NUMBERS, SUPPORTED_COUNTRIES, type ScheduleMessageRequest, type ScheduledMessage, type ScheduledMessageListResponse, type ScheduledMessageStatus, type SendMessageRequest, type SendVerificationRequest, type SendVerificationResponse, type SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, type Template, type TemplateListResponse, type TemplatePreview, type TemplateStatus, type TemplateVariable, TimeoutError, type UpdateTemplateRequest, type UpdateWebhookOptions, type ValidateSessionTokenRequest, type ValidateSessionTokenResponse, ValidationError, type Verification, type VerificationDeliveryStatus, type VerificationListResponse, type VerificationStatus, type VerifySession, type VerifySessionStatus, type Webhook, type WebhookCreatedResponse, type WebhookDelivery, type WebhookEvent, type WebhookEventType, type WebhookMessageData, type WebhookMessageStatus, type WebhookSecretRotation, WebhookSignatureError, type WebhookTestResult, Webhooks, calculateSegments, Sendly as default, generateWebhookSignature, getCountryFromPhone, isCountrySupported, parseWebhookEvent, validateMessageText, validatePhoneNumber, validateSenderId, verifyWebhookSignature };
3474
+ export { ALL_SUPPORTED_COUNTRIES, type Account, type ApiErrorResponse, type ApiKey, AuthenticationError, type BatchListResponse, type BatchMessageItem, type BatchMessageRequest, type BatchMessageResponse, type BatchMessageResult, type BatchStatus, CREDITS_PER_SMS, type Campaign, type CampaignListResponse, type CampaignPreview, type CampaignStatus, type CancelledMessageResponse, type CheckVerificationRequest, type CheckVerificationResponse, type CircuitState, type Contact, type ContactList, type ContactListResponse, type ContactListsResponse, type CreateCampaignRequest, type CreateContactListRequest, type CreateContactRequest, type CreateTemplateRequest, type CreateVerifySessionRequest, type CreateWebhookOptions, type CreditTransaction, type Credits, type DeliveryStatus, InsufficientCreditsError, type ListBatchesOptions, type ListCampaignsOptions, type ListContactsOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, type ListVerificationsOptions, type Message, type MessageListResponse, type MessageStatus, type MessageType, NetworkError, NotFoundError, type PricingTier, RateLimitError, type RateLimitInfo, SANDBOX_TEST_NUMBERS, SUPPORTED_COUNTRIES, type ScheduleCampaignRequest, type ScheduleMessageRequest, type ScheduledMessage, type ScheduledMessageListResponse, type ScheduledMessageStatus, type SendMessageRequest, type SendVerificationRequest, type SendVerificationResponse, type SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, type Template, type TemplateListResponse, type TemplatePreview, type TemplateStatus, type TemplateVariable, TimeoutError, type UpdateCampaignRequest, type UpdateContactListRequest, type UpdateContactRequest, type UpdateTemplateRequest, type UpdateWebhookOptions, type ValidateSessionTokenRequest, type ValidateSessionTokenResponse, ValidationError, type Verification, type VerificationDeliveryStatus, type VerificationListResponse, type VerificationStatus, type VerifySession, type VerifySessionStatus, type Webhook, type WebhookCreatedResponse, type WebhookDelivery, type WebhookEvent, type WebhookEventType, type WebhookMessageData, type WebhookMessageStatus, type WebhookSecretRotation, WebhookSignatureError, type WebhookTestResult, Webhooks, calculateSegments, Sendly as default, generateWebhookSignature, getCountryFromPhone, isCountrySupported, parseWebhookEvent, validateMessageText, validatePhoneNumber, validateSenderId, verifyWebhookSignature };