migma 1.8.1 → 1.10.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/README.md CHANGED
@@ -100,7 +100,7 @@ await migma.sending.send({
100
100
  - Full coverage of all Migma API v1 endpoints (80+ methods across 16 resources)
101
101
  - TypeScript-first with complete type definitions
102
102
  - `{ data, error }` return pattern — methods never throw
103
- - Automatic retries with exponential backoff on 5xx/429
103
+ - Automatic retries with exponential backoff on 5xx/429, except unsafe synchronous email edits
104
104
  - Polling helpers for async operations (email generation, project import, previews)
105
105
  - Zero runtime dependencies (uses native `fetch`)
106
106
  - Dual ESM + CommonJS support
@@ -344,11 +344,55 @@ for (const generated of series?.result?.emails ?? []) {
344
344
  const { data: email } = await migma.emails.get('email_abc123');
345
345
  console.log(email?.html);
346
346
 
347
- await migma.emails.edit('email_abc123', {
347
+ // Existing synchronous edit. Automatic retries are disabled because an
348
+ // ambiguous failure may still have saved changes.
349
+ const syncEdit = await migma.emails.edit('email_abc123', {
348
350
  prompt: 'Change the CTA from "Start now" to "Start your trial"',
349
351
  });
352
+
353
+ if (syncEdit.error) {
354
+ // Fetch and inspect the stored email before manually retrying.
355
+ await migma.emails.get('email_abc123');
356
+ }
357
+
358
+ // Queued edit. The SDK creates an idempotency key and reuses it across its
359
+ // HTTP retries. Supply one explicitly to reuse it across caller-level retries.
360
+ const started = await migma.emails.startEdit(
361
+ 'email_abc123',
362
+ {
363
+ prompt: 'Use a shorter headline',
364
+ label: 'Short headline',
365
+ },
366
+ { idempotencyKey: 'edit-email_abc123-short-headline' },
367
+ );
368
+ if (started.error) throw started.error;
369
+
370
+ const polled = await migma.emails.getEditStatus(
371
+ 'email_abc123',
372
+ started.data.editId,
373
+ );
374
+ if (polled.error) throw polled.error;
375
+ const editStatus = polled.data;
376
+
377
+ if (editStatus.status === 'completed' && editStatus.result) {
378
+ console.log(editStatus.result.html);
379
+ }
350
380
  ```
351
381
 
382
+ `startEdit(emailId, { prompt, label? }, options?: CallOptions)` returns
383
+ `MigmaResult<EmailEditOperation>` after durable queueing. It requires
384
+ `email:write` and `email:read`; credits are checked when the worker starts, and
385
+ no AI work runs on the request path. Its initial response can already have a
386
+ terminal status on an idempotent replay, but does not include `result`. Poll
387
+ `getEditStatus(emailId, editId)` according to `pollAfterMs`.
388
+
389
+ Use the edit-specific status, not conversation generation status: an earlier
390
+ conversation turn may already be completed. There is no `editAndWait` helper.
391
+ Failed or stalled rewrites are not automatically retried; if a failure reports
392
+ `changesMayHaveBeenSaved`, inspect the stored email before starting another
393
+ edit. Section and image complexity, provider behavior, and retries affect total
394
+ time, so no fixed maximum edit latency is established.
395
+
352
396
  ### Campaigns
353
397
 
354
398
  Create a campaign from a generated email, send or schedule it, then read its
@@ -380,6 +424,13 @@ await migma.campaigns.schedule(
380
424
  { idempotencyKey: `campaign-send-${campaign.id}` },
381
425
  );
382
426
 
427
+ // Or 11:00 in each contact's own time zone (by country), the same clock time as 11:00 New York
428
+ await migma.campaigns.schedule(campaign.id, {
429
+ scheduledAt: '2026-07-01T15:00:00Z',
430
+ scheduledTimezone: 'America/New_York',
431
+ localTimeDelivery: true,
432
+ });
433
+
383
434
  // Aggregated engagement metrics (cached, may be slightly stale)
384
435
  const { data: stats } = await migma.campaigns.stats(campaign.id);
385
436
  console.log(stats?.openRate, stats?.clickRate, stats?.lastUpdated);
@@ -419,6 +470,13 @@ characters) and is scoped to your API key for 24 hours:
419
470
  the SDK reuses your key across its own automatic retries, so a retried call
420
471
  never duplicates.
421
472
 
473
+ For queued email edits, idempotency is scoped to the authenticated API key and
474
+ email. The same key with the same prompt and label returns the same
475
+ job; a conflicting body returns `409 IDEMPOTENCY_CONFLICT`. Its receipt remains
476
+ available for at least 24 hours after terminal completion under normal cleanup.
477
+ Keep the same key after an uncertain start. Existing synchronous email edits are
478
+ not idempotent.
479
+
422
480
  ```typescript
423
481
  // Sending — key on the recipient + send time
424
482
  await migma.sending.send(
@@ -646,7 +704,7 @@ await migma.images.updateLogos('proj_abc123', {
646
704
  | `migma.sending` | `send` `getBatchStatus` | [Sending](https://docs.migma.ai/api-reference/sending/send-email) |
647
705
  | `migma.metrics` | `sending` | [API Reference](https://docs.migma.ai/api-reference/introduction) |
648
706
  | `migma.projects` | `list` `get` `import` `getImportStatus` `retryImport` `fieldCatalog` `importAndWait` | [Projects](https://docs.migma.ai/api-reference/projects/list-projects) |
649
- | `migma.emails` | `generate` `importHtml` `getGenerationStatus` `generateAndWait` `importHtmlAndWait` `sendTest` `get` `edit` | [Email Generation](https://docs.migma.ai/api-reference/email/generate-email-async) |
707
+ | `migma.emails` | `generate` `importHtml` `getGenerationStatus` `generateAndWait` `importHtmlAndWait` `sendTest` `get` `edit` `startEdit` `getEditStatus` | [Email Generation](https://docs.migma.ai/api-reference/email/generate-email-async) |
650
708
  | `migma.campaigns` | `list` `create` `get` `send` `schedule` `cancel` `stats` `logs` `archive` `unarchive` | [Campaigns](https://docs.migma.ai/campaigns/overview) |
651
709
  | `migma.validation` | `all` `compatibility` `links` `spelling` `deliverability` | [Validation](https://docs.migma.ai/api-reference/email-validation/run-all-validation-checks) |
652
710
  | `migma.previews` | `create` `get` `getStatus` `getDevice` `getSupportedDevices` `createAndWait` | [Previews](https://docs.migma.ai/api-reference/email-previews/create-email-preview) |
package/dist/index.d.mts CHANGED
@@ -61,9 +61,12 @@ interface RequestOptions {
61
61
  body?: Record<string, unknown>;
62
62
  query?: Record<string, string | number | boolean | undefined>;
63
63
  headers?: Record<string, string>;
64
+ maxRetries?: number;
64
65
  }
65
66
  /** Per-call options for write methods (POST/PATCH/DELETE). */
66
67
  interface CallOptions {
68
+ /** Override automatic retries for this call. Use 0 for unsafe writes. */
69
+ maxRetries?: number;
67
70
  /**
68
71
  * Optional Idempotency-Key (max 100 chars). Same key + same body within 24h
69
72
  * replays the original response; a different body returns 409 IDEMPOTENCY_CONFLICT.
@@ -100,6 +103,64 @@ declare class MigmaClient {
100
103
  private sleep;
101
104
  }
102
105
 
106
+ interface SegmentFieldFilter {
107
+ key: string;
108
+ /** Exact/pattern, date, or numeric comparison. Date/number comparisons use one
109
+ * value; date_between/number_between use two ordered bounds. */
110
+ mode?: 'is' | 'is_not' | 'starts_with' | 'ends_with' | 'contains' | 'not_contains' | 'date_after' | 'date_before' | 'date_on' | 'date_between' | 'number_gt' | 'number_gte' | 'number_lt' | 'number_lte' | 'number_between';
111
+ values: string[];
112
+ }
113
+ interface SegmentActivityFilter {
114
+ action: 'sent' | 'opened' | 'clicked';
115
+ channel?: 'email';
116
+ mode: 'within' | 'before' | 'never' | 'between';
117
+ unit?: 'hours' | 'days';
118
+ amount?: number;
119
+ from?: string | Date;
120
+ to?: string | Date;
121
+ campaignId?: string;
122
+ }
123
+ interface SegmentFilters {
124
+ /** Combines this group's conditions and child groups. Defaults to all (AND).
125
+ * Campaign-scoped activity requires all in its group and every ancestor. */
126
+ match?: 'all' | 'any';
127
+ /** Nonempty child groups: at most 10 per group, 3 levels below the root,
128
+ * and 50 conditions across the entire filter tree. The root may be empty. */
129
+ groups?: SegmentFilters[];
130
+ tags?: string[];
131
+ excludeTags?: string[];
132
+ status?: 'subscribed' | 'unsubscribed' | 'non-subscribed' | 'bounced';
133
+ validationStatus?: 'valid' | 'invalid' | 'risky' | 'unknown';
134
+ customFields?: Record<string, string[]>;
135
+ fields?: SegmentFieldFilter[];
136
+ activity?: SegmentActivityFilter[];
137
+ }
138
+ interface Segment {
139
+ id: string;
140
+ name: string;
141
+ description: string;
142
+ filters: SegmentFilters;
143
+ count: number;
144
+ createdAt: string;
145
+ updatedAt: string;
146
+ }
147
+ interface CreateSegmentParams {
148
+ name: string;
149
+ description?: string;
150
+ filters?: SegmentFilters;
151
+ projectId: string;
152
+ }
153
+ interface UpdateSegmentParams {
154
+ name?: string;
155
+ description?: string;
156
+ filters?: SegmentFilters;
157
+ projectId: string;
158
+ }
159
+ interface ListSegmentsResponse {
160
+ data: Segment[];
161
+ count: number;
162
+ }
163
+
103
164
  type ContactStatus = 'subscribed' | 'unsubscribed' | 'bounced' | 'non-subscribed';
104
165
  interface Contact {
105
166
  id: string;
@@ -209,6 +270,64 @@ interface ChangeStatusParams {
209
270
  tags?: string[];
210
271
  projectId: string;
211
272
  }
273
+ interface CreateContactExportParams {
274
+ projectId: string;
275
+ segmentId?: string;
276
+ /** Same filters used by saved segments; tags are IDs, not names. */
277
+ filters?: SegmentFilters & {
278
+ search?: string;
279
+ };
280
+ }
281
+ interface ContactExportStatus {
282
+ jobId: string;
283
+ projectId: string;
284
+ status: 'pending' | 'processing' | 'completed' | 'failed';
285
+ contactCount: number;
286
+ fileName: string;
287
+ createdAt: string;
288
+ completedAt: string | null;
289
+ /** Present only after the private CSV has been uploaded. Expires after one hour. */
290
+ downloadUrl?: string;
291
+ downloadExpiresAt?: string;
292
+ error?: string;
293
+ }
294
+ type ContactImportProvider = 'klaviyo' | 'mailchimp' | 'hubspot';
295
+ /** A list or segment in the connected provider account that can be imported. */
296
+ interface ProviderImportSource {
297
+ id: string;
298
+ type: 'audience' | 'segment' | 'tag' | 'list';
299
+ name: string;
300
+ [key: string]: unknown;
301
+ }
302
+ interface ListProviderImportSourcesParams {
303
+ provider: ContactImportProvider;
304
+ projectId: string;
305
+ /** Only when the brand has several accounts connected for this provider. */
306
+ connectionId?: string;
307
+ }
308
+ interface ImportFromProviderParams {
309
+ provider: ContactImportProvider;
310
+ projectId: string;
311
+ /** 1 to 25 sources from listProviderImportSources. */
312
+ sources: Pick<ProviderImportSource, 'id' | 'type' | 'name'>[];
313
+ /** Default subscribed-only. */
314
+ consentMode?: 'subscribed-only' | 'include-all';
315
+ connectionId?: string;
316
+ }
317
+ /** Each import becomes a tag and a segment named after its sources. Poll the import with its id. */
318
+ interface ProviderImportStarted {
319
+ object: 'contact_import';
320
+ id: string;
321
+ status: 'pending';
322
+ tag: {
323
+ id: string;
324
+ name: string;
325
+ };
326
+ segment: {
327
+ id: string;
328
+ name: string;
329
+ };
330
+ }
212
331
 
213
332
  declare class Contacts {
214
333
  private readonly client;
@@ -222,6 +341,15 @@ declare class Contacts {
222
341
  getBulkImportStatus(jobId: string): Promise<MigmaResult<BulkImportJobStatus>>;
223
342
  /** Batch delete contacts by email (up to 1000). Emails with no match come back in `notFound`. */
224
343
  bulkDeleteByEmail(params: BatchDeleteContactsParams, options?: CallOptions): Promise<MigmaResult<BatchDeleteResponse>>;
344
+ /** Queue a filtered CSV export. Poll getExport; do not list every contact to build a CSV. */
345
+ createExport(params: CreateContactExportParams, options?: CallOptions): Promise<MigmaResult<ContactExportStatus>>;
346
+ getExport(jobId: string, projectId: string): Promise<MigmaResult<ContactExportStatus>>;
347
+ /** Lists and segments in the brand's connected Klaviyo, Mailchimp or HubSpot account. A 409 error message includes the link to connect it. */
348
+ listProviderImportSources(params: ListProviderImportSourcesParams): Promise<MigmaResult<{
349
+ sources: ProviderImportSource[];
350
+ }>>;
351
+ /** Import provider sources as contacts (subscribed only by default). Poll GET /contacts/imports/{id} for counts. */
352
+ importFromProvider(params: ImportFromProviderParams, options?: CallOptions): Promise<MigmaResult<ProviderImportStarted>>;
225
353
  changeStatus(params: ChangeStatusParams, options?: CallOptions): Promise<MigmaResult<{
226
354
  success: boolean;
227
355
  }>>;
@@ -272,59 +400,6 @@ declare class Tags {
272
400
  remove(id: string, projectId: string): Promise<MigmaResult<DeleteResponse>>;
273
401
  }
274
402
 
275
- interface SegmentFieldFilter {
276
- key: string;
277
- /** Exact match (is/is_not) or pattern match (starts_with/ends_with/contains/not_contains,
278
- * compiled to anchored case-insensitive regex). Pattern modes keep a value group
279
- * like "email ends_with .vc" accurate as new contacts arrive. */
280
- mode?: 'is' | 'is_not' | 'starts_with' | 'ends_with' | 'contains' | 'not_contains';
281
- values: string[];
282
- }
283
- interface SegmentActivityFilter {
284
- action: 'sent' | 'opened' | 'clicked';
285
- channel?: 'email';
286
- mode: 'within' | 'before' | 'never' | 'between';
287
- unit?: 'hours' | 'days';
288
- amount?: number;
289
- from?: string | Date;
290
- to?: string | Date;
291
- campaignId?: string;
292
- }
293
- interface SegmentFilters {
294
- tags?: string[];
295
- excludeTags?: string[];
296
- status?: 'subscribed' | 'unsubscribed' | 'non-subscribed' | 'bounced';
297
- validationStatus?: 'valid' | 'invalid' | 'risky' | 'unknown';
298
- customFields?: Record<string, string[]>;
299
- fields?: SegmentFieldFilter[];
300
- activity?: SegmentActivityFilter[];
301
- }
302
- interface Segment {
303
- id: string;
304
- name: string;
305
- description: string;
306
- filters: SegmentFilters;
307
- count: number;
308
- createdAt: string;
309
- updatedAt: string;
310
- }
311
- interface CreateSegmentParams {
312
- name: string;
313
- description?: string;
314
- filters?: SegmentFilters;
315
- projectId: string;
316
- }
317
- interface UpdateSegmentParams {
318
- name?: string;
319
- description?: string;
320
- filters?: SegmentFilters;
321
- projectId: string;
322
- }
323
- interface ListSegmentsResponse {
324
- data: Segment[];
325
- count: number;
326
- }
327
-
328
403
  declare class Segments {
329
404
  private readonly client;
330
405
  constructor(client: MigmaClient);
@@ -472,6 +547,38 @@ declare class Sending {
472
547
  getBatchStatus(batchId: string): Promise<MigmaResult<BatchStatus>>;
473
548
  }
474
549
 
550
+ interface ConnectedToolScope {
551
+ projectId: string;
552
+ serverId: string;
553
+ toolName: string;
554
+ }
555
+ interface ListConnectedToolsParams {
556
+ projectId: string;
557
+ search?: string;
558
+ offset?: number;
559
+ limit?: number;
560
+ }
561
+ interface ConnectedToolSummary {
562
+ name: string;
563
+ serverId: string;
564
+ description: string;
565
+ requiresApproval: boolean;
566
+ annotations?: Record<string, unknown>;
567
+ }
568
+ interface ConnectedToolSchema extends ConnectedToolSummary {
569
+ inputSchema: Record<string, unknown>;
570
+ }
571
+ interface ListConnectedToolsResponse {
572
+ tools: ConnectedToolSummary[];
573
+ total: number;
574
+ nextOffset: number | null;
575
+ unreachableServers: string[];
576
+ authRequired: Array<{
577
+ serverId: string;
578
+ authUrl: string;
579
+ }>;
580
+ }
581
+
475
582
  interface Project {
476
583
  _id: string;
477
584
  name: string;
@@ -620,6 +727,12 @@ declare class Projects {
620
727
  references(projectId: string): Promise<MigmaResult<ProjectReferencesResponse>>;
621
728
  retryImport(projectId: string): Promise<MigmaResult<RetryImportResponse>>;
622
729
  fieldCatalog(projectId: string, params?: FieldCatalogParams): Promise<MigmaResult<FieldCatalogResponse>>;
730
+ listConnectedTools(params: ListConnectedToolsParams): Promise<MigmaResult<ListConnectedToolsResponse>>;
731
+ getConnectedTool(params: ConnectedToolScope): Promise<MigmaResult<ConnectedToolSchema>>;
732
+ /** Never automatically replay external writes; provider outcome can be unknown. */
733
+ callConnectedTool(params: ConnectedToolScope & {
734
+ parameters: Record<string, unknown>;
735
+ }): Promise<MigmaResult<unknown>>;
623
736
  /**
624
737
  * Import a project and wait for completion.
625
738
  * Polls getImportStatus until status is 'active' or 'error'.
@@ -773,6 +886,21 @@ interface EditEmailParams {
773
886
  prompt: string;
774
887
  label?: string;
775
888
  }
889
+ interface EmailEditOperation {
890
+ editId: string;
891
+ emailId: string;
892
+ conversationId: string;
893
+ status: 'pending' | 'processing' | 'completed' | 'failed';
894
+ stage: string;
895
+ createdAt: string;
896
+ updatedAt: string;
897
+ pollAfterMs: number;
898
+ error?: string;
899
+ /** Inspect the saved email before starting another edit after a failure. */
900
+ changesMayHaveBeenSaved?: boolean;
901
+ /** Current saved email, included by getEditStatus after completion. */
902
+ result?: Email;
903
+ }
776
904
  interface EmailMetricsSummary {
777
905
  totalEmails: number;
778
906
  delivered: number;
@@ -875,8 +1003,12 @@ declare class Emails {
875
1003
  getGenerationStatus(conversationId: string): Promise<MigmaResult<EmailGenerationStatus>>;
876
1004
  /** Fetch one generated email by email id */
877
1005
  get(emailId: string): Promise<MigmaResult<Email>>;
878
- /** Prompt Migma to edit one generated email */
1006
+ /** Synchronous edit. No automatic retries; use startEdit for long edits. */
879
1007
  edit(emailId: string, params: EditEmailParams): Promise<MigmaResult<Email>>;
1008
+ /** Queue an edit immediately. Retain an explicit key to recover uncertain submissions. */
1009
+ startEdit(emailId: string, params: EditEmailParams, options?: CallOptions): Promise<MigmaResult<EmailEditOperation>>;
1010
+ /** Poll the exact edit; a completed conversation may belong to an earlier turn. */
1011
+ getEditStatus(emailId: string, editId: string): Promise<MigmaResult<EmailEditOperation>>;
880
1012
  /**
881
1013
  * Generate an email and wait for completion.
882
1014
  * Polls getGenerationStatus until status is 'completed' or 'failed'.
@@ -1182,6 +1314,8 @@ interface Domain {
1182
1314
  status: string;
1183
1315
  isVerified?: boolean;
1184
1316
  dnsRecords?: DnsRecord[];
1317
+ /** Set while a custom domain cannot send yet: a Migma page that starts one-click DNS setup. */
1318
+ connectUrl?: string;
1185
1319
  trackingSettings?: {
1186
1320
  openTracking?: boolean;
1187
1321
  clickTracking?: boolean;
@@ -1386,16 +1520,20 @@ interface CreditStatus {
1386
1520
  type UpgradePlan = 'basic' | 'premium' | 'business' | 'basic_annual' | 'premium_annual' | 'business_annual';
1387
1521
  interface UpgradeLinkParams {
1388
1522
  /**
1389
- * Target plan for Stripe Checkout. Omit to get a billing portal link
1390
- * (existing Stripe customers only).
1523
+ * User-chosen plan for new subscription checkout. Omit for an existing
1524
+ * Stripe customer's billing portal. Passing plan for an active subscription
1525
+ * can change it and charge immediately; requires explicit charge approval.
1391
1526
  */
1392
1527
  plan?: UpgradePlan;
1393
1528
  }
1394
1529
  interface UpgradeLink {
1395
- /** URL the account owner opens in a browser to pay or manage billing. */
1530
+ /** Checkout, invoice, confirmation, or portal URL; not proof of payment. */
1396
1531
  url: string;
1532
+ /** checkout includes an existing plan-change result; portal is the billing portal. */
1397
1533
  kind: 'checkout' | 'portal';
1534
+ /** Present when a new Stripe Checkout session was created. */
1398
1535
  sessionId?: string;
1536
+ /** Migma checkout order id or Stripe invoice id for an existing plan change. */
1399
1537
  orderId?: string;
1400
1538
  }
1401
1539
 
@@ -1405,8 +1543,10 @@ declare class Billing {
1405
1543
  /** Plan and remaining credits for the API key owner. */
1406
1544
  credits(): Promise<MigmaResult<CreditStatus>>;
1407
1545
  /**
1408
- * Mint a Stripe link the account owner opens in a browser to upgrade or
1409
- * manage the subscription. Nothing is charged by this call itself.
1546
+ * Create checkout for a user-chosen new plan, or omit plan for the existing
1547
+ * customer's billing portal. Passing plan for an active subscription can
1548
+ * change it and charge prorated payment immediately; obtain charge approval.
1549
+ * The returned URL alone does not confirm payment. Do not retry unknown writes.
1410
1550
  */
1411
1551
  upgradeLink(params?: UpgradeLinkParams): Promise<MigmaResult<UpgradeLink>>;
1412
1552
  }
@@ -1512,6 +1652,13 @@ interface KnowledgeBaseEntry {
1512
1652
  thumbnailUrl?: string;
1513
1653
  screenshotUrl?: string;
1514
1654
  referenceOrigin?: ReferenceOrigin;
1655
+ sourceFileName?: string;
1656
+ /** Preparation runs after save; poll list() for completion. Retry failures by updating the original content. */
1657
+ conversion?: {
1658
+ status: 'pending' | 'complete' | 'failed';
1659
+ revision: string;
1660
+ error?: string;
1661
+ };
1515
1662
  }
1516
1663
  interface KnowledgeBaseListResponse {
1517
1664
  entries: KnowledgeBaseEntry[];
@@ -1520,6 +1667,8 @@ interface KnowledgeBaseListResponse {
1520
1667
  interface AddKnowledgeBaseParams {
1521
1668
  title: string;
1522
1669
  content: string;
1670
+ /** Original upload name, including .html, .eml, or .mjml; at most 255 characters. */
1671
+ sourceFileName?: string;
1523
1672
  /** Set to mark the entry as a design reference generation should match. */
1524
1673
  referenceOrigin?: ReferenceOrigin;
1525
1674
  previewHtml?: string;
@@ -1529,6 +1678,8 @@ interface AddKnowledgeBaseParams {
1529
1678
  interface UpdateKnowledgeBaseParams {
1530
1679
  title?: string;
1531
1680
  content?: string;
1681
+ /** Empty string clears the previous upload name. */
1682
+ sourceFileName?: string;
1532
1683
  }
1533
1684
 
1534
1685
  declare class KnowledgeBase {
@@ -1592,6 +1743,8 @@ interface Campaign {
1592
1743
  replyTo?: string | null;
1593
1744
  recipientType: 'audience' | 'tag';
1594
1745
  recipientId: string;
1746
+ /** Present when the campaign targets more than one segment or list. */
1747
+ recipientIds?: string[];
1595
1748
  topicId?: string | null;
1596
1749
  estimatedRecipients?: number | null;
1597
1750
  providerType: string;
@@ -1599,6 +1752,8 @@ interface Campaign {
1599
1752
  status: CampaignStatus;
1600
1753
  scheduledAt?: string | null;
1601
1754
  scheduledTimezone?: string | null;
1755
+ /** True when the scheduled clock time is used in each contact's own time zone. */
1756
+ localTimeDelivery?: boolean;
1602
1757
  batchId?: string | null;
1603
1758
  sentAt?: string | null;
1604
1759
  completedAt?: string | null;
@@ -1622,6 +1777,8 @@ interface CreateCampaignParams {
1622
1777
  replyTo?: string;
1623
1778
  recipientType: 'audience' | 'tag';
1624
1779
  recipientId: string;
1780
+ /** Full list of segment or list IDs of the same type. When set, this is the selection; recipientId is stored as the first id. Unique people receive one email. Max 20. */
1781
+ recipientIds?: string[];
1625
1782
  topicId?: string;
1626
1783
  providerType?: 'ses' | 'resend' | 'sendgrid' | 'mailgun' | 'migma';
1627
1784
  variables?: Record<string, unknown>;
@@ -1640,6 +1797,13 @@ interface ListCampaignsResponse {
1640
1797
  interface ScheduleCampaignParams {
1641
1798
  scheduledAt: string;
1642
1799
  scheduledTimezone?: string;
1800
+ /**
1801
+ * Send at the clock time of `scheduledAt` in `scheduledTimezone`, in each contact's own time zone (by country).
1802
+ * Requires `scheduledTimezone`. Contacts without a country get it at `scheduledAt`; where that time has passed,
1803
+ * the same time the next day. Not available with A/B tests or batch sending. Omit to keep the campaign's current
1804
+ * setting; `false` turns it off.
1805
+ */
1806
+ localTimeDelivery?: boolean;
1643
1807
  }
1644
1808
  /**
1645
1809
  * Aggregated engagement metrics for a campaign.
@@ -1816,4 +1980,4 @@ declare class Migma {
1816
1980
  constructor(apiKey: string, config?: MigmaConfig);
1817
1981
  }
1818
1982
 
1819
- export { type AddCustomDnsRecordParams, type AddImageParams, type AddKnowledgeBaseParams, type AnalyzeDeliverabilityParams, type AnalyzeLinksParams, type ApiResponse, type BatchDeleteContactsParams, type BatchDeleteResponse, type BatchStatus, type BrandGuidelinesParams, type BrandGuidelinesResponse, type BrandImageStyle, type BulkImportAsyncResponse, type BulkImportContactItem, type BulkImportJobStatus, type BulkImportParams, type BulkImportResponse, type BulkImportSyncResponse, type Campaign, type CampaignLog, type CampaignLogsParams, type CampaignLogsResponse, type CampaignStats, type CampaignStatus, type ChangeStatusParams, type CheckCompatibilityParams, type CheckSpellingParams, type CheckedLink, type ClientConfig, type CompatibilityResponse, type Contact, type ContactStatus, type CreateCampaignParams, type CreateContactParams, type CreateDomainParams, type CreateManagedDomainParams, type CreatePreviewParams, type CreatePreviewResponse, type CreateSegmentParams, type CreateTagParams, type CreateTopicParams, type CreateWebhookParams, type CreateWebhookResponse, type CreditStatus, type CustomDnsRecord, type CustomDnsRecordList, type CustomDnsRecordType, type DeleteResponse, type DeliverabilityResponse, type DesignReferenceItem, type DeviceCategoriesResponse, type DnsRecord, type Domain, type DomainAvailability, type DomainDeleteResponse, type DomainPurchaseCheckout, type DomainPurchaseParams, type DomainPurchaseQuote, type DomainPurchaseSearchParams, type DomainRegistration, type DomainRegistrationStatus, type DomainStream, type DomainVerificationResult, type EditEmailParams, type Email, type EmailFavorite, type EmailGenerationResult, type EmailGenerationStatus, type EmailImage, type EmailLogsParams, type EmailLogsResponse, type EmailMetrics, type EmailMetricsCountry, type EmailMetricsSummary, type EmailMetricsTimePoint, type EmailSendLog, type ExportFile, type ExportFormat, type ExportFormatsResponse, type ExportResult, type ExportStatusResponse, type FieldCatalogEntry, type FieldCatalogEntryType, type FieldCatalogParams, type FieldCatalogResponse, type GenerateEmailParams, type GenerateEmailResponse, type GeneratedEmail, type GetDevicePreviewResponse, type GetPreviewResponse, type GetPreviewStatusResponse, type GetSupportedDevicesResponse, type HubspotExportParams, type ImportHtmlEmailFile, type ImportHtmlEmailParams, type ImportProjectParams, type ImportProjectResponse, type ImportStatusResponse, type KnowledgeBaseEntry, type KnowledgeBaseListResponse, type LinkAnalysisResponse, type ListCampaignsParams, type ListCampaignsResponse, type ListContactsParams, type ListContactsResponse, type ListEmailsEmail, type ListEmailsParams, type ListEmailsResponse, type ListProjectsParams, type ListProjectsResponse, type ListSegmentsResponse, type ListTagsParams, type ListTagsResponse, type ListTopicsParams, type ListTopicsResponse, type ListWebhooksResponse, type ListWorkspacesResponse, type LogosResponse, type MessageResponse, Migma, MigmaClient, type MigmaConfig, MigmaError, MigmaErrorCode, type MigmaResult, type PollingOptions, type PreviewDevice, type PreviewDeviceCategory, type PreviewDeviceStatus, type PreviewMetadata, type PreviewStatus, type Project, type ProjectImage, type ProjectReferencesResponse, type ProviderType, type ProvisionStreamParams, type RecipientType, type ReferenceOrigin, type RetryImportResponse, type ScheduleCampaignParams, type Segment, type SegmentActivityFilter, type SegmentFieldFilter, type SegmentFilters, type SendEmailParams, type SendEmailResponse, type SendTestEmailParams, type SendTestEmailResponse, type SendingMetrics, type SendingMetricsCounts, type SendingMetricsHistoryEntry, type SendingMetricsParams, type SendingMetricsToday, type SetupDomainParams, type SetupDomainResponse, type SpellingResponse, type SupportedDevice, type Tag, type Topic, type TopicSubscriptionParams, type TopicSubscriptionResponse, type UpdateContactParams, type UpdateDomainParams, type UpdateImageParams, type UpdateKnowledgeBaseParams, type UpdateLogosParams, type UpdateSegmentParams, type UpdateTagParams, type UpdateTopicParams, type UpdateWebhookParams, type UpgradeLink, type UpgradeLinkParams, type UpgradePlan, type ValidateAllParams, type ValidateAllResponse, type Webhook, type WebhookDeliveriesResponse, type WebhookDelivery, type WebhookDetail, type WebhookEvent, type WebhookEventType, type WebhookEventsResponse, type WebhookTestResult, type Workspace, poll };
1983
+ export { type AddCustomDnsRecordParams, type AddImageParams, type AddKnowledgeBaseParams, type AnalyzeDeliverabilityParams, type AnalyzeLinksParams, type ApiResponse, type BatchDeleteContactsParams, type BatchDeleteResponse, type BatchStatus, type BrandGuidelinesParams, type BrandGuidelinesResponse, type BrandImageStyle, type BulkImportAsyncResponse, type BulkImportContactItem, type BulkImportJobStatus, type BulkImportParams, type BulkImportResponse, type BulkImportSyncResponse, type Campaign, type CampaignLog, type CampaignLogsParams, type CampaignLogsResponse, type CampaignStats, type CampaignStatus, type ChangeStatusParams, type CheckCompatibilityParams, type CheckSpellingParams, type CheckedLink, type ClientConfig, type CompatibilityResponse, type ConnectedToolSchema, type ConnectedToolScope, type ConnectedToolSummary, type Contact, type ContactExportStatus, type ContactImportProvider, type ContactStatus, type CreateCampaignParams, type CreateContactExportParams, type CreateContactParams, type CreateDomainParams, type CreateManagedDomainParams, type CreatePreviewParams, type CreatePreviewResponse, type CreateSegmentParams, type CreateTagParams, type CreateTopicParams, type CreateWebhookParams, type CreateWebhookResponse, type CreditStatus, type CustomDnsRecord, type CustomDnsRecordList, type CustomDnsRecordType, type DeleteResponse, type DeliverabilityResponse, type DesignReferenceItem, type DeviceCategoriesResponse, type DnsRecord, type Domain, type DomainAvailability, type DomainDeleteResponse, type DomainPurchaseCheckout, type DomainPurchaseParams, type DomainPurchaseQuote, type DomainPurchaseSearchParams, type DomainRegistration, type DomainRegistrationStatus, type DomainStream, type DomainVerificationResult, type EditEmailParams, type Email, type EmailEditOperation, type EmailFavorite, type EmailGenerationResult, type EmailGenerationStatus, type EmailImage, type EmailLogsParams, type EmailLogsResponse, type EmailMetrics, type EmailMetricsCountry, type EmailMetricsSummary, type EmailMetricsTimePoint, type EmailSendLog, type ExportFile, type ExportFormat, type ExportFormatsResponse, type ExportResult, type ExportStatusResponse, type FieldCatalogEntry, type FieldCatalogEntryType, type FieldCatalogParams, type FieldCatalogResponse, type GenerateEmailParams, type GenerateEmailResponse, type GeneratedEmail, type GetDevicePreviewResponse, type GetPreviewResponse, type GetPreviewStatusResponse, type GetSupportedDevicesResponse, type HubspotExportParams, type ImportFromProviderParams, type ImportHtmlEmailFile, type ImportHtmlEmailParams, type ImportProjectParams, type ImportProjectResponse, type ImportStatusResponse, type KnowledgeBaseEntry, type KnowledgeBaseListResponse, type LinkAnalysisResponse, type ListCampaignsParams, type ListCampaignsResponse, type ListConnectedToolsParams, type ListConnectedToolsResponse, type ListContactsParams, type ListContactsResponse, type ListEmailsEmail, type ListEmailsParams, type ListEmailsResponse, type ListProjectsParams, type ListProjectsResponse, type ListProviderImportSourcesParams, type ListSegmentsResponse, type ListTagsParams, type ListTagsResponse, type ListTopicsParams, type ListTopicsResponse, type ListWebhooksResponse, type ListWorkspacesResponse, type LogosResponse, type MessageResponse, Migma, MigmaClient, type MigmaConfig, MigmaError, MigmaErrorCode, type MigmaResult, type PollingOptions, type PreviewDevice, type PreviewDeviceCategory, type PreviewDeviceStatus, type PreviewMetadata, type PreviewStatus, type Project, type ProjectImage, type ProjectReferencesResponse, type ProviderImportSource, type ProviderImportStarted, type ProviderType, type ProvisionStreamParams, type RecipientType, type ReferenceOrigin, type RetryImportResponse, type ScheduleCampaignParams, type Segment, type SegmentActivityFilter, type SegmentFieldFilter, type SegmentFilters, type SendEmailParams, type SendEmailResponse, type SendTestEmailParams, type SendTestEmailResponse, type SendingMetrics, type SendingMetricsCounts, type SendingMetricsHistoryEntry, type SendingMetricsParams, type SendingMetricsToday, type SetupDomainParams, type SetupDomainResponse, type SpellingResponse, type SupportedDevice, type Tag, type Topic, type TopicSubscriptionParams, type TopicSubscriptionResponse, type UpdateContactParams, type UpdateDomainParams, type UpdateImageParams, type UpdateKnowledgeBaseParams, type UpdateLogosParams, type UpdateSegmentParams, type UpdateTagParams, type UpdateTopicParams, type UpdateWebhookParams, type UpgradeLink, type UpgradeLinkParams, type UpgradePlan, type ValidateAllParams, type ValidateAllResponse, type Webhook, type WebhookDeliveriesResponse, type WebhookDelivery, type WebhookDetail, type WebhookEvent, type WebhookEventType, type WebhookEventsResponse, type WebhookTestResult, type Workspace, poll };