@messagebird/sdk 0.7.6 → 0.8.1
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 +591 -45
- package/dist/index.mjs +231 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -269,6 +269,194 @@ interface PaginatedPromise<T> extends Promise<CursorPage<T>>, AsyncIterable<T> {
|
|
|
269
269
|
}
|
|
270
270
|
//#endregion
|
|
271
271
|
//#region src/generated/types.gen.d.ts
|
|
272
|
+
/**
|
|
273
|
+
* Payload of the whatsapp.sent event.
|
|
274
|
+
*/
|
|
275
|
+
type EventWhatsAppSentData = EventWhatsAppBase;
|
|
276
|
+
/**
|
|
277
|
+
* Structured key/value label attached to a message. Surfaces in list filters, the event log, and webhook payloads. Use tags for low-cardinality filtering dimensions (category, experiment ID, template ID). For arbitrary per-send context that does not need to be filterable, use `metadata`.
|
|
278
|
+
* Tag count and per-tag size are capped to keep per-send tag payloads small — see the send request for the array maximum. Tag names are unique within a send; supplying the same name twice is rejected.
|
|
279
|
+
*
|
|
280
|
+
*/
|
|
281
|
+
type Tag = {
|
|
282
|
+
/**
|
|
283
|
+
* Tag name. ASCII letters, digits, underscore, and hyphen only. Case-sensitive. Maximum 32 characters.
|
|
284
|
+
*
|
|
285
|
+
*/
|
|
286
|
+
name: string;
|
|
287
|
+
/**
|
|
288
|
+
* Tag value. ASCII letters, digits, underscore, and hyphen only. Case-sensitive. Maximum 64 characters.
|
|
289
|
+
*
|
|
290
|
+
*/
|
|
291
|
+
value: string;
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* Sender or recipient of a WhatsApp message — a phone number, a business-scoped user ID, or both.
|
|
295
|
+
*/
|
|
296
|
+
type WhatsAppAddress = {
|
|
297
|
+
/**
|
|
298
|
+
* Phone number in E.164 format, when known.
|
|
299
|
+
*/
|
|
300
|
+
phone_number?: string;
|
|
301
|
+
/**
|
|
302
|
+
* Business-scoped user ID — Meta's identifier for the WhatsApp user. Present only on the WhatsApp-user side of the message.
|
|
303
|
+
*
|
|
304
|
+
*/
|
|
305
|
+
bsuid?: string;
|
|
306
|
+
};
|
|
307
|
+
type WorkspaceId = string;
|
|
308
|
+
type WhatsAppMessageId = string;
|
|
309
|
+
/**
|
|
310
|
+
* Identity fields shared by every WhatsApp lifecycle event payload.
|
|
311
|
+
*/
|
|
312
|
+
type EventWhatsAppBase = {
|
|
313
|
+
/**
|
|
314
|
+
* ID of the WhatsApp message.
|
|
315
|
+
*/
|
|
316
|
+
whatsapp_id: WhatsAppMessageId;
|
|
317
|
+
/**
|
|
318
|
+
* ID of the workspace.
|
|
319
|
+
*/
|
|
320
|
+
workspace_id: WorkspaceId;
|
|
321
|
+
/**
|
|
322
|
+
* Whether the message was sent by the business (`outbound`) or received from the contact (`inbound`).
|
|
323
|
+
*/
|
|
324
|
+
direction: "outbound" | "inbound";
|
|
325
|
+
/**
|
|
326
|
+
* Sender of the message. On outbound messages, the business number it was sent from.
|
|
327
|
+
*/
|
|
328
|
+
from: WhatsAppAddress;
|
|
329
|
+
/**
|
|
330
|
+
* Recipient of the message. On outbound messages, the WhatsApp contact.
|
|
331
|
+
*/
|
|
332
|
+
to: WhatsAppAddress;
|
|
333
|
+
/**
|
|
334
|
+
* Tags provided on the send request, echoed on every event for the message. Null when the message carried no tags.
|
|
335
|
+
*
|
|
336
|
+
*/
|
|
337
|
+
tags: Array<Tag> | null;
|
|
338
|
+
/**
|
|
339
|
+
* The metadata object provided on the send request, echoed on every event for the message. Null when the message carried no metadata.
|
|
340
|
+
*
|
|
341
|
+
*/
|
|
342
|
+
metadata: {
|
|
343
|
+
[key: string]: unknown;
|
|
344
|
+
} | null;
|
|
345
|
+
};
|
|
346
|
+
/**
|
|
347
|
+
* Bird handed the message to Meta for delivery.
|
|
348
|
+
*/
|
|
349
|
+
type EventWhatsAppSent = {
|
|
350
|
+
/**
|
|
351
|
+
* Event type.
|
|
352
|
+
*/
|
|
353
|
+
type: "whatsapp.sent";
|
|
354
|
+
/**
|
|
355
|
+
* Time Bird handed the message to Meta for delivery.
|
|
356
|
+
*/
|
|
357
|
+
timestamp: string;
|
|
358
|
+
data: EventWhatsAppSentData;
|
|
359
|
+
};
|
|
360
|
+
/**
|
|
361
|
+
* Payload of the whatsapp.read event.
|
|
362
|
+
*/
|
|
363
|
+
type EventWhatsAppReadData = EventWhatsAppBase;
|
|
364
|
+
/**
|
|
365
|
+
* The recipient read the message.
|
|
366
|
+
*/
|
|
367
|
+
type EventWhatsAppRead = {
|
|
368
|
+
/**
|
|
369
|
+
* Event type.
|
|
370
|
+
*/
|
|
371
|
+
type: "whatsapp.read";
|
|
372
|
+
/**
|
|
373
|
+
* Time the recipient read the message.
|
|
374
|
+
*/
|
|
375
|
+
timestamp: string;
|
|
376
|
+
data: EventWhatsAppReadData;
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* Bird-stable failure reason, uniform whether the failure happened internally or was reported by the WhatsApp network. `insufficient_balance` — the workspace could not afford the send. `price_not_found` — no price was configured for this destination/template combination. `internal_error` — an unexpected Bird-side failure. `undeliverable` — the recipient could not be reached (e.g. not on WhatsApp, number invalid). `service_window_expired` — the 24-hour customer care window has closed and a free-form message cannot be sent; send a template instead. `rate_limited` — the send was throttled.
|
|
380
|
+
*
|
|
381
|
+
*/
|
|
382
|
+
type WhatsAppErrorCode = string;
|
|
383
|
+
/**
|
|
384
|
+
* Failure detail for a message that could not be delivered. Null when there is no failure.
|
|
385
|
+
*/
|
|
386
|
+
type WhatsAppError = {
|
|
387
|
+
code: WhatsAppErrorCode;
|
|
388
|
+
/**
|
|
389
|
+
* Human-readable explanation of the failure.
|
|
390
|
+
*/
|
|
391
|
+
readonly description: string;
|
|
392
|
+
/**
|
|
393
|
+
* Raw error code from the WhatsApp Cloud API, when available, for low-level debugging.
|
|
394
|
+
*/
|
|
395
|
+
readonly meta_error_code?: string | null;
|
|
396
|
+
/**
|
|
397
|
+
* When the failure occurred.
|
|
398
|
+
*/
|
|
399
|
+
readonly occurred_at: string;
|
|
400
|
+
} | null;
|
|
401
|
+
/**
|
|
402
|
+
* Payload of the whatsapp.failed event.
|
|
403
|
+
*/
|
|
404
|
+
type EventWhatsAppFailedData = EventWhatsAppBase & {
|
|
405
|
+
/**
|
|
406
|
+
* Why the message terminally failed.
|
|
407
|
+
*/
|
|
408
|
+
error: WhatsAppError;
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* The message terminally failed and will not be delivered.
|
|
412
|
+
*/
|
|
413
|
+
type EventWhatsAppFailed = {
|
|
414
|
+
/**
|
|
415
|
+
* Event type.
|
|
416
|
+
*/
|
|
417
|
+
type: "whatsapp.failed";
|
|
418
|
+
/**
|
|
419
|
+
* Time the failure was recorded.
|
|
420
|
+
*/
|
|
421
|
+
timestamp: string;
|
|
422
|
+
data: EventWhatsAppFailedData;
|
|
423
|
+
};
|
|
424
|
+
/**
|
|
425
|
+
* Payload of the whatsapp.delivered event.
|
|
426
|
+
*/
|
|
427
|
+
type EventWhatsAppDeliveredData = EventWhatsAppBase;
|
|
428
|
+
/**
|
|
429
|
+
* The message was delivered to the recipient's device.
|
|
430
|
+
*/
|
|
431
|
+
type EventWhatsAppDelivered = {
|
|
432
|
+
/**
|
|
433
|
+
* Event type.
|
|
434
|
+
*/
|
|
435
|
+
type: "whatsapp.delivered";
|
|
436
|
+
/**
|
|
437
|
+
* Time the message was delivered to the recipient's device.
|
|
438
|
+
*/
|
|
439
|
+
timestamp: string;
|
|
440
|
+
data: EventWhatsAppDeliveredData;
|
|
441
|
+
};
|
|
442
|
+
/**
|
|
443
|
+
* Payload of the whatsapp.accepted event.
|
|
444
|
+
*/
|
|
445
|
+
type EventWhatsAppAcceptedData = EventWhatsAppBase;
|
|
446
|
+
/**
|
|
447
|
+
* Bird accepted and charged the send request.
|
|
448
|
+
*/
|
|
449
|
+
type EventWhatsAppAccepted = {
|
|
450
|
+
/**
|
|
451
|
+
* Event type.
|
|
452
|
+
*/
|
|
453
|
+
type: "whatsapp.accepted";
|
|
454
|
+
/**
|
|
455
|
+
* Time Bird accepted and charged the send request.
|
|
456
|
+
*/
|
|
457
|
+
timestamp: string;
|
|
458
|
+
data: EventWhatsAppAcceptedData;
|
|
459
|
+
};
|
|
272
460
|
/**
|
|
273
461
|
* Payload of the sms.undelivered event.
|
|
274
462
|
*/
|
|
@@ -301,24 +489,6 @@ type SmsError = {
|
|
|
301
489
|
*/
|
|
302
490
|
occurred_at: string;
|
|
303
491
|
} | null;
|
|
304
|
-
/**
|
|
305
|
-
* Structured key/value label attached to a message. Surfaces in list filters, the event log, and webhook payloads. Use tags for low-cardinality filtering dimensions (category, experiment ID, template ID). For arbitrary per-send context that does not need to be filterable, use `metadata`.
|
|
306
|
-
* Tag count and per-tag size are capped to keep per-send tag payloads small — see the send request for the array maximum. Tag names are unique within a send; supplying the same name twice is rejected.
|
|
307
|
-
*
|
|
308
|
-
*/
|
|
309
|
-
type Tag = {
|
|
310
|
-
/**
|
|
311
|
-
* Tag name. ASCII letters, digits, underscore, and hyphen only. Case-sensitive. Maximum 32 characters.
|
|
312
|
-
*
|
|
313
|
-
*/
|
|
314
|
-
name: string;
|
|
315
|
-
/**
|
|
316
|
-
* Tag value. ASCII letters, digits, underscore, and hyphen only. Case-sensitive. Maximum 64 characters.
|
|
317
|
-
*
|
|
318
|
-
*/
|
|
319
|
-
value: string;
|
|
320
|
-
};
|
|
321
|
-
type WorkspaceId = string;
|
|
322
492
|
type SmsMessageId = string;
|
|
323
493
|
/**
|
|
324
494
|
* Identity fields shared by every SMS lifecycle event payload.
|
|
@@ -1388,7 +1558,17 @@ type WebhookEvent = ({
|
|
|
1388
1558
|
type: "sms.sent";
|
|
1389
1559
|
} & EventSmsSent) | ({
|
|
1390
1560
|
type: "sms.undelivered";
|
|
1391
|
-
} & EventSmsUndelivered)
|
|
1561
|
+
} & EventSmsUndelivered) | ({
|
|
1562
|
+
type: "whatsapp.accepted";
|
|
1563
|
+
} & EventWhatsAppAccepted) | ({
|
|
1564
|
+
type: "whatsapp.delivered";
|
|
1565
|
+
} & EventWhatsAppDelivered) | ({
|
|
1566
|
+
type: "whatsapp.failed";
|
|
1567
|
+
} & EventWhatsAppFailed) | ({
|
|
1568
|
+
type: "whatsapp.read";
|
|
1569
|
+
} & EventWhatsAppRead) | ({
|
|
1570
|
+
type: "whatsapp.sent";
|
|
1571
|
+
} & EventWhatsAppSent);
|
|
1392
1572
|
type Timestamps = {
|
|
1393
1573
|
readonly created_at: string;
|
|
1394
1574
|
readonly updated_at: string;
|
|
@@ -1406,6 +1586,283 @@ type EmailAddress = {
|
|
|
1406
1586
|
*/
|
|
1407
1587
|
name?: string;
|
|
1408
1588
|
};
|
|
1589
|
+
/**
|
|
1590
|
+
* Partial update. `settings` changes apply immediately. Changes to `return_path`, `tracking`, or `dkim` on a verified capability are staged: the current configuration keeps serving until the new one's DNS records verify, then the change is promoted automatically and the old records are marked `deprecated`. The staged value is visible under `capabilities.*.pending` and can be replaced by submitting another change.
|
|
1591
|
+
*
|
|
1592
|
+
*/
|
|
1593
|
+
type DomainUpdate = {
|
|
1594
|
+
settings?: DomainSettings;
|
|
1595
|
+
return_path?: DomainReturnPathConfig & unknown;
|
|
1596
|
+
/**
|
|
1597
|
+
* Set or change the tracking name part, or remove tracking by passing null. Removal requires `click_tracking` and `open_tracking` to be disabled first, and returns `409` otherwise. After removal, links in previously sent email keep resolving while the tracking records are reported as `deprecated`.
|
|
1598
|
+
*
|
|
1599
|
+
*/
|
|
1600
|
+
tracking?: DomainTrackingConfig | null;
|
|
1601
|
+
dkim?: DomainDkimConfig & unknown;
|
|
1602
|
+
inbound?: DomainInboundConfig & unknown;
|
|
1603
|
+
};
|
|
1604
|
+
/**
|
|
1605
|
+
* Inbound (receiving) configuration. Enable inbound to receive email addressed to this domain: Bird returns MX records to publish, and once they verify, mail to any local-part at this domain is delivered as an inbound message and the `email.received` webhook fires. The capability is enabled on the domain's own registration, so use a dedicated subdomain (e.g. `inbound.acme.com`), never your apex — apex MX would capture your corporate mail.
|
|
1606
|
+
*
|
|
1607
|
+
*/
|
|
1608
|
+
type DomainInboundConfig = {
|
|
1609
|
+
/**
|
|
1610
|
+
* Set `true` to enable receiving on this domain, `false` to disable it. Disabling tears receiving down and removes the MX records from `dns_records`; this is immediate in the normal case, and if a step needs retrying the capability clears as soon as teardown finishes.
|
|
1611
|
+
*
|
|
1612
|
+
*/
|
|
1613
|
+
enabled: boolean;
|
|
1614
|
+
};
|
|
1615
|
+
/**
|
|
1616
|
+
* DKIM signing configuration.
|
|
1617
|
+
*/
|
|
1618
|
+
type DomainDkimConfig = {
|
|
1619
|
+
/**
|
|
1620
|
+
* How the DKIM public key is published in your DNS.
|
|
1621
|
+
* - `txt` — you publish the DKIM public key as a TXT record. Key
|
|
1622
|
+
* rotation requires updating the record.
|
|
1623
|
+
* - `delegated` — preview, currently unavailable; supplying it returns
|
|
1624
|
+
* `422`. When available, you publish a single CNAME and Bird hosts
|
|
1625
|
+
* and rotates the key with no further DNS changes on your side.
|
|
1626
|
+
*
|
|
1627
|
+
*/
|
|
1628
|
+
mode?: "txt" | "delegated";
|
|
1629
|
+
};
|
|
1630
|
+
/**
|
|
1631
|
+
* Tracking domain configuration for branded open and click tracking URLs. Provide only the name part; Bird adds the sending domain automatically. Defaults to `links` when omitted at creation. Tracked links are served over HTTPS once the tracking record verifies.
|
|
1632
|
+
*
|
|
1633
|
+
*/
|
|
1634
|
+
type DomainTrackingConfig = {
|
|
1635
|
+
/**
|
|
1636
|
+
* Name part to use for branded open and click tracking URLs. For example, `links` on `mail.acme.com` becomes `links.mail.acme.com`.
|
|
1637
|
+
*
|
|
1638
|
+
*/
|
|
1639
|
+
name: string;
|
|
1640
|
+
};
|
|
1641
|
+
/**
|
|
1642
|
+
* Return-path (bounce) domain configuration. The return-path domain receives bounce and complaint notifications for mail sent from this domain and is what mailbox providers check for SPF. Provide only the name part; Bird adds the sending domain automatically.
|
|
1643
|
+
*
|
|
1644
|
+
*/
|
|
1645
|
+
type DomainReturnPathConfig = {
|
|
1646
|
+
/**
|
|
1647
|
+
* Name part to use for the return-path domain. For example, `send` on `mail.acme.com` becomes `send.mail.acme.com`. Defaults to `send` when omitted at creation.
|
|
1648
|
+
*
|
|
1649
|
+
*/
|
|
1650
|
+
name: string;
|
|
1651
|
+
};
|
|
1652
|
+
/**
|
|
1653
|
+
* Per-domain behavior toggles. Changes apply immediately to new sends.
|
|
1654
|
+
*
|
|
1655
|
+
*/
|
|
1656
|
+
type DomainSettings = {
|
|
1657
|
+
/**
|
|
1658
|
+
* Rewrite links in HTML email through your tracking domain to record clicks. You can enable this before your tracking domain has verified — it begins working once verification completes. A tracking domain must be configured; enabling it without one returns `409`.
|
|
1659
|
+
*
|
|
1660
|
+
*/
|
|
1661
|
+
click_tracking?: boolean;
|
|
1662
|
+
/**
|
|
1663
|
+
* Insert a tracking pixel in HTML email to record opens. You can enable this before your tracking domain has verified — it begins working once verification completes. A tracking domain must be configured; enabling it without one returns `409`.
|
|
1664
|
+
*
|
|
1665
|
+
*/
|
|
1666
|
+
open_tracking?: boolean;
|
|
1667
|
+
};
|
|
1668
|
+
type DomainCreate = {
|
|
1669
|
+
/**
|
|
1670
|
+
* The domain you will send from — the domain of your `from` addresses. Use a dedicated subdomain (e.g. `mail.acme.com`) rather than your registered domain so sending reputation stays separate from other services on the domain.
|
|
1671
|
+
*
|
|
1672
|
+
*/
|
|
1673
|
+
domain: string;
|
|
1674
|
+
return_path?: DomainReturnPathConfig;
|
|
1675
|
+
tracking?: DomainTrackingConfig;
|
|
1676
|
+
dkim?: DomainDkimConfig;
|
|
1677
|
+
settings?: DomainSettings;
|
|
1678
|
+
};
|
|
1679
|
+
type DnsRecord = {
|
|
1680
|
+
type: "TXT" | "CNAME" | "MX";
|
|
1681
|
+
/**
|
|
1682
|
+
* The record name — the part you enter in your DNS provider's "Name" or "Host" field, relative to the DNS zone the record belongs in (your registered domain). For a sending domain `mail.acme.com` the DKIM record name is `bird1._domainkey.mail`, entered in the `acme.com` zone. `@` for records at the zone apex.
|
|
1683
|
+
*
|
|
1684
|
+
*/
|
|
1685
|
+
name: string;
|
|
1686
|
+
/**
|
|
1687
|
+
* The fully qualified hostname for this record (e.g. `bird1._domainkey.mail.acme.com`).
|
|
1688
|
+
*
|
|
1689
|
+
*/
|
|
1690
|
+
host: string;
|
|
1691
|
+
value: string;
|
|
1692
|
+
/**
|
|
1693
|
+
* What this record is for.
|
|
1694
|
+
* - `dkim` — signs outbound mail and proves domain ownership. - `return_path` — return-path (bounce) CNAME for sending. - `tracking` — branded open/click tracking CNAME (optional). - `dmarc` — advisory DMARC policy record. - `inbound_mx` — MX record routing mail to Bird for receiving. Always
|
|
1695
|
+
* present wherever inbound is available, as a regional reference,
|
|
1696
|
+
* regardless of whether receiving is enabled; publishing it does not
|
|
1697
|
+
* enable receiving on its own — see `DomainUpdate.inbound`.
|
|
1698
|
+
*
|
|
1699
|
+
*/
|
|
1700
|
+
purpose: "dkim" | "return_path" | "tracking" | "inbound_mx" | "dmarc";
|
|
1701
|
+
/**
|
|
1702
|
+
* Lifecycle state of this record.
|
|
1703
|
+
* - `active` — the record backs the domain's current configuration. - `pending` — the record belongs to a staged configuration change;
|
|
1704
|
+
* publish it to complete the change.
|
|
1705
|
+
* - `deprecated` — the record belonged to a previous configuration.
|
|
1706
|
+
* Keep it in DNS until `safe_to_remove` is `true`; in-flight mail and
|
|
1707
|
+
* previously sent tracked links may still resolve through it.
|
|
1708
|
+
*
|
|
1709
|
+
*/
|
|
1710
|
+
readonly state: "active" | "pending" | "deprecated";
|
|
1711
|
+
/**
|
|
1712
|
+
* Whether this record can be skipped. Optional records enable extra functionality (e.g. tracking) but are not required for sending.
|
|
1713
|
+
*
|
|
1714
|
+
*/
|
|
1715
|
+
readonly optional: boolean;
|
|
1716
|
+
/**
|
|
1717
|
+
* Verification status of this record's most recent DNS check.
|
|
1718
|
+
* - `pending` — the record has not verified yet; publish it (or correct it)
|
|
1719
|
+
* and it will verify on the next check.
|
|
1720
|
+
* - `verified` — the most recent check matched the expected value. - `warning` — the record verified before and a recent check no longer
|
|
1721
|
+
* matched, but it is still within the grace period. Sending is not yet
|
|
1722
|
+
* affected; fix the record before the grace period ends to avoid it
|
|
1723
|
+
* being blocked.
|
|
1724
|
+
* - `failed` — the record verified before but later checks kept failing
|
|
1725
|
+
* past the grace period; the configuration has regressed and needs
|
|
1726
|
+
* attention.
|
|
1727
|
+
*
|
|
1728
|
+
*/
|
|
1729
|
+
readonly status: "pending" | "verified" | "warning" | "failed";
|
|
1730
|
+
/**
|
|
1731
|
+
* Human-readable detail for a failed check on this record — what was found in DNS and why it did not match. Null when the record is verified or not yet checked.
|
|
1732
|
+
*
|
|
1733
|
+
*/
|
|
1734
|
+
readonly error?: string | null;
|
|
1735
|
+
/**
|
|
1736
|
+
* Only set on `deprecated` records: `true` once the record is no longer referenced by in-flight mail or live tracked links and can be deleted from your DNS. Null on `active` and `pending` records.
|
|
1737
|
+
*
|
|
1738
|
+
*/
|
|
1739
|
+
readonly safe_to_remove?: boolean | null;
|
|
1740
|
+
};
|
|
1741
|
+
/**
|
|
1742
|
+
* A staged configuration change awaiting DNS verification. The currently active configuration keeps serving until the staged one verifies, at which point it is promoted automatically. Submitting another change for the same capability replaces the staged value.
|
|
1743
|
+
*
|
|
1744
|
+
*/
|
|
1745
|
+
type DomainCapabilityPending = {
|
|
1746
|
+
/**
|
|
1747
|
+
* Hostname the capability will use once the staged change verifies.
|
|
1748
|
+
*/
|
|
1749
|
+
readonly domain: string;
|
|
1750
|
+
/**
|
|
1751
|
+
* Verification status of the staged change. `pending` — waiting for the DNS records to be detected. `failed` — the records resolved with wrong values; correct them or submit a different change. `temporary_failure` — DNS lookup failed transiently and will be retried.
|
|
1752
|
+
*
|
|
1753
|
+
*/
|
|
1754
|
+
readonly status: "pending" | "failed" | "temporary_failure";
|
|
1755
|
+
};
|
|
1756
|
+
type DomainCapability = {
|
|
1757
|
+
/**
|
|
1758
|
+
* Capability verification status.
|
|
1759
|
+
* - `pending` — verification has not run, or is currently running. - `verified` — all DNS records for this capability resolved with the
|
|
1760
|
+
* expected values.
|
|
1761
|
+
* - `warning` — a record for this capability verified before and a recent
|
|
1762
|
+
* check no longer matches, but it is still within the grace period.
|
|
1763
|
+
* Sending is not yet affected; fix it before the grace period ends.
|
|
1764
|
+
* - `failed` — DNS records resolved but at least one value is wrong.
|
|
1765
|
+
* Update your DNS to recover.
|
|
1766
|
+
* - `temporary_failure` — DNS lookup failed transiently. Verification is
|
|
1767
|
+
* queued for retry; don't change DNS records yet.
|
|
1768
|
+
* - `not_configured` — the capability is not set up on this domain
|
|
1769
|
+
* (e.g. no tracking domain configured).
|
|
1770
|
+
*
|
|
1771
|
+
*/
|
|
1772
|
+
readonly status: "pending" | "verified" | "warning" | "failed" | "temporary_failure" | "not_configured";
|
|
1773
|
+
/**
|
|
1774
|
+
* Hostname this capability is configured with — the return-path domain, the tracking domain, or the domain where the DMARC policy was found. Null when not applicable or not configured.
|
|
1775
|
+
*
|
|
1776
|
+
*/
|
|
1777
|
+
readonly domain?: string | null;
|
|
1778
|
+
pending?: DomainCapabilityPending;
|
|
1779
|
+
/**
|
|
1780
|
+
* Machine-readable reason code for a failed capability status. Only set when `status` is `failed`. Use this to display a specific message to users rather than a generic failure message.
|
|
1781
|
+
* - `tracking_domain_in_use` — the link tracking subdomain is already claimed
|
|
1782
|
+
* by another organization.
|
|
1783
|
+
*
|
|
1784
|
+
*/
|
|
1785
|
+
readonly reason?: string | null;
|
|
1786
|
+
};
|
|
1787
|
+
type DomainCapabilities = {
|
|
1788
|
+
sending: DomainCapability & unknown;
|
|
1789
|
+
return_path: DomainCapability & unknown;
|
|
1790
|
+
dmarc: DomainCapability & unknown;
|
|
1791
|
+
tracking: DomainCapability & unknown;
|
|
1792
|
+
inbound?: DomainCapability & unknown;
|
|
1793
|
+
};
|
|
1794
|
+
/**
|
|
1795
|
+
* Active DKIM signing configuration for the domain.
|
|
1796
|
+
*/
|
|
1797
|
+
type DomainDkim = {
|
|
1798
|
+
/**
|
|
1799
|
+
* How the DKIM public key is published in your DNS. `txt` — you publish the key as a TXT record. `delegated` — you publish a single CNAME and Bird hosts and rotates the key.
|
|
1800
|
+
*
|
|
1801
|
+
*/
|
|
1802
|
+
readonly mode: "txt" | "delegated";
|
|
1803
|
+
/**
|
|
1804
|
+
* DKIM selector used to sign mail from this domain.
|
|
1805
|
+
*/
|
|
1806
|
+
readonly selector: string;
|
|
1807
|
+
/**
|
|
1808
|
+
* RSA key size in bits.
|
|
1809
|
+
*/
|
|
1810
|
+
readonly key_size: number;
|
|
1811
|
+
};
|
|
1812
|
+
type Domain = {
|
|
1813
|
+
readonly id: DomainId;
|
|
1814
|
+
readonly workspace_id: WorkspaceId;
|
|
1815
|
+
/**
|
|
1816
|
+
* The sending domain name. Set at creation and immutable.
|
|
1817
|
+
*/
|
|
1818
|
+
readonly domain: string;
|
|
1819
|
+
/**
|
|
1820
|
+
* The DNS provider hosting this domain's nameservers, so you know which provider's dashboard to manage the required DNS records in. Returns "other" when the provider has not been detected or is not recognized.
|
|
1821
|
+
*
|
|
1822
|
+
*/
|
|
1823
|
+
readonly vendor: "other" | "cloudflare" | "route53" | "godaddy" | "namecheap" | "google" | "azure" | "digitalocean" | "squarespace";
|
|
1824
|
+
/**
|
|
1825
|
+
* Domain ownership verification, proven by the DKIM record. Readiness to send or track is reported separately per capability under `capabilities.*.status`.
|
|
1826
|
+
* - `pending` — the DKIM record has not been published yet. - `verified` — the DKIM record is in place; ownership is confirmed. - `failed` — a DKIM record exists but does not match the expected
|
|
1827
|
+
* value (for example a stale record from an earlier setup), or a
|
|
1828
|
+
* previously verified record was removed. Correct the record to
|
|
1829
|
+
* recover.
|
|
1830
|
+
* - `temporary_failure` — DNS resolution failed transiently (timeout,
|
|
1831
|
+
* unreachable nameserver). Verification is queued for retry on a 72h
|
|
1832
|
+
* cadence; customer should not edit DNS records before the retry runs.
|
|
1833
|
+
* - `rejected` — the domain was refused for policy reasons and cannot be
|
|
1834
|
+
* used for sending. Contact support if you believe this is an error.
|
|
1835
|
+
*
|
|
1836
|
+
*/
|
|
1837
|
+
readonly status: "pending" | "verified" | "failed" | "temporary_failure" | "rejected";
|
|
1838
|
+
settings: DomainSettings;
|
|
1839
|
+
readonly dkim: DomainDkim;
|
|
1840
|
+
capabilities: DomainCapabilities;
|
|
1841
|
+
/**
|
|
1842
|
+
* The domain's DNS records and their individual verification state, returned in full on both the list and single-domain responses. This is the complete set to publish across DKIM, return-path, DMARC, tracking, and inbound; records for a staged change carry `state: pending`. Inbound MX records are always included as a regional reference, even while receiving is off (`capabilities.inbound.status` is `not_configured`) — their presence alone does not mean receiving is enabled (see `DomainUpdate.inbound`).
|
|
1843
|
+
*
|
|
1844
|
+
*/
|
|
1845
|
+
readonly dns_records: Array<DnsRecord>;
|
|
1846
|
+
/**
|
|
1847
|
+
* When Bird last checked this domain's DNS records, whether or not the outcome changed. Updated on every verification — your manual refresh and the periodic automatic re-checks alike. Null if the domain has never been checked.
|
|
1848
|
+
*
|
|
1849
|
+
*/
|
|
1850
|
+
readonly last_checked_at?: string | null;
|
|
1851
|
+
/**
|
|
1852
|
+
* When the domain's ownership was confirmed — the moment `status` became `verified` via the DKIM record. Unchanged by later re-checks while it stays verified. Null if the domain has never been verified.
|
|
1853
|
+
*
|
|
1854
|
+
*/
|
|
1855
|
+
readonly verified_at?: string | null;
|
|
1856
|
+
/**
|
|
1857
|
+
* When the domain was added.
|
|
1858
|
+
*/
|
|
1859
|
+
readonly created_at: string;
|
|
1860
|
+
/**
|
|
1861
|
+
* When the domain's configuration was last changed (such as a settings or return-path change). Verification re-checks do not change this; see `last_checked_at` and `verified_at` for verification timing.
|
|
1862
|
+
*
|
|
1863
|
+
*/
|
|
1864
|
+
readonly updated_at: string;
|
|
1865
|
+
};
|
|
1409
1866
|
type WhatsAppTemplateList = {
|
|
1410
1867
|
/**
|
|
1411
1868
|
* The templates available to your workspace.
|
|
@@ -1508,29 +1965,6 @@ type WhatsAppEventList = {
|
|
|
1508
1965
|
*/
|
|
1509
1966
|
data: Array<WhatsAppEvent>;
|
|
1510
1967
|
};
|
|
1511
|
-
/**
|
|
1512
|
-
* Bird-stable failure reason, uniform whether the failure happened internally or was reported by the WhatsApp network. `insufficient_balance` — the workspace could not afford the send. `price_not_found` — no price was configured for this destination/template combination. `internal_error` — an unexpected Bird-side failure. `undeliverable` — the recipient could not be reached (e.g. not on WhatsApp, number invalid). `service_window_expired` — the 24-hour customer care window has closed and a free-form message cannot be sent; send a template instead. `rate_limited` — the send was throttled.
|
|
1513
|
-
*
|
|
1514
|
-
*/
|
|
1515
|
-
type WhatsAppErrorCode = string;
|
|
1516
|
-
/**
|
|
1517
|
-
* Failure detail for a message that could not be delivered. Null when there is no failure.
|
|
1518
|
-
*/
|
|
1519
|
-
type WhatsAppError = {
|
|
1520
|
-
code: WhatsAppErrorCode;
|
|
1521
|
-
/**
|
|
1522
|
-
* Human-readable explanation of the failure.
|
|
1523
|
-
*/
|
|
1524
|
-
readonly description: string;
|
|
1525
|
-
/**
|
|
1526
|
-
* Raw error code from the WhatsApp Cloud API, when available, for low-level debugging.
|
|
1527
|
-
*/
|
|
1528
|
-
readonly meta_error_code?: string | null;
|
|
1529
|
-
/**
|
|
1530
|
-
* When the failure occurred.
|
|
1531
|
-
*/
|
|
1532
|
-
readonly occurred_at: string;
|
|
1533
|
-
} | null;
|
|
1534
1968
|
type WhatsAppEventId = string;
|
|
1535
1969
|
type WhatsAppEvent = {
|
|
1536
1970
|
/**
|
|
@@ -1549,7 +1983,7 @@ type WhatsAppEvent = {
|
|
|
1549
1983
|
/**
|
|
1550
1984
|
* Failure detail. Present on `whatsapp.failed` events; null otherwise.
|
|
1551
1985
|
*/
|
|
1552
|
-
error
|
|
1986
|
+
error?: WhatsAppError;
|
|
1553
1987
|
};
|
|
1554
1988
|
type SendWhatsAppMessageRequest = {
|
|
1555
1989
|
/**
|
|
@@ -1664,7 +2098,6 @@ type WhatsAppMessageBusiness = {
|
|
|
1664
2098
|
*/
|
|
1665
2099
|
readonly phone_number_id?: string;
|
|
1666
2100
|
};
|
|
1667
|
-
type WhatsAppMessageId = string;
|
|
1668
2101
|
type WhatsAppMessage = {
|
|
1669
2102
|
/**
|
|
1670
2103
|
* Message ID.
|
|
@@ -3087,6 +3520,42 @@ type ListWhatsAppMessageEventsData = {
|
|
|
3087
3520
|
};
|
|
3088
3521
|
url: "/v1/whatsapp/messages/{message_id}/events";
|
|
3089
3522
|
};
|
|
3523
|
+
type ListDomainsData = {
|
|
3524
|
+
body?: never;
|
|
3525
|
+
path?: never;
|
|
3526
|
+
query?: {
|
|
3527
|
+
/**
|
|
3528
|
+
* Substring match against the domain name (case-insensitive).
|
|
3529
|
+
*/
|
|
3530
|
+
name?: string;
|
|
3531
|
+
/**
|
|
3532
|
+
* Field to sort by.
|
|
3533
|
+
*/
|
|
3534
|
+
sort?: "created_at" | "name";
|
|
3535
|
+
/**
|
|
3536
|
+
* Sort direction. Defaults to `desc` (newest/largest first).
|
|
3537
|
+
*
|
|
3538
|
+
*/
|
|
3539
|
+
order?: "asc" | "desc";
|
|
3540
|
+
/**
|
|
3541
|
+
* Maximum number of items to return per page.
|
|
3542
|
+
*/
|
|
3543
|
+
limit?: number;
|
|
3544
|
+
/**
|
|
3545
|
+
* Cursor from the `next_cursor` field of a previous list response. Returns items immediately after the cursor position in the current sort order.
|
|
3546
|
+
*/
|
|
3547
|
+
starting_after?: string;
|
|
3548
|
+
/**
|
|
3549
|
+
* Cursor from the `prev_cursor` field of a previous list response. Returns items immediately before the cursor position in the current sort order.
|
|
3550
|
+
*/
|
|
3551
|
+
ending_before?: string;
|
|
3552
|
+
/**
|
|
3553
|
+
* When true, the response includes a `total` field with the total number of items matching the request's filters across all pages.
|
|
3554
|
+
*/
|
|
3555
|
+
include_total?: boolean;
|
|
3556
|
+
};
|
|
3557
|
+
url: "/v1/email/domains";
|
|
3558
|
+
};
|
|
3090
3559
|
//#endregion
|
|
3091
3560
|
//#region src/generated/core/auth.gen.d.ts
|
|
3092
3561
|
type AuthToken = string | undefined;
|
|
@@ -3653,6 +4122,76 @@ declare class AudiencesResource extends Resource {
|
|
|
3653
4122
|
removeContact(audienceId: string, contactId: string, options?: RequestOptions): APIPromise<void>;
|
|
3654
4123
|
}
|
|
3655
4124
|
//#endregion
|
|
4125
|
+
//#region src/resources/domains.d.ts
|
|
4126
|
+
/** Body for `bird.domains.create`. */
|
|
4127
|
+
type DomainCreateParams = DomainCreate;
|
|
4128
|
+
/**
|
|
4129
|
+
* Body for `bird.domains.update` — a partial patch. Omit a field to leave it
|
|
4130
|
+
* unchanged; send `tracking: null` to remove the tracking domain (both tracking
|
|
4131
|
+
* toggles must be off first, else the API returns 409).
|
|
4132
|
+
*/
|
|
4133
|
+
type DomainUpdateParams = DomainUpdate;
|
|
4134
|
+
/** Filters and cursor params for `bird.domains.list`. */
|
|
4135
|
+
type DomainListQuery = NonNullable<ListDomainsData["query"]>;
|
|
4136
|
+
declare class DomainsResource extends Resource {
|
|
4137
|
+
/**
|
|
4138
|
+
* Register a sending domain. Returns it in `pending` with the `dns_records`
|
|
4139
|
+
* to publish at your DNS provider; call `verify` once they are in place.
|
|
4140
|
+
*
|
|
4141
|
+
* @example Register a sending domain
|
|
4142
|
+
* const domain = await bird.domains.create({ domain: "mail.acme.com" });
|
|
4143
|
+
* console.log(domain.id, domain.status); // "dom_…", "pending"
|
|
4144
|
+
*/
|
|
4145
|
+
create(params: DomainCreateParams, options?: RequestOptions): APIPromise<Domain>;
|
|
4146
|
+
/**
|
|
4147
|
+
* List the workspace's sending domains, newest first. `await` resolves the
|
|
4148
|
+
* first page; `for await` walks every domain across pages.
|
|
4149
|
+
*
|
|
4150
|
+
* @example
|
|
4151
|
+
* for await (const domain of bird.domains.list()) {
|
|
4152
|
+
* console.log(domain.id, domain.status);
|
|
4153
|
+
* }
|
|
4154
|
+
*/
|
|
4155
|
+
list(query?: DomainListQuery, options?: RequestOptions): PaginatedPromise<Domain>;
|
|
4156
|
+
/**
|
|
4157
|
+
* Fetch a single sending domain by id, with its DNS records and their
|
|
4158
|
+
* per-record verification state.
|
|
4159
|
+
*
|
|
4160
|
+
* @example
|
|
4161
|
+
* const domain = await bird.domains.get("dom_01krdgeqcxet5s7t44vh8rt9mg");
|
|
4162
|
+
*/
|
|
4163
|
+
get(domainId: string, options?: RequestOptions): APIPromise<Domain>;
|
|
4164
|
+
/**
|
|
4165
|
+
* Update a sending domain. Only the fields you send change; `settings` apply
|
|
4166
|
+
* immediately, while `return_path`/`tracking`/`dkim` changes are staged until
|
|
4167
|
+
* their new DNS records verify.
|
|
4168
|
+
*
|
|
4169
|
+
* @example
|
|
4170
|
+
* await bird.domains.update("dom_01krdgeqcxet5s7t44vh8rt9mg", {
|
|
4171
|
+
* settings: { click_tracking: true, open_tracking: true },
|
|
4172
|
+
* tracking: { name: "links" },
|
|
4173
|
+
* });
|
|
4174
|
+
*/
|
|
4175
|
+
update(domainId: string, params: DomainUpdateParams, options?: RequestOptions): APIPromise<Domain>;
|
|
4176
|
+
/**
|
|
4177
|
+
* Delete a sending domain. Mail already accepted still sends; you can no
|
|
4178
|
+
* longer send new mail from it.
|
|
4179
|
+
*
|
|
4180
|
+
* @example
|
|
4181
|
+
* await bird.domains.delete("dom_01krdgeqcxet5s7t44vh8rt9mg");
|
|
4182
|
+
*/
|
|
4183
|
+
delete(domainId: string, options?: RequestOptions): APIPromise<void>;
|
|
4184
|
+
/**
|
|
4185
|
+
* Trigger a fresh DNS check and return the refreshed domain with per-record
|
|
4186
|
+
* results. Safe to repeat while waiting for DNS to propagate.
|
|
4187
|
+
*
|
|
4188
|
+
* @example
|
|
4189
|
+
* const domain = await bird.domains.verify("dom_01krdgeqcxet5s7t44vh8rt9mg");
|
|
4190
|
+
* console.log(domain.status); // "verified" once DNS is in place
|
|
4191
|
+
*/
|
|
4192
|
+
verify(domainId: string, options?: RequestOptions): APIPromise<Domain>;
|
|
4193
|
+
}
|
|
4194
|
+
//#endregion
|
|
3656
4195
|
//#region src/resources/contactProperties.d.ts
|
|
3657
4196
|
/** Body for `bird.contactProperties.create`. */
|
|
3658
4197
|
type ContactPropertyCreateParams = ContactPropertyCreateRequest;
|
|
@@ -4128,6 +4667,8 @@ declare class BirdClient<const O extends BirdClientOptions = BirdClientOptions>
|
|
|
4128
4667
|
readonly audiences: AudiencesResource;
|
|
4129
4668
|
/** Contact properties — `bird.contactProperties.create(...)`, `.list(...)`, `.archive(...)`, … */
|
|
4130
4669
|
readonly contactProperties: ContactPropertiesResource;
|
|
4670
|
+
/** Sending domains — `bird.domains.create(...)`, `.list(...)`, `.verify(...)`, … */
|
|
4671
|
+
readonly domains: DomainsResource;
|
|
4131
4672
|
/** Webhooks — `bird.webhooks.unwrap(payload, headers)` verifies an inbound delivery. */
|
|
4132
4673
|
readonly webhooks: WebhooksResource;
|
|
4133
4674
|
constructor(options: O);
|
|
@@ -4195,9 +4736,14 @@ declare const WebhookEventType: {
|
|
|
4195
4736
|
readonly SmsRejected: "sms.rejected";
|
|
4196
4737
|
readonly SmsSent: "sms.sent";
|
|
4197
4738
|
readonly SmsUndelivered: "sms.undelivered";
|
|
4739
|
+
readonly WhatsappAccepted: "whatsapp.accepted";
|
|
4740
|
+
readonly WhatsappDelivered: "whatsapp.delivered";
|
|
4741
|
+
readonly WhatsappFailed: "whatsapp.failed";
|
|
4742
|
+
readonly WhatsappRead: "whatsapp.read";
|
|
4743
|
+
readonly WhatsappSent: "whatsapp.sent";
|
|
4198
4744
|
};
|
|
4199
4745
|
/** A known webhook event type value. */
|
|
4200
4746
|
type WebhookEventTypeValue = (typeof WebhookEventType)[keyof typeof WebhookEventType];
|
|
4201
4747
|
//#endregion
|
|
4202
|
-
export { type APIPromise, type Audience, type AudienceAddContactsParams, type AudienceContactsQuery, type AudienceCreateParams, type AudienceListQuery, type AudienceMember, type AudienceRemoveContactsParams, type AudienceUpdateParams, BirdAPIError, BirdAuthError, BirdBadRequestError, BirdBillingError, BirdClient, type BirdClientOptions, BirdConflictError, BirdConnectionError, BirdError, BirdInternalError, BirdMisdirectedError, BirdNotFoundError, BirdNotImplementedError, BirdPayloadTooLargeError, BirdPermissionError, BirdPreconditionError, BirdRateLimitError, type BirdRequest, type BirdResponse, BirdServiceUnavailableError, BirdTimeoutError, BirdValidationError, type BirdWebhookEvent, BirdWebhookVerificationError, type Contact, type ContactBatchParams, type ContactCreateParams, type ContactListQuery, type ContactProperty, type ContactPropertyCreateParams, type ContactPropertyListQuery, type ContactPropertyUpdateParams, type ContactUpdateParams, type ContactUpsertResult, type CursorPage, type EmailChannelDefaults, type EmailListQuery, type EmailMessage, type EmailSendBatchParams, type EmailSendBatchResult, type EmailSendParams, type ErrorDetail, type ErrorNextAction, type PaginatedPromise, type RequestOptions, type SafeResult, type SmsListQuery, type SmsMessage, type SmsSendBatchParams, type SmsSendBatchResult, type SmsSendParams, type SmsTemplate, type SmsTemplateList, type SmsTemplateListQuery, type UnmetGate, type Verification, type VerificationCheckParams, type VerificationCheckResult, type VerificationCreateParams, WebhookEventType, type WebhookEventTypeValue, type WebhookHeaders, type WebhookOptions, type WhatsAppEventList, type WhatsAppMessage, type WhatsAppTemplate, type WhatsAppTemplateList, type WhatsappListEventsQuery, type WhatsappListQuery, type WhatsappSendParams, baseUrlForRegion, regionFromApiKey };
|
|
4748
|
+
export { type APIPromise, type Audience, type AudienceAddContactsParams, type AudienceContactsQuery, type AudienceCreateParams, type AudienceListQuery, type AudienceMember, type AudienceRemoveContactsParams, type AudienceUpdateParams, BirdAPIError, BirdAuthError, BirdBadRequestError, BirdBillingError, BirdClient, type BirdClientOptions, BirdConflictError, BirdConnectionError, BirdError, BirdInternalError, BirdMisdirectedError, BirdNotFoundError, BirdNotImplementedError, BirdPayloadTooLargeError, BirdPermissionError, BirdPreconditionError, BirdRateLimitError, type BirdRequest, type BirdResponse, BirdServiceUnavailableError, BirdTimeoutError, BirdValidationError, type BirdWebhookEvent, BirdWebhookVerificationError, type Contact, type ContactBatchParams, type ContactCreateParams, type ContactListQuery, type ContactProperty, type ContactPropertyCreateParams, type ContactPropertyListQuery, type ContactPropertyUpdateParams, type ContactUpdateParams, type ContactUpsertResult, type CursorPage, type DnsRecord, type Domain, type DomainCapabilities, type DomainCreateParams, type DomainDkim, type DomainListQuery, type DomainUpdateParams, type EmailChannelDefaults, type EmailListQuery, type EmailMessage, type EmailSendBatchParams, type EmailSendBatchResult, type EmailSendParams, type ErrorDetail, type ErrorNextAction, type PaginatedPromise, type RequestOptions, type SafeResult, type SmsListQuery, type SmsMessage, type SmsSendBatchParams, type SmsSendBatchResult, type SmsSendParams, type SmsTemplate, type SmsTemplateList, type SmsTemplateListQuery, type UnmetGate, type Verification, type VerificationCheckParams, type VerificationCheckResult, type VerificationCreateParams, WebhookEventType, type WebhookEventTypeValue, type WebhookHeaders, type WebhookOptions, type WhatsAppEventList, type WhatsAppMessage, type WhatsAppTemplate, type WhatsAppTemplateList, type WhatsappListEventsQuery, type WhatsappListQuery, type WhatsappSendParams, baseUrlForRegion, regionFromApiKey };
|
|
4203
4749
|
//# sourceMappingURL=index.d.mts.map
|