@messagebird/sdk 0.7.5 → 0.8.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 +386 -1
- package/dist/index.mjs +225 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1406,6 +1406,283 @@ type EmailAddress = {
|
|
|
1406
1406
|
*/
|
|
1407
1407
|
name?: string;
|
|
1408
1408
|
};
|
|
1409
|
+
/**
|
|
1410
|
+
* 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.
|
|
1411
|
+
*
|
|
1412
|
+
*/
|
|
1413
|
+
type DomainUpdate = {
|
|
1414
|
+
settings?: DomainSettings;
|
|
1415
|
+
return_path?: DomainReturnPathConfig & unknown;
|
|
1416
|
+
/**
|
|
1417
|
+
* 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`.
|
|
1418
|
+
*
|
|
1419
|
+
*/
|
|
1420
|
+
tracking?: DomainTrackingConfig | null;
|
|
1421
|
+
dkim?: DomainDkimConfig & unknown;
|
|
1422
|
+
inbound?: DomainInboundConfig & unknown;
|
|
1423
|
+
};
|
|
1424
|
+
/**
|
|
1425
|
+
* 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.
|
|
1426
|
+
*
|
|
1427
|
+
*/
|
|
1428
|
+
type DomainInboundConfig = {
|
|
1429
|
+
/**
|
|
1430
|
+
* 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.
|
|
1431
|
+
*
|
|
1432
|
+
*/
|
|
1433
|
+
enabled: boolean;
|
|
1434
|
+
};
|
|
1435
|
+
/**
|
|
1436
|
+
* DKIM signing configuration.
|
|
1437
|
+
*/
|
|
1438
|
+
type DomainDkimConfig = {
|
|
1439
|
+
/**
|
|
1440
|
+
* How the DKIM public key is published in your DNS.
|
|
1441
|
+
* - `txt` — you publish the DKIM public key as a TXT record. Key
|
|
1442
|
+
* rotation requires updating the record.
|
|
1443
|
+
* - `delegated` — preview, currently unavailable; supplying it returns
|
|
1444
|
+
* `422`. When available, you publish a single CNAME and Bird hosts
|
|
1445
|
+
* and rotates the key with no further DNS changes on your side.
|
|
1446
|
+
*
|
|
1447
|
+
*/
|
|
1448
|
+
mode?: "txt" | "delegated";
|
|
1449
|
+
};
|
|
1450
|
+
/**
|
|
1451
|
+
* 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.
|
|
1452
|
+
*
|
|
1453
|
+
*/
|
|
1454
|
+
type DomainTrackingConfig = {
|
|
1455
|
+
/**
|
|
1456
|
+
* Name part to use for branded open and click tracking URLs. For example, `links` on `mail.acme.com` becomes `links.mail.acme.com`.
|
|
1457
|
+
*
|
|
1458
|
+
*/
|
|
1459
|
+
name: string;
|
|
1460
|
+
};
|
|
1461
|
+
/**
|
|
1462
|
+
* 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.
|
|
1463
|
+
*
|
|
1464
|
+
*/
|
|
1465
|
+
type DomainReturnPathConfig = {
|
|
1466
|
+
/**
|
|
1467
|
+
* 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.
|
|
1468
|
+
*
|
|
1469
|
+
*/
|
|
1470
|
+
name: string;
|
|
1471
|
+
};
|
|
1472
|
+
/**
|
|
1473
|
+
* Per-domain behavior toggles. Changes apply immediately to new sends.
|
|
1474
|
+
*
|
|
1475
|
+
*/
|
|
1476
|
+
type DomainSettings = {
|
|
1477
|
+
/**
|
|
1478
|
+
* 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`.
|
|
1479
|
+
*
|
|
1480
|
+
*/
|
|
1481
|
+
click_tracking?: boolean;
|
|
1482
|
+
/**
|
|
1483
|
+
* 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`.
|
|
1484
|
+
*
|
|
1485
|
+
*/
|
|
1486
|
+
open_tracking?: boolean;
|
|
1487
|
+
};
|
|
1488
|
+
type DomainCreate = {
|
|
1489
|
+
/**
|
|
1490
|
+
* 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.
|
|
1491
|
+
*
|
|
1492
|
+
*/
|
|
1493
|
+
domain: string;
|
|
1494
|
+
return_path?: DomainReturnPathConfig;
|
|
1495
|
+
tracking?: DomainTrackingConfig;
|
|
1496
|
+
dkim?: DomainDkimConfig;
|
|
1497
|
+
settings?: DomainSettings;
|
|
1498
|
+
};
|
|
1499
|
+
type DnsRecord = {
|
|
1500
|
+
type: "TXT" | "CNAME" | "MX";
|
|
1501
|
+
/**
|
|
1502
|
+
* 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.
|
|
1503
|
+
*
|
|
1504
|
+
*/
|
|
1505
|
+
name: string;
|
|
1506
|
+
/**
|
|
1507
|
+
* The fully qualified hostname for this record (e.g. `bird1._domainkey.mail.acme.com`).
|
|
1508
|
+
*
|
|
1509
|
+
*/
|
|
1510
|
+
host: string;
|
|
1511
|
+
value: string;
|
|
1512
|
+
/**
|
|
1513
|
+
* What this record is for.
|
|
1514
|
+
* - `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
|
|
1515
|
+
* present wherever inbound is available, as a regional reference,
|
|
1516
|
+
* regardless of whether receiving is enabled; publishing it does not
|
|
1517
|
+
* enable receiving on its own — see `DomainUpdate.inbound`.
|
|
1518
|
+
*
|
|
1519
|
+
*/
|
|
1520
|
+
purpose: "dkim" | "return_path" | "tracking" | "inbound_mx" | "dmarc";
|
|
1521
|
+
/**
|
|
1522
|
+
* Lifecycle state of this record.
|
|
1523
|
+
* - `active` — the record backs the domain's current configuration. - `pending` — the record belongs to a staged configuration change;
|
|
1524
|
+
* publish it to complete the change.
|
|
1525
|
+
* - `deprecated` — the record belonged to a previous configuration.
|
|
1526
|
+
* Keep it in DNS until `safe_to_remove` is `true`; in-flight mail and
|
|
1527
|
+
* previously sent tracked links may still resolve through it.
|
|
1528
|
+
*
|
|
1529
|
+
*/
|
|
1530
|
+
readonly state: "active" | "pending" | "deprecated";
|
|
1531
|
+
/**
|
|
1532
|
+
* Whether this record can be skipped. Optional records enable extra functionality (e.g. tracking) but are not required for sending.
|
|
1533
|
+
*
|
|
1534
|
+
*/
|
|
1535
|
+
readonly optional: boolean;
|
|
1536
|
+
/**
|
|
1537
|
+
* Verification status of this record's most recent DNS check.
|
|
1538
|
+
* - `pending` — the record has not verified yet; publish it (or correct it)
|
|
1539
|
+
* and it will verify on the next check.
|
|
1540
|
+
* - `verified` — the most recent check matched the expected value. - `warning` — the record verified before and a recent check no longer
|
|
1541
|
+
* matched, but it is still within the grace period. Sending is not yet
|
|
1542
|
+
* affected; fix the record before the grace period ends to avoid it
|
|
1543
|
+
* being blocked.
|
|
1544
|
+
* - `failed` — the record verified before but later checks kept failing
|
|
1545
|
+
* past the grace period; the configuration has regressed and needs
|
|
1546
|
+
* attention.
|
|
1547
|
+
*
|
|
1548
|
+
*/
|
|
1549
|
+
readonly status: "pending" | "verified" | "warning" | "failed";
|
|
1550
|
+
/**
|
|
1551
|
+
* 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.
|
|
1552
|
+
*
|
|
1553
|
+
*/
|
|
1554
|
+
readonly error?: string | null;
|
|
1555
|
+
/**
|
|
1556
|
+
* 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.
|
|
1557
|
+
*
|
|
1558
|
+
*/
|
|
1559
|
+
readonly safe_to_remove?: boolean | null;
|
|
1560
|
+
};
|
|
1561
|
+
/**
|
|
1562
|
+
* 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.
|
|
1563
|
+
*
|
|
1564
|
+
*/
|
|
1565
|
+
type DomainCapabilityPending = {
|
|
1566
|
+
/**
|
|
1567
|
+
* Hostname the capability will use once the staged change verifies.
|
|
1568
|
+
*/
|
|
1569
|
+
readonly domain: string;
|
|
1570
|
+
/**
|
|
1571
|
+
* 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.
|
|
1572
|
+
*
|
|
1573
|
+
*/
|
|
1574
|
+
readonly status: "pending" | "failed" | "temporary_failure";
|
|
1575
|
+
};
|
|
1576
|
+
type DomainCapability = {
|
|
1577
|
+
/**
|
|
1578
|
+
* Capability verification status.
|
|
1579
|
+
* - `pending` — verification has not run, or is currently running. - `verified` — all DNS records for this capability resolved with the
|
|
1580
|
+
* expected values.
|
|
1581
|
+
* - `warning` — a record for this capability verified before and a recent
|
|
1582
|
+
* check no longer matches, but it is still within the grace period.
|
|
1583
|
+
* Sending is not yet affected; fix it before the grace period ends.
|
|
1584
|
+
* - `failed` — DNS records resolved but at least one value is wrong.
|
|
1585
|
+
* Update your DNS to recover.
|
|
1586
|
+
* - `temporary_failure` — DNS lookup failed transiently. Verification is
|
|
1587
|
+
* queued for retry; don't change DNS records yet.
|
|
1588
|
+
* - `not_configured` — the capability is not set up on this domain
|
|
1589
|
+
* (e.g. no tracking domain configured).
|
|
1590
|
+
*
|
|
1591
|
+
*/
|
|
1592
|
+
readonly status: "pending" | "verified" | "warning" | "failed" | "temporary_failure" | "not_configured";
|
|
1593
|
+
/**
|
|
1594
|
+
* 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.
|
|
1595
|
+
*
|
|
1596
|
+
*/
|
|
1597
|
+
readonly domain?: string | null;
|
|
1598
|
+
pending?: DomainCapabilityPending;
|
|
1599
|
+
/**
|
|
1600
|
+
* 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.
|
|
1601
|
+
* - `tracking_domain_in_use` — the link tracking subdomain is already claimed
|
|
1602
|
+
* by another organization.
|
|
1603
|
+
*
|
|
1604
|
+
*/
|
|
1605
|
+
readonly reason?: string | null;
|
|
1606
|
+
};
|
|
1607
|
+
type DomainCapabilities = {
|
|
1608
|
+
sending: DomainCapability & unknown;
|
|
1609
|
+
return_path: DomainCapability & unknown;
|
|
1610
|
+
dmarc: DomainCapability & unknown;
|
|
1611
|
+
tracking: DomainCapability & unknown;
|
|
1612
|
+
inbound?: DomainCapability & unknown;
|
|
1613
|
+
};
|
|
1614
|
+
/**
|
|
1615
|
+
* Active DKIM signing configuration for the domain.
|
|
1616
|
+
*/
|
|
1617
|
+
type DomainDkim = {
|
|
1618
|
+
/**
|
|
1619
|
+
* 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.
|
|
1620
|
+
*
|
|
1621
|
+
*/
|
|
1622
|
+
readonly mode: "txt" | "delegated";
|
|
1623
|
+
/**
|
|
1624
|
+
* DKIM selector used to sign mail from this domain.
|
|
1625
|
+
*/
|
|
1626
|
+
readonly selector: string;
|
|
1627
|
+
/**
|
|
1628
|
+
* RSA key size in bits.
|
|
1629
|
+
*/
|
|
1630
|
+
readonly key_size: number;
|
|
1631
|
+
};
|
|
1632
|
+
type Domain = {
|
|
1633
|
+
readonly id: DomainId;
|
|
1634
|
+
readonly workspace_id: WorkspaceId;
|
|
1635
|
+
/**
|
|
1636
|
+
* The sending domain name. Set at creation and immutable.
|
|
1637
|
+
*/
|
|
1638
|
+
readonly domain: string;
|
|
1639
|
+
/**
|
|
1640
|
+
* 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.
|
|
1641
|
+
*
|
|
1642
|
+
*/
|
|
1643
|
+
readonly vendor: "other" | "cloudflare" | "route53" | "godaddy" | "namecheap" | "google" | "azure" | "digitalocean" | "squarespace";
|
|
1644
|
+
/**
|
|
1645
|
+
* Domain ownership verification, proven by the DKIM record. Readiness to send or track is reported separately per capability under `capabilities.*.status`.
|
|
1646
|
+
* - `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
|
|
1647
|
+
* value (for example a stale record from an earlier setup), or a
|
|
1648
|
+
* previously verified record was removed. Correct the record to
|
|
1649
|
+
* recover.
|
|
1650
|
+
* - `temporary_failure` — DNS resolution failed transiently (timeout,
|
|
1651
|
+
* unreachable nameserver). Verification is queued for retry on a 72h
|
|
1652
|
+
* cadence; customer should not edit DNS records before the retry runs.
|
|
1653
|
+
* - `rejected` — the domain was refused for policy reasons and cannot be
|
|
1654
|
+
* used for sending. Contact support if you believe this is an error.
|
|
1655
|
+
*
|
|
1656
|
+
*/
|
|
1657
|
+
readonly status: "pending" | "verified" | "failed" | "temporary_failure" | "rejected";
|
|
1658
|
+
settings: DomainSettings;
|
|
1659
|
+
readonly dkim: DomainDkim;
|
|
1660
|
+
capabilities: DomainCapabilities;
|
|
1661
|
+
/**
|
|
1662
|
+
* 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`).
|
|
1663
|
+
*
|
|
1664
|
+
*/
|
|
1665
|
+
readonly dns_records: Array<DnsRecord>;
|
|
1666
|
+
/**
|
|
1667
|
+
* 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.
|
|
1668
|
+
*
|
|
1669
|
+
*/
|
|
1670
|
+
readonly last_checked_at?: string | null;
|
|
1671
|
+
/**
|
|
1672
|
+
* 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.
|
|
1673
|
+
*
|
|
1674
|
+
*/
|
|
1675
|
+
readonly verified_at?: string | null;
|
|
1676
|
+
/**
|
|
1677
|
+
* When the domain was added.
|
|
1678
|
+
*/
|
|
1679
|
+
readonly created_at: string;
|
|
1680
|
+
/**
|
|
1681
|
+
* 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.
|
|
1682
|
+
*
|
|
1683
|
+
*/
|
|
1684
|
+
readonly updated_at: string;
|
|
1685
|
+
};
|
|
1409
1686
|
type WhatsAppTemplateList = {
|
|
1410
1687
|
/**
|
|
1411
1688
|
* The templates available to your workspace.
|
|
@@ -3087,6 +3364,42 @@ type ListWhatsAppMessageEventsData = {
|
|
|
3087
3364
|
};
|
|
3088
3365
|
url: "/v1/whatsapp/messages/{message_id}/events";
|
|
3089
3366
|
};
|
|
3367
|
+
type ListDomainsData = {
|
|
3368
|
+
body?: never;
|
|
3369
|
+
path?: never;
|
|
3370
|
+
query?: {
|
|
3371
|
+
/**
|
|
3372
|
+
* Substring match against the domain name (case-insensitive).
|
|
3373
|
+
*/
|
|
3374
|
+
name?: string;
|
|
3375
|
+
/**
|
|
3376
|
+
* Field to sort by.
|
|
3377
|
+
*/
|
|
3378
|
+
sort?: "created_at" | "name";
|
|
3379
|
+
/**
|
|
3380
|
+
* Sort direction. Defaults to `desc` (newest/largest first).
|
|
3381
|
+
*
|
|
3382
|
+
*/
|
|
3383
|
+
order?: "asc" | "desc";
|
|
3384
|
+
/**
|
|
3385
|
+
* Maximum number of items to return per page.
|
|
3386
|
+
*/
|
|
3387
|
+
limit?: number;
|
|
3388
|
+
/**
|
|
3389
|
+
* Cursor from the `next_cursor` field of a previous list response. Returns items immediately after the cursor position in the current sort order.
|
|
3390
|
+
*/
|
|
3391
|
+
starting_after?: string;
|
|
3392
|
+
/**
|
|
3393
|
+
* Cursor from the `prev_cursor` field of a previous list response. Returns items immediately before the cursor position in the current sort order.
|
|
3394
|
+
*/
|
|
3395
|
+
ending_before?: string;
|
|
3396
|
+
/**
|
|
3397
|
+
* When true, the response includes a `total` field with the total number of items matching the request's filters across all pages.
|
|
3398
|
+
*/
|
|
3399
|
+
include_total?: boolean;
|
|
3400
|
+
};
|
|
3401
|
+
url: "/v1/email/domains";
|
|
3402
|
+
};
|
|
3090
3403
|
//#endregion
|
|
3091
3404
|
//#region src/generated/core/auth.gen.d.ts
|
|
3092
3405
|
type AuthToken = string | undefined;
|
|
@@ -3653,6 +3966,76 @@ declare class AudiencesResource extends Resource {
|
|
|
3653
3966
|
removeContact(audienceId: string, contactId: string, options?: RequestOptions): APIPromise<void>;
|
|
3654
3967
|
}
|
|
3655
3968
|
//#endregion
|
|
3969
|
+
//#region src/resources/domains.d.ts
|
|
3970
|
+
/** Body for `bird.domains.create`. */
|
|
3971
|
+
type DomainCreateParams = DomainCreate;
|
|
3972
|
+
/**
|
|
3973
|
+
* Body for `bird.domains.update` — a partial patch. Omit a field to leave it
|
|
3974
|
+
* unchanged; send `tracking: null` to remove the tracking domain (both tracking
|
|
3975
|
+
* toggles must be off first, else the API returns 409).
|
|
3976
|
+
*/
|
|
3977
|
+
type DomainUpdateParams = DomainUpdate;
|
|
3978
|
+
/** Filters and cursor params for `bird.domains.list`. */
|
|
3979
|
+
type DomainListQuery = NonNullable<ListDomainsData["query"]>;
|
|
3980
|
+
declare class DomainsResource extends Resource {
|
|
3981
|
+
/**
|
|
3982
|
+
* Register a sending domain. Returns it in `pending` with the `dns_records`
|
|
3983
|
+
* to publish at your DNS provider; call `verify` once they are in place.
|
|
3984
|
+
*
|
|
3985
|
+
* @example Register a sending domain
|
|
3986
|
+
* const domain = await bird.domains.create({ domain: "mail.acme.com" });
|
|
3987
|
+
* console.log(domain.id, domain.status); // "dom_…", "pending"
|
|
3988
|
+
*/
|
|
3989
|
+
create(params: DomainCreateParams, options?: RequestOptions): APIPromise<Domain>;
|
|
3990
|
+
/**
|
|
3991
|
+
* List the workspace's sending domains, newest first. `await` resolves the
|
|
3992
|
+
* first page; `for await` walks every domain across pages.
|
|
3993
|
+
*
|
|
3994
|
+
* @example
|
|
3995
|
+
* for await (const domain of bird.domains.list()) {
|
|
3996
|
+
* console.log(domain.id, domain.status);
|
|
3997
|
+
* }
|
|
3998
|
+
*/
|
|
3999
|
+
list(query?: DomainListQuery, options?: RequestOptions): PaginatedPromise<Domain>;
|
|
4000
|
+
/**
|
|
4001
|
+
* Fetch a single sending domain by id, with its DNS records and their
|
|
4002
|
+
* per-record verification state.
|
|
4003
|
+
*
|
|
4004
|
+
* @example
|
|
4005
|
+
* const domain = await bird.domains.get("dom_01krdgeqcxet5s7t44vh8rt9mg");
|
|
4006
|
+
*/
|
|
4007
|
+
get(domainId: string, options?: RequestOptions): APIPromise<Domain>;
|
|
4008
|
+
/**
|
|
4009
|
+
* Update a sending domain. Only the fields you send change; `settings` apply
|
|
4010
|
+
* immediately, while `return_path`/`tracking`/`dkim` changes are staged until
|
|
4011
|
+
* their new DNS records verify.
|
|
4012
|
+
*
|
|
4013
|
+
* @example
|
|
4014
|
+
* await bird.domains.update("dom_01krdgeqcxet5s7t44vh8rt9mg", {
|
|
4015
|
+
* settings: { click_tracking: true, open_tracking: true },
|
|
4016
|
+
* tracking: { name: "links" },
|
|
4017
|
+
* });
|
|
4018
|
+
*/
|
|
4019
|
+
update(domainId: string, params: DomainUpdateParams, options?: RequestOptions): APIPromise<Domain>;
|
|
4020
|
+
/**
|
|
4021
|
+
* Delete a sending domain. Mail already accepted still sends; you can no
|
|
4022
|
+
* longer send new mail from it.
|
|
4023
|
+
*
|
|
4024
|
+
* @example
|
|
4025
|
+
* await bird.domains.delete("dom_01krdgeqcxet5s7t44vh8rt9mg");
|
|
4026
|
+
*/
|
|
4027
|
+
delete(domainId: string, options?: RequestOptions): APIPromise<void>;
|
|
4028
|
+
/**
|
|
4029
|
+
* Trigger a fresh DNS check and return the refreshed domain with per-record
|
|
4030
|
+
* results. Safe to repeat while waiting for DNS to propagate.
|
|
4031
|
+
*
|
|
4032
|
+
* @example
|
|
4033
|
+
* const domain = await bird.domains.verify("dom_01krdgeqcxet5s7t44vh8rt9mg");
|
|
4034
|
+
* console.log(domain.status); // "verified" once DNS is in place
|
|
4035
|
+
*/
|
|
4036
|
+
verify(domainId: string, options?: RequestOptions): APIPromise<Domain>;
|
|
4037
|
+
}
|
|
4038
|
+
//#endregion
|
|
3656
4039
|
//#region src/resources/contactProperties.d.ts
|
|
3657
4040
|
/** Body for `bird.contactProperties.create`. */
|
|
3658
4041
|
type ContactPropertyCreateParams = ContactPropertyCreateRequest;
|
|
@@ -4128,6 +4511,8 @@ declare class BirdClient<const O extends BirdClientOptions = BirdClientOptions>
|
|
|
4128
4511
|
readonly audiences: AudiencesResource;
|
|
4129
4512
|
/** Contact properties — `bird.contactProperties.create(...)`, `.list(...)`, `.archive(...)`, … */
|
|
4130
4513
|
readonly contactProperties: ContactPropertiesResource;
|
|
4514
|
+
/** Sending domains — `bird.domains.create(...)`, `.list(...)`, `.verify(...)`, … */
|
|
4515
|
+
readonly domains: DomainsResource;
|
|
4131
4516
|
/** Webhooks — `bird.webhooks.unwrap(payload, headers)` verifies an inbound delivery. */
|
|
4132
4517
|
readonly webhooks: WebhooksResource;
|
|
4133
4518
|
constructor(options: O);
|
|
@@ -4199,5 +4584,5 @@ declare const WebhookEventType: {
|
|
|
4199
4584
|
/** A known webhook event type value. */
|
|
4200
4585
|
type WebhookEventTypeValue = (typeof WebhookEventType)[keyof typeof WebhookEventType];
|
|
4201
4586
|
//#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 };
|
|
4587
|
+
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
4588
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1936,6 +1936,120 @@ const listWhatsAppTemplates = (options) => (options?.client ?? client).get({
|
|
|
1936
1936
|
url: "/v1/whatsapp/templates",
|
|
1937
1937
|
...options
|
|
1938
1938
|
});
|
|
1939
|
+
/**
|
|
1940
|
+
* List sending domains
|
|
1941
|
+
*
|
|
1942
|
+
* Returns all sending domains for the current workspace, ordered by creation date descending.
|
|
1943
|
+
*/
|
|
1944
|
+
const listDomains = (options) => (options?.client ?? client).get({
|
|
1945
|
+
security: [{
|
|
1946
|
+
scheme: "bearer",
|
|
1947
|
+
type: "http"
|
|
1948
|
+
}, {
|
|
1949
|
+
in: "cookie",
|
|
1950
|
+
name: "bird_session",
|
|
1951
|
+
type: "apiKey"
|
|
1952
|
+
}],
|
|
1953
|
+
url: "/v1/email/domains",
|
|
1954
|
+
...options
|
|
1955
|
+
});
|
|
1956
|
+
/**
|
|
1957
|
+
* Add a sending domain
|
|
1958
|
+
*
|
|
1959
|
+
* Registers a new sending domain and returns the DNS records required for verification: a DKIM TXT record, a return-path CNAME (which also covers SPF — no separate SPF record is needed), a DMARC policy, and, when a tracking domain is configured, a tracking CNAME. The domain starts in `pending` status; records are checked automatically once published, or on demand via the verify endpoint.
|
|
1960
|
+
*
|
|
1961
|
+
*/
|
|
1962
|
+
const createDomain = (options) => (options.client ?? client).post({
|
|
1963
|
+
security: [{
|
|
1964
|
+
scheme: "bearer",
|
|
1965
|
+
type: "http"
|
|
1966
|
+
}, {
|
|
1967
|
+
in: "cookie",
|
|
1968
|
+
name: "bird_session",
|
|
1969
|
+
type: "apiKey"
|
|
1970
|
+
}],
|
|
1971
|
+
url: "/v1/email/domains",
|
|
1972
|
+
...options,
|
|
1973
|
+
headers: {
|
|
1974
|
+
"Content-Type": "application/json",
|
|
1975
|
+
...options.headers
|
|
1976
|
+
}
|
|
1977
|
+
});
|
|
1978
|
+
/**
|
|
1979
|
+
* Delete a sending domain
|
|
1980
|
+
*
|
|
1981
|
+
* Removes the domain and revokes its sender authorization. New sends from a deleted domain are rejected. Historical statistics and events for past sends from this domain are preserved.
|
|
1982
|
+
*
|
|
1983
|
+
*/
|
|
1984
|
+
const deleteDomain = (options) => (options.client ?? client).delete({
|
|
1985
|
+
security: [{
|
|
1986
|
+
scheme: "bearer",
|
|
1987
|
+
type: "http"
|
|
1988
|
+
}, {
|
|
1989
|
+
in: "cookie",
|
|
1990
|
+
name: "bird_session",
|
|
1991
|
+
type: "apiKey"
|
|
1992
|
+
}],
|
|
1993
|
+
url: "/v1/email/domains/{domain_id}",
|
|
1994
|
+
...options
|
|
1995
|
+
});
|
|
1996
|
+
/**
|
|
1997
|
+
* Get a sending domain
|
|
1998
|
+
*
|
|
1999
|
+
* Returns the domain with current DNS verification status per record.
|
|
2000
|
+
*/
|
|
2001
|
+
const getDomain = (options) => (options.client ?? client).get({
|
|
2002
|
+
security: [{
|
|
2003
|
+
scheme: "bearer",
|
|
2004
|
+
type: "http"
|
|
2005
|
+
}, {
|
|
2006
|
+
in: "cookie",
|
|
2007
|
+
name: "bird_session",
|
|
2008
|
+
type: "apiKey"
|
|
2009
|
+
}],
|
|
2010
|
+
url: "/v1/email/domains/{domain_id}",
|
|
2011
|
+
...options
|
|
2012
|
+
});
|
|
2013
|
+
/**
|
|
2014
|
+
* Update a sending domain
|
|
2015
|
+
*
|
|
2016
|
+
* Updates settings and configuration on a sending domain. `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. Staged values are visible under `capabilities.*.pending`; the records to publish appear in `dns_records` with `state: pending`.
|
|
2017
|
+
*
|
|
2018
|
+
*/
|
|
2019
|
+
const updateDomain = (options) => (options.client ?? client).patch({
|
|
2020
|
+
security: [{
|
|
2021
|
+
scheme: "bearer",
|
|
2022
|
+
type: "http"
|
|
2023
|
+
}, {
|
|
2024
|
+
in: "cookie",
|
|
2025
|
+
name: "bird_session",
|
|
2026
|
+
type: "apiKey"
|
|
2027
|
+
}],
|
|
2028
|
+
url: "/v1/email/domains/{domain_id}",
|
|
2029
|
+
...options,
|
|
2030
|
+
headers: {
|
|
2031
|
+
"Content-Type": "application/json",
|
|
2032
|
+
...options.headers
|
|
2033
|
+
}
|
|
2034
|
+
});
|
|
2035
|
+
/**
|
|
2036
|
+
* Trigger domain verification
|
|
2037
|
+
*
|
|
2038
|
+
* Triggers an immediate DNS check and returns the updated verification result. Rate-limited to prevent DNS abuse (max 5 calls per domain per hour).
|
|
2039
|
+
*
|
|
2040
|
+
*/
|
|
2041
|
+
const verifyDomain = (options) => (options.client ?? client).post({
|
|
2042
|
+
security: [{
|
|
2043
|
+
scheme: "bearer",
|
|
2044
|
+
type: "http"
|
|
2045
|
+
}, {
|
|
2046
|
+
in: "cookie",
|
|
2047
|
+
name: "bird_session",
|
|
2048
|
+
type: "apiKey"
|
|
2049
|
+
}],
|
|
2050
|
+
url: "/v1/email/domains/{domain_id}/verify",
|
|
2051
|
+
...options
|
|
2052
|
+
});
|
|
1939
2053
|
//#endregion
|
|
1940
2054
|
//#region src/resources/base.ts
|
|
1941
2055
|
var Resource = class {
|
|
@@ -2303,6 +2417,112 @@ var AudiencesResource = class extends Resource {
|
|
|
2303
2417
|
}
|
|
2304
2418
|
};
|
|
2305
2419
|
//#endregion
|
|
2420
|
+
//#region src/resources/domains.ts
|
|
2421
|
+
var DomainsResource = class extends Resource {
|
|
2422
|
+
/**
|
|
2423
|
+
* Register a sending domain. Returns it in `pending` with the `dns_records`
|
|
2424
|
+
* to publish at your DNS provider; call `verify` once they are in place.
|
|
2425
|
+
*
|
|
2426
|
+
* @example Register a sending domain
|
|
2427
|
+
* const domain = await bird.domains.create({ domain: "mail.acme.com" });
|
|
2428
|
+
* console.log(domain.id, domain.status); // "dom_…", "pending"
|
|
2429
|
+
*/
|
|
2430
|
+
create(params, options) {
|
|
2431
|
+
return this.call("POST", options, ({ signal, headers }) => createDomain({
|
|
2432
|
+
client: this.client,
|
|
2433
|
+
body: params,
|
|
2434
|
+
headers,
|
|
2435
|
+
signal
|
|
2436
|
+
}));
|
|
2437
|
+
}
|
|
2438
|
+
/**
|
|
2439
|
+
* List the workspace's sending domains, newest first. `await` resolves the
|
|
2440
|
+
* first page; `for await` walks every domain across pages.
|
|
2441
|
+
*
|
|
2442
|
+
* @example
|
|
2443
|
+
* for await (const domain of bird.domains.list()) {
|
|
2444
|
+
* console.log(domain.id, domain.status);
|
|
2445
|
+
* }
|
|
2446
|
+
*/
|
|
2447
|
+
list(query, options) {
|
|
2448
|
+
return this.paginated("GET", options, ({ signal, headers }, cursor) => listDomains({
|
|
2449
|
+
client: this.client,
|
|
2450
|
+
query: {
|
|
2451
|
+
...query,
|
|
2452
|
+
starting_after: cursor ?? query?.starting_after
|
|
2453
|
+
},
|
|
2454
|
+
headers,
|
|
2455
|
+
signal
|
|
2456
|
+
}));
|
|
2457
|
+
}
|
|
2458
|
+
/**
|
|
2459
|
+
* Fetch a single sending domain by id, with its DNS records and their
|
|
2460
|
+
* per-record verification state.
|
|
2461
|
+
*
|
|
2462
|
+
* @example
|
|
2463
|
+
* const domain = await bird.domains.get("dom_01krdgeqcxet5s7t44vh8rt9mg");
|
|
2464
|
+
*/
|
|
2465
|
+
get(domainId, options) {
|
|
2466
|
+
return this.call("GET", options, ({ signal, headers }) => getDomain({
|
|
2467
|
+
client: this.client,
|
|
2468
|
+
path: { domain_id: domainId },
|
|
2469
|
+
headers,
|
|
2470
|
+
signal
|
|
2471
|
+
}));
|
|
2472
|
+
}
|
|
2473
|
+
/**
|
|
2474
|
+
* Update a sending domain. Only the fields you send change; `settings` apply
|
|
2475
|
+
* immediately, while `return_path`/`tracking`/`dkim` changes are staged until
|
|
2476
|
+
* their new DNS records verify.
|
|
2477
|
+
*
|
|
2478
|
+
* @example
|
|
2479
|
+
* await bird.domains.update("dom_01krdgeqcxet5s7t44vh8rt9mg", {
|
|
2480
|
+
* settings: { click_tracking: true, open_tracking: true },
|
|
2481
|
+
* tracking: { name: "links" },
|
|
2482
|
+
* });
|
|
2483
|
+
*/
|
|
2484
|
+
update(domainId, params, options) {
|
|
2485
|
+
return this.call("PATCH", options, ({ signal, headers }) => updateDomain({
|
|
2486
|
+
client: this.client,
|
|
2487
|
+
path: { domain_id: domainId },
|
|
2488
|
+
body: params,
|
|
2489
|
+
headers,
|
|
2490
|
+
signal
|
|
2491
|
+
}));
|
|
2492
|
+
}
|
|
2493
|
+
/**
|
|
2494
|
+
* Delete a sending domain. Mail already accepted still sends; you can no
|
|
2495
|
+
* longer send new mail from it.
|
|
2496
|
+
*
|
|
2497
|
+
* @example
|
|
2498
|
+
* await bird.domains.delete("dom_01krdgeqcxet5s7t44vh8rt9mg");
|
|
2499
|
+
*/
|
|
2500
|
+
delete(domainId, options) {
|
|
2501
|
+
return this.call("DELETE", options, ({ signal, headers }) => deleteDomain({
|
|
2502
|
+
client: this.client,
|
|
2503
|
+
path: { domain_id: domainId },
|
|
2504
|
+
headers,
|
|
2505
|
+
signal
|
|
2506
|
+
}));
|
|
2507
|
+
}
|
|
2508
|
+
/**
|
|
2509
|
+
* Trigger a fresh DNS check and return the refreshed domain with per-record
|
|
2510
|
+
* results. Safe to repeat while waiting for DNS to propagate.
|
|
2511
|
+
*
|
|
2512
|
+
* @example
|
|
2513
|
+
* const domain = await bird.domains.verify("dom_01krdgeqcxet5s7t44vh8rt9mg");
|
|
2514
|
+
* console.log(domain.status); // "verified" once DNS is in place
|
|
2515
|
+
*/
|
|
2516
|
+
verify(domainId, options) {
|
|
2517
|
+
return this.call("POST", options, ({ signal, headers }) => verifyDomain({
|
|
2518
|
+
client: this.client,
|
|
2519
|
+
path: { domain_id: domainId },
|
|
2520
|
+
headers,
|
|
2521
|
+
signal
|
|
2522
|
+
}));
|
|
2523
|
+
}
|
|
2524
|
+
};
|
|
2525
|
+
//#endregion
|
|
2306
2526
|
//#region src/resources/contactProperties.ts
|
|
2307
2527
|
var ContactPropertiesResource = class extends Resource {
|
|
2308
2528
|
/**
|
|
@@ -2922,6 +3142,8 @@ var BirdClient = class {
|
|
|
2922
3142
|
audiences;
|
|
2923
3143
|
/** Contact properties — `bird.contactProperties.create(...)`, `.list(...)`, `.archive(...)`, … */
|
|
2924
3144
|
contactProperties;
|
|
3145
|
+
/** Sending domains — `bird.domains.create(...)`, `.list(...)`, `.verify(...)`, … */
|
|
3146
|
+
domains;
|
|
2925
3147
|
/** Webhooks — `bird.webhooks.unwrap(payload, headers)` verifies an inbound delivery. */
|
|
2926
3148
|
webhooks;
|
|
2927
3149
|
constructor(options) {
|
|
@@ -2931,9 +3153,9 @@ var BirdClient = class {
|
|
|
2931
3153
|
this.#headers = {
|
|
2932
3154
|
...opts.defaultHeaders,
|
|
2933
3155
|
Authorization: `Bearer ${opts.apiKey}`,
|
|
2934
|
-
"User-Agent": `bird-sdk-js/0.
|
|
3156
|
+
"User-Agent": `bird-sdk-js/0.8.0`,
|
|
2935
3157
|
"Bird-Surface": "sdk-js",
|
|
2936
|
-
"Bird-Version": "0.
|
|
3158
|
+
"Bird-Version": "0.8.0"
|
|
2937
3159
|
};
|
|
2938
3160
|
const caller = detectCaller();
|
|
2939
3161
|
if (caller) this.#headers["Bird-Caller"] = caller;
|
|
@@ -2955,6 +3177,7 @@ var BirdClient = class {
|
|
|
2955
3177
|
this.contacts = new ContactsResource(this.core, this.#client);
|
|
2956
3178
|
this.audiences = new AudiencesResource(this.core, this.#client);
|
|
2957
3179
|
this.contactProperties = new ContactPropertiesResource(this.core, this.#client);
|
|
3180
|
+
this.domains = new DomainsResource(this.core, this.#client);
|
|
2958
3181
|
this.webhooks = new WebhooksResource(opts.webhooks);
|
|
2959
3182
|
}
|
|
2960
3183
|
/**
|