@messagebird/sdk 0.4.1 → 0.5.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 +70 -392
- package/dist/index.mjs +43 -318
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -89,6 +89,17 @@ interface ErrorNextAction {
|
|
|
89
89
|
/** Permission scope the recovery operation requires, when it is scoped. */
|
|
90
90
|
scope?: string;
|
|
91
91
|
}
|
|
92
|
+
/** One verification requirement blocking the action, with the flow that resolves it. */
|
|
93
|
+
interface UnmetGate {
|
|
94
|
+
/** Stable identifier for the verification requirement. */
|
|
95
|
+
slug: string;
|
|
96
|
+
/** Human-readable name of the verification requirement. */
|
|
97
|
+
name: string;
|
|
98
|
+
/** The requirement's current state. */
|
|
99
|
+
status: string;
|
|
100
|
+
/** How to resolve this requirement. */
|
|
101
|
+
remediation_kind: string;
|
|
102
|
+
}
|
|
92
103
|
/** Constructor fields shared by every API error, mapped from the wire body. */
|
|
93
104
|
interface BirdAPIErrorFields {
|
|
94
105
|
statusCode: number;
|
|
@@ -111,6 +122,8 @@ interface BirdAPIErrorFields {
|
|
|
111
122
|
remediation?: string;
|
|
112
123
|
/** Operations that resolve this error, in the order to try them (ADR-0073). */
|
|
113
124
|
next?: ErrorNextAction[];
|
|
125
|
+
/** Verification requirements blocking this action, when it is blocked pending verification. */
|
|
126
|
+
unmetGates?: UnmetGate[];
|
|
114
127
|
}
|
|
115
128
|
/** The server returned an error body. Base for every `type`-specific class. */
|
|
116
129
|
declare class BirdAPIError extends BirdError {
|
|
@@ -124,6 +137,7 @@ declare class BirdAPIError extends BirdError {
|
|
|
124
137
|
readonly vendorCode?: string;
|
|
125
138
|
readonly remediation?: string;
|
|
126
139
|
readonly next?: ErrorNextAction[];
|
|
140
|
+
readonly unmetGates?: UnmetGate[];
|
|
127
141
|
constructor(fields: BirdAPIErrorFields);
|
|
128
142
|
}
|
|
129
143
|
/** 401 — authentication failed or missing. */
|
|
@@ -265,10 +279,10 @@ type EventSmsUndeliveredData = EventSmsBase & {
|
|
|
265
279
|
error: SmsError;
|
|
266
280
|
};
|
|
267
281
|
/**
|
|
268
|
-
* Bird-stable failure reason. `invalid_destination` — the number is not assigned, ported out, or malformed. `unreachable` — handset off or out of coverage. `blocked_by_carrier` — the carrier filtered the message. `blocked_by_recipient` — the recipient device blocked the sender. `landline_unreachable` — the destination is a landline that does not accept SMS. `content_rejected` — the carrier rejected the content. `sender_unregistered` — the sender is not registered for the destination. `recipient_opted_out` — the recipient is on a suppression list. `provider_unavailable` — an upstream failure after retries. `unknown` — an unmapped failure.
|
|
282
|
+
* Bird-stable failure reason. `invalid_destination` — the number is not assigned, ported out, or malformed. `unreachable` — handset off or out of coverage. `blocked_by_carrier` — the carrier filtered the message. `blocked_by_recipient` — the recipient device blocked the sender. `landline_unreachable` — the destination is a landline that does not accept SMS. `content_rejected` — the carrier rejected the content. `sender_unregistered` — the sender is not registered for the destination. `recipient_opted_out` — the recipient is on a suppression list. `provider_unavailable` — an upstream failure after retries. `insufficient_balance` — the workspace wallet had insufficient balance to send the message. `unknown` — an unmapped failure.
|
|
269
283
|
*
|
|
270
284
|
*/
|
|
271
|
-
type SmsErrorCode = "invalid_destination" | "unreachable" | "blocked_by_carrier" | "blocked_by_recipient" | "landline_unreachable" | "content_rejected" | "sender_unregistered" | "recipient_opted_out" | "provider_unavailable" | "unknown";
|
|
285
|
+
type SmsErrorCode = "invalid_destination" | "unreachable" | "blocked_by_carrier" | "blocked_by_recipient" | "landline_unreachable" | "content_rejected" | "sender_unregistered" | "recipient_opted_out" | "provider_unavailable" | "insufficient_balance" | "unknown";
|
|
272
286
|
/**
|
|
273
287
|
* Failure detail for a message that could not be delivered or was rejected. Null when there is no failure.
|
|
274
288
|
*/
|
|
@@ -1422,12 +1436,22 @@ type EmailAddress = {
|
|
|
1422
1436
|
*/
|
|
1423
1437
|
type EmailAddressInput = string | EmailAddress;
|
|
1424
1438
|
type ContactId = string;
|
|
1425
|
-
|
|
1439
|
+
/**
|
|
1440
|
+
* Whether the template is a built-in Bird template (`system`) or one your workspace authored (`workspace`).
|
|
1441
|
+
*/
|
|
1442
|
+
type TemplateScope = "system" | "workspace";
|
|
1443
|
+
/**
|
|
1444
|
+
* A template's send-by handle — the stable reference used in place of the template id when sending. Lowercase letters, numbers, hyphens, and underscores; starts and ends with a letter or number.
|
|
1445
|
+
*
|
|
1446
|
+
*/
|
|
1447
|
+
type TemplateName = string;
|
|
1448
|
+
type SmsTemplateList = {
|
|
1426
1449
|
/**
|
|
1427
|
-
*
|
|
1450
|
+
* The templates available to your workspace. The catalogue is small and returned in full — this list is not paginated.
|
|
1428
1451
|
*/
|
|
1429
|
-
data: Array<
|
|
1452
|
+
data: Array<SmsTemplate>;
|
|
1430
1453
|
};
|
|
1454
|
+
type SmsTemplateVersionId = string;
|
|
1431
1455
|
/**
|
|
1432
1456
|
* A single variable slot a template fills in from the values supplied when sending. Shared across channels (SMS, email) so template introspection reads the same everywhere.
|
|
1433
1457
|
*
|
|
@@ -1452,232 +1476,6 @@ type TemplateVariable = {
|
|
|
1452
1476
|
*/
|
|
1453
1477
|
readonly constraint: string;
|
|
1454
1478
|
};
|
|
1455
|
-
type EmailTemplateId = string;
|
|
1456
|
-
type EmailTemplateVersionId = string;
|
|
1457
|
-
type EmailTemplateVersion = {
|
|
1458
|
-
/**
|
|
1459
|
-
* Template version ID.
|
|
1460
|
-
*/
|
|
1461
|
-
readonly id: EmailTemplateVersionId;
|
|
1462
|
-
/**
|
|
1463
|
-
* The template this version belongs to.
|
|
1464
|
-
*/
|
|
1465
|
-
readonly template_id: EmailTemplateId;
|
|
1466
|
-
/**
|
|
1467
|
-
* Sequential published-version number (1, 2, 3…). Null while the version is a draft.
|
|
1468
|
-
*/
|
|
1469
|
-
readonly version_number?: number | null;
|
|
1470
|
-
/**
|
|
1471
|
-
* Lifecycle status of this version.
|
|
1472
|
-
*/
|
|
1473
|
-
readonly status: "draft" | "published";
|
|
1474
|
-
/**
|
|
1475
|
-
* The version's revision counter.
|
|
1476
|
-
*/
|
|
1477
|
-
readonly revision: number;
|
|
1478
|
-
/**
|
|
1479
|
-
* The variable slots this version's content fills in from the values you supply when sending.
|
|
1480
|
-
*/
|
|
1481
|
-
readonly variables: Array<TemplateVariable>;
|
|
1482
|
-
/**
|
|
1483
|
-
* When this version was created.
|
|
1484
|
-
*/
|
|
1485
|
-
readonly created_at: string;
|
|
1486
|
-
/**
|
|
1487
|
-
* When this version was published, or null if it has not been published.
|
|
1488
|
-
*/
|
|
1489
|
-
readonly published_at?: string | null;
|
|
1490
|
-
};
|
|
1491
|
-
/**
|
|
1492
|
-
* Partial update of a template's metadata and its draft content. Only the fields you send are changed; the rest are left as-is. Include the draft `revision` you last read so concurrent edits are detected.
|
|
1493
|
-
*
|
|
1494
|
-
*/
|
|
1495
|
-
type EmailTemplateUpdate = {
|
|
1496
|
-
/**
|
|
1497
|
-
* The draft revision you last read (from the template's `revision` field). A stale value returns a conflict so you can reload and retry.
|
|
1498
|
-
*
|
|
1499
|
-
*/
|
|
1500
|
-
revision: number;
|
|
1501
|
-
/**
|
|
1502
|
-
* New workspace-unique slug handle. Must stay unique within the workspace. Lowercase letters, numbers, and hyphens.
|
|
1503
|
-
*
|
|
1504
|
-
*/
|
|
1505
|
-
name?: string;
|
|
1506
|
-
/**
|
|
1507
|
-
* New description of the template's purpose. Send null to clear it.
|
|
1508
|
-
*/
|
|
1509
|
-
description?: string | null;
|
|
1510
|
-
/**
|
|
1511
|
-
* New email subject line for the draft. Send null to clear it.
|
|
1512
|
-
*/
|
|
1513
|
-
subject?: string | null;
|
|
1514
|
-
/**
|
|
1515
|
-
* New HTML body — the source markup for the template's format.
|
|
1516
|
-
*/
|
|
1517
|
-
html?: string;
|
|
1518
|
-
/**
|
|
1519
|
-
* New plain-text body for the draft. Send null to clear it.
|
|
1520
|
-
*/
|
|
1521
|
-
text?: string | null;
|
|
1522
|
-
/**
|
|
1523
|
-
* Brand kit to apply to the draft.
|
|
1524
|
-
*/
|
|
1525
|
-
brand_kit_id?: BrandKitId;
|
|
1526
|
-
};
|
|
1527
|
-
type BrandKitId = string;
|
|
1528
|
-
type EmailTemplate = {
|
|
1529
|
-
/**
|
|
1530
|
-
* Template ID.
|
|
1531
|
-
*/
|
|
1532
|
-
readonly id: EmailTemplateId;
|
|
1533
|
-
/**
|
|
1534
|
-
* Workspace that owns the template.
|
|
1535
|
-
*/
|
|
1536
|
-
readonly workspace_id: WorkspaceId;
|
|
1537
|
-
/**
|
|
1538
|
-
* The template's workspace-unique slug handle. Pass it (or the id) as the template reference when sending.
|
|
1539
|
-
*/
|
|
1540
|
-
name: string;
|
|
1541
|
-
/**
|
|
1542
|
-
* Optional description of the template's purpose. Null when unset.
|
|
1543
|
-
*/
|
|
1544
|
-
description?: string | null;
|
|
1545
|
-
scope: TemplateScope;
|
|
1546
|
-
category: EmailTemplateCategory;
|
|
1547
|
-
source: EmailTemplateSource;
|
|
1548
|
-
/**
|
|
1549
|
-
* The variable slots this template's current draft fills in from the values you supply when sending.
|
|
1550
|
-
*/
|
|
1551
|
-
readonly variables: Array<TemplateVariable>;
|
|
1552
|
-
/**
|
|
1553
|
-
* The current editable draft version.
|
|
1554
|
-
*/
|
|
1555
|
-
readonly draft_version_id: EmailTemplateVersionId;
|
|
1556
|
-
/**
|
|
1557
|
-
* The currently published version, or null if the template has never been published.
|
|
1558
|
-
*/
|
|
1559
|
-
readonly published_version_id?: EmailTemplateVersionId | null;
|
|
1560
|
-
/**
|
|
1561
|
-
* The draft's revision counter. Send it back on the next update to detect concurrent edits.
|
|
1562
|
-
*/
|
|
1563
|
-
readonly revision: number;
|
|
1564
|
-
/**
|
|
1565
|
-
* The draft's email subject line. Null when unset.
|
|
1566
|
-
*/
|
|
1567
|
-
subject?: string | null;
|
|
1568
|
-
/**
|
|
1569
|
-
* The draft's HTML body. Null when unset.
|
|
1570
|
-
*/
|
|
1571
|
-
html?: string | null;
|
|
1572
|
-
/**
|
|
1573
|
-
* The draft's plain-text body. Null when unset.
|
|
1574
|
-
*/
|
|
1575
|
-
text?: string | null;
|
|
1576
|
-
/**
|
|
1577
|
-
* The brand kit applied to the draft, or null if none.
|
|
1578
|
-
*/
|
|
1579
|
-
readonly brand_kit_id?: BrandKitId | null;
|
|
1580
|
-
/**
|
|
1581
|
-
* When the template was created.
|
|
1582
|
-
*/
|
|
1583
|
-
readonly created_at: string;
|
|
1584
|
-
/**
|
|
1585
|
-
* When the template was last modified.
|
|
1586
|
-
*/
|
|
1587
|
-
readonly updated_at: string;
|
|
1588
|
-
};
|
|
1589
|
-
/**
|
|
1590
|
-
* The authoring format the template is written in. Fixed at creation.
|
|
1591
|
-
*/
|
|
1592
|
-
type EmailTemplateSource = "liquid" | "handlebars" | "html";
|
|
1593
|
-
/**
|
|
1594
|
-
* Whether the template is transactional or marketing email.
|
|
1595
|
-
*/
|
|
1596
|
-
type EmailTemplateCategory = "transactional" | "marketing";
|
|
1597
|
-
/**
|
|
1598
|
-
* Whether the template is a built-in Bird template (`system`) or one your workspace authored (`workspace`).
|
|
1599
|
-
*/
|
|
1600
|
-
type TemplateScope = "system" | "workspace";
|
|
1601
|
-
/**
|
|
1602
|
-
* Parameters for creating an email template and its initial draft.
|
|
1603
|
-
*/
|
|
1604
|
-
type EmailTemplateCreate = {
|
|
1605
|
-
/**
|
|
1606
|
-
* The template's workspace-unique slug handle — a stable alternative to the template ID when sending by template. Lowercase letters, numbers, and hyphens.
|
|
1607
|
-
*
|
|
1608
|
-
*/
|
|
1609
|
-
name: string;
|
|
1610
|
-
/**
|
|
1611
|
-
* Optional description of the template's purpose.
|
|
1612
|
-
*/
|
|
1613
|
-
description?: string;
|
|
1614
|
-
category: EmailTemplateCategory;
|
|
1615
|
-
/**
|
|
1616
|
-
* The authoring format the template is written in, fixed at creation. `liquid` currently supports variable substitution only (e.g. `{{ first_name }}`); filters, tags, and control flow are not yet supported — fuller Liquid support is coming soon.
|
|
1617
|
-
*
|
|
1618
|
-
*/
|
|
1619
|
-
source: EmailTemplateSource;
|
|
1620
|
-
/**
|
|
1621
|
-
* The email subject line for the initial draft.
|
|
1622
|
-
*/
|
|
1623
|
-
subject?: string;
|
|
1624
|
-
/**
|
|
1625
|
-
* The HTML body — the source markup for the chosen format.
|
|
1626
|
-
*/
|
|
1627
|
-
html?: string;
|
|
1628
|
-
/**
|
|
1629
|
-
* The optional plain-text body.
|
|
1630
|
-
*/
|
|
1631
|
-
text?: string;
|
|
1632
|
-
/**
|
|
1633
|
-
* Optional brand kit to apply to the draft.
|
|
1634
|
-
*/
|
|
1635
|
-
brand_kit_id?: BrandKitId;
|
|
1636
|
-
};
|
|
1637
|
-
type EmailTemplateSummary = {
|
|
1638
|
-
/**
|
|
1639
|
-
* Template ID.
|
|
1640
|
-
*/
|
|
1641
|
-
readonly id: EmailTemplateId;
|
|
1642
|
-
/**
|
|
1643
|
-
* Workspace that owns the template.
|
|
1644
|
-
*/
|
|
1645
|
-
readonly workspace_id: WorkspaceId;
|
|
1646
|
-
/**
|
|
1647
|
-
* The template's workspace-unique slug handle. Pass it (or the id) as the template reference when sending.
|
|
1648
|
-
*/
|
|
1649
|
-
name: string;
|
|
1650
|
-
/**
|
|
1651
|
-
* Optional description of the template's purpose. Null when unset.
|
|
1652
|
-
*/
|
|
1653
|
-
description?: string | null;
|
|
1654
|
-
scope: TemplateScope;
|
|
1655
|
-
category: EmailTemplateCategory;
|
|
1656
|
-
source: EmailTemplateSource;
|
|
1657
|
-
/**
|
|
1658
|
-
* The current editable draft version.
|
|
1659
|
-
*/
|
|
1660
|
-
readonly draft_version_id: EmailTemplateVersionId;
|
|
1661
|
-
/**
|
|
1662
|
-
* The currently published version, or null if never published.
|
|
1663
|
-
*/
|
|
1664
|
-
readonly published_version_id?: EmailTemplateVersionId | null;
|
|
1665
|
-
/**
|
|
1666
|
-
* When the template was created.
|
|
1667
|
-
*/
|
|
1668
|
-
readonly created_at: string;
|
|
1669
|
-
/**
|
|
1670
|
-
* When the template was last modified.
|
|
1671
|
-
*/
|
|
1672
|
-
readonly updated_at: string;
|
|
1673
|
-
};
|
|
1674
|
-
type SmsTemplateList = {
|
|
1675
|
-
/**
|
|
1676
|
-
* The templates available to your workspace. The catalogue is small and returned in full — this list is not paginated.
|
|
1677
|
-
*/
|
|
1678
|
-
data: Array<SmsTemplate>;
|
|
1679
|
-
};
|
|
1680
|
-
type SmsTemplateVersionId = string;
|
|
1681
1479
|
/**
|
|
1682
1480
|
* Content classification. Drives opt-out (STOP) policy, quiet-hours, and per-country compliance.
|
|
1683
1481
|
*/
|
|
@@ -1691,7 +1489,7 @@ type SmsTemplate = {
|
|
|
1691
1489
|
/**
|
|
1692
1490
|
* The template's stable handle. Pass it (or the id) as the template reference when sending.
|
|
1693
1491
|
*/
|
|
1694
|
-
readonly name:
|
|
1492
|
+
readonly name: TemplateName;
|
|
1695
1493
|
/**
|
|
1696
1494
|
* Human-readable description of what the template is for.
|
|
1697
1495
|
*/
|
|
@@ -1908,7 +1706,7 @@ type SmsTemplateSend = unknown & {
|
|
|
1908
1706
|
* The template to send, by its name handle (for example `bird_otp_verification`). Browse the available templates and their variables with the templates endpoint.
|
|
1909
1707
|
*
|
|
1910
1708
|
*/
|
|
1911
|
-
name?:
|
|
1709
|
+
name?: TemplateName;
|
|
1912
1710
|
/**
|
|
1913
1711
|
* Language tag (BCP 47, for example `fr` or `pt-BR`) selecting the localized body. Falls back to the closest available language, then English, when the exact tag is not stocked. Omit for English.
|
|
1914
1712
|
*
|
|
@@ -2084,26 +1882,6 @@ type AudienceCreateRequest = {
|
|
|
2084
1882
|
*/
|
|
2085
1883
|
type?: "static" | "dynamic" | "external";
|
|
2086
1884
|
};
|
|
2087
|
-
type AudienceId = string;
|
|
2088
|
-
type Audience = {
|
|
2089
|
-
/**
|
|
2090
|
-
* Audience ID.
|
|
2091
|
-
*/
|
|
2092
|
-
readonly id: AudienceId;
|
|
2093
|
-
/**
|
|
2094
|
-
* Display name for the audience.
|
|
2095
|
-
*/
|
|
2096
|
-
name: string;
|
|
2097
|
-
/**
|
|
2098
|
-
* Longer description of who this audience is.
|
|
2099
|
-
*/
|
|
2100
|
-
description?: string | null;
|
|
2101
|
-
/**
|
|
2102
|
-
* How the audience's recipients are determined. `static` audiences have an explicit member list you manage via the API. `dynamic` and `external` are preview values and currently unavailable — creating an audience with either returns an error.
|
|
2103
|
-
*
|
|
2104
|
-
*/
|
|
2105
|
-
type: "static" | "dynamic" | "external";
|
|
2106
|
-
} & Timestamps;
|
|
2107
1885
|
type ContactPropertyUpdateRequest = {
|
|
2108
1886
|
/**
|
|
2109
1887
|
* Default used when a contact has no value for this property and the template does not supply an inline fallback. A string, number, or boolean matching the declared type (strings up to 500 characters). Set to null to remove the fallback.
|
|
@@ -2147,6 +1925,26 @@ type ContactProperty = {
|
|
|
2147
1925
|
*/
|
|
2148
1926
|
readonly archived?: boolean;
|
|
2149
1927
|
} & Timestamps;
|
|
1928
|
+
type AudienceId = string;
|
|
1929
|
+
type Audience = {
|
|
1930
|
+
/**
|
|
1931
|
+
* Audience ID.
|
|
1932
|
+
*/
|
|
1933
|
+
readonly id: AudienceId;
|
|
1934
|
+
/**
|
|
1935
|
+
* Display name for the audience.
|
|
1936
|
+
*/
|
|
1937
|
+
name: string;
|
|
1938
|
+
/**
|
|
1939
|
+
* Longer description of who this audience is.
|
|
1940
|
+
*/
|
|
1941
|
+
description?: string | null;
|
|
1942
|
+
/**
|
|
1943
|
+
* How the audience's recipients are determined. `static` audiences have an explicit member list you manage via the API. `dynamic` and `external` are preview values and currently unavailable — creating an audience with either returns an error.
|
|
1944
|
+
*
|
|
1945
|
+
*/
|
|
1946
|
+
type: "static" | "dynamic" | "external";
|
|
1947
|
+
} & Timestamps;
|
|
2150
1948
|
type ContactUpdateRequest = {
|
|
2151
1949
|
/**
|
|
2152
1950
|
* New email address for the contact. Trimmed and lowercased before it is stored and checked for uniqueness. Must not be in use by another contact in the workspace.
|
|
@@ -2271,6 +2069,7 @@ type EmailMessageBatchItem = {
|
|
|
2271
2069
|
*
|
|
2272
2070
|
*/
|
|
2273
2071
|
type EmailMessageBatchRequest = Array<EmailMessageSendRequest>;
|
|
2072
|
+
type EmailTemplateId = string;
|
|
2274
2073
|
type EmailTemplateSend = unknown & {
|
|
2275
2074
|
/**
|
|
2276
2075
|
* The template to send, by its id.
|
|
@@ -2279,7 +2078,7 @@ type EmailTemplateSend = unknown & {
|
|
|
2279
2078
|
/**
|
|
2280
2079
|
* The template to send, by its name handle (for example `welcome-email`).
|
|
2281
2080
|
*/
|
|
2282
|
-
name?:
|
|
2081
|
+
name?: TemplateName;
|
|
2283
2082
|
/**
|
|
2284
2083
|
* Values for the template's variables, keyed by variable name. A token with no matching value renders empty. Cap: 16 KB serialized.
|
|
2285
2084
|
*
|
|
@@ -2381,7 +2180,8 @@ type EmailMessageSendRequest = {
|
|
|
2381
2180
|
*/
|
|
2382
2181
|
attachments?: Array<EmailAttachment>;
|
|
2383
2182
|
/**
|
|
2384
|
-
*
|
|
2183
|
+
* Schedule the message to send at a future time instead of immediately. Must be at least 30 seconds and at most 30 days ahead — outside that range the request is rejected with `422`. The message returns with status `accepted` and shows as `scheduled` on reads until it sends; cancel it before then with the message cancel endpoint. Scheduled sends count against your plan's monthly scheduled-email allowance; exceeding it is rejected with a `422`.
|
|
2184
|
+
*
|
|
2385
2185
|
*/
|
|
2386
2186
|
scheduled_at?: string;
|
|
2387
2187
|
/**
|
|
@@ -2669,6 +2469,10 @@ type ListAudiencesData = {
|
|
|
2669
2469
|
body?: never;
|
|
2670
2470
|
path?: never;
|
|
2671
2471
|
query?: {
|
|
2472
|
+
/**
|
|
2473
|
+
* Case-insensitive substring match against the audience's name.
|
|
2474
|
+
*/
|
|
2475
|
+
search?: string;
|
|
2672
2476
|
/**
|
|
2673
2477
|
* Maximum number of items to return per page.
|
|
2674
2478
|
*/
|
|
@@ -2785,37 +2589,6 @@ type ListSmsTemplatesData = {
|
|
|
2785
2589
|
};
|
|
2786
2590
|
url: "/v1/sms/templates";
|
|
2787
2591
|
};
|
|
2788
|
-
type ListEmailTemplatesData = {
|
|
2789
|
-
body?: never;
|
|
2790
|
-
path?: never;
|
|
2791
|
-
query?: {
|
|
2792
|
-
/**
|
|
2793
|
-
* Filter by template category.
|
|
2794
|
-
*/
|
|
2795
|
-
category?: EmailTemplateCategory;
|
|
2796
|
-
/**
|
|
2797
|
-
* Filter by authoring format.
|
|
2798
|
-
*/
|
|
2799
|
-
source?: EmailTemplateSource;
|
|
2800
|
-
/**
|
|
2801
|
-
* Case-insensitive search matching the template's name or description (substring).
|
|
2802
|
-
*/
|
|
2803
|
-
name?: string;
|
|
2804
|
-
/**
|
|
2805
|
-
* Maximum number of items to return per page.
|
|
2806
|
-
*/
|
|
2807
|
-
limit?: number;
|
|
2808
|
-
/**
|
|
2809
|
-
* Cursor from the `next_cursor` field of a previous list response. Returns items immediately after the cursor position in the current sort order.
|
|
2810
|
-
*/
|
|
2811
|
-
starting_after?: string;
|
|
2812
|
-
/**
|
|
2813
|
-
* Cursor from the `prev_cursor` field of a previous list response. Returns items immediately before the cursor position in the current sort order.
|
|
2814
|
-
*/
|
|
2815
|
-
ending_before?: string;
|
|
2816
|
-
};
|
|
2817
|
-
url: "/v1/email/templates";
|
|
2818
|
-
};
|
|
2819
2592
|
//#endregion
|
|
2820
2593
|
//#region src/generated/core/auth.gen.d.ts
|
|
2821
2594
|
type AuthToken = string | undefined;
|
|
@@ -3269,6 +3042,16 @@ declare class EmailResource<D extends EmailChannelDefaults | undefined = undefin
|
|
|
3269
3042
|
* msg.bounced_count;
|
|
3270
3043
|
*/
|
|
3271
3044
|
get(messageId: string, options?: RequestOptions): APIPromise<EmailMessage>;
|
|
3045
|
+
/**
|
|
3046
|
+
* Cancel a message scheduled with `scheduled_at` before it sends. Only a
|
|
3047
|
+
* message that is still scheduled can be canceled; one that already started
|
|
3048
|
+
* sending — or was previously canceled — rejects with a conflict error.
|
|
3049
|
+
* Canceling does not return consumed scheduled-send quota.
|
|
3050
|
+
*
|
|
3051
|
+
* @example
|
|
3052
|
+
* await bird.email.cancel("em_abc123");
|
|
3053
|
+
*/
|
|
3054
|
+
cancel(messageId: string, options?: RequestOptions): APIPromise<void>;
|
|
3272
3055
|
/**
|
|
3273
3056
|
* List messages, newest first. `await` resolves the first page; `for await`
|
|
3274
3057
|
* walks every message across all pages.
|
|
@@ -3499,109 +3282,6 @@ declare class ContactsResource extends Resource {
|
|
|
3499
3282
|
batch(params: ContactBatchParams, options?: RequestOptions): APIPromise<ContactUpsertResult>;
|
|
3500
3283
|
}
|
|
3501
3284
|
//#endregion
|
|
3502
|
-
//#region src/resources/emailTemplates.d.ts
|
|
3503
|
-
/** Body for `bird.emailTemplates.create`. */
|
|
3504
|
-
type EmailTemplateCreateParams = EmailTemplateCreate;
|
|
3505
|
-
/** Body for `bird.emailTemplates.update` — a partial patch of the draft. */
|
|
3506
|
-
type EmailTemplateUpdateParams = EmailTemplateUpdate;
|
|
3507
|
-
/** Filters and cursor params for `bird.emailTemplates.list`. */
|
|
3508
|
-
type EmailTemplateListQuery = NonNullable<ListEmailTemplatesData["query"]>;
|
|
3509
|
-
declare class EmailTemplatesResource extends Resource {
|
|
3510
|
-
/**
|
|
3511
|
-
* Create a template and its initial editable draft. Pick the authoring format
|
|
3512
|
-
* with `source` (`liquid`, `handlebars`, or `html`); the name must be unique
|
|
3513
|
-
* in the workspace or the call throws a `BirdConflictError`.
|
|
3514
|
-
*
|
|
3515
|
-
* @example Create a template
|
|
3516
|
-
* const tpl = await bird.emailTemplates.create({
|
|
3517
|
-
* name: "welcome-email",
|
|
3518
|
-
* description: "Welcome",
|
|
3519
|
-
* category: "transactional",
|
|
3520
|
-
* source: "handlebars",
|
|
3521
|
-
* subject: "Welcome, {{ first_name }}!",
|
|
3522
|
-
* html: "<h1>Hi {{ first_name }}</h1>",
|
|
3523
|
-
* });
|
|
3524
|
-
* console.log(tpl.id, tpl.revision); // "emt_…", 0
|
|
3525
|
-
*/
|
|
3526
|
-
create(params: EmailTemplateCreateParams, options?: RequestOptions): APIPromise<EmailTemplate>;
|
|
3527
|
-
/**
|
|
3528
|
-
* List the workspace's templates, newest first. `await` resolves the first
|
|
3529
|
-
* page; `for await` walks every template across all pages. Filter by
|
|
3530
|
-
* `category`, `source`, or a case-insensitive `name` prefix.
|
|
3531
|
-
*
|
|
3532
|
-
* @example Iterate every template, or take one page
|
|
3533
|
-
* for await (const tpl of bird.emailTemplates.list({ category: "transactional" })) {
|
|
3534
|
-
* console.log(tpl.id, tpl.name);
|
|
3535
|
-
* }
|
|
3536
|
-
* const page = await bird.emailTemplates.list({ limit: 50 }); // page.data, page.next_cursor
|
|
3537
|
-
*/
|
|
3538
|
-
list(query?: EmailTemplateListQuery, options?: RequestOptions): PaginatedPromise<EmailTemplateSummary>;
|
|
3539
|
-
/**
|
|
3540
|
-
* Fetch a template with its current draft content (subject, HTML, text), the
|
|
3541
|
-
* draft `revision`, and its draft/published version ids.
|
|
3542
|
-
*
|
|
3543
|
-
* @example
|
|
3544
|
-
* const tpl = await bird.emailTemplates.get("emt_abc123");
|
|
3545
|
-
* tpl.subject;
|
|
3546
|
-
* tpl.published_version_id; // null until first publish
|
|
3547
|
-
*/
|
|
3548
|
-
get(templateId: string, options?: RequestOptions): APIPromise<EmailTemplate>;
|
|
3549
|
-
/**
|
|
3550
|
-
* Update a template's metadata and draft content. Only the fields you send
|
|
3551
|
-
* change. Pass the draft `revision` you last read; if another edit landed
|
|
3552
|
-
* first the call throws a `BirdConflictError` — reload and retry.
|
|
3553
|
-
*
|
|
3554
|
-
* @example Edit the draft, guarded by the revision you read
|
|
3555
|
-
* const tpl = await bird.emailTemplates.get("emt_abc123");
|
|
3556
|
-
* const updated = await bird.emailTemplates.update("emt_abc123", {
|
|
3557
|
-
* revision: tpl.revision,
|
|
3558
|
-
* subject: "Welcome aboard, {{ first_name }}!",
|
|
3559
|
-
* });
|
|
3560
|
-
*/
|
|
3561
|
-
update(templateId: string, params: EmailTemplateUpdateParams, options?: RequestOptions): APIPromise<EmailTemplate>;
|
|
3562
|
-
/**
|
|
3563
|
-
* Delete a template and all its versions. The name becomes available for
|
|
3564
|
-
* reuse in the workspace.
|
|
3565
|
-
*
|
|
3566
|
-
* @example
|
|
3567
|
-
* await bird.emailTemplates.delete("emt_abc123");
|
|
3568
|
-
*/
|
|
3569
|
-
delete(templateId: string, options?: RequestOptions): APIPromise<void>;
|
|
3570
|
-
/**
|
|
3571
|
-
* Publish the current draft as a new immutable, numbered version and make it
|
|
3572
|
-
* the live version used by sends. The draft stays editable. The draft must
|
|
3573
|
-
* have a subject and a body, or the call throws.
|
|
3574
|
-
*
|
|
3575
|
-
* @example Publish, then send by template
|
|
3576
|
-
* const version = await bird.emailTemplates.publish("emt_abc123");
|
|
3577
|
-
* console.log(version.version_number); // 1, 2, 3…
|
|
3578
|
-
* await bird.email.send({
|
|
3579
|
-
* from: "hello@acme.com",
|
|
3580
|
-
* to: ["alice@example.com"],
|
|
3581
|
-
* template: { id: "emt_abc123", parameters: { first_name: "Alice" } },
|
|
3582
|
-
* });
|
|
3583
|
-
*/
|
|
3584
|
-
publish(templateId: string, options?: RequestOptions): APIPromise<EmailTemplateVersion>;
|
|
3585
|
-
/**
|
|
3586
|
-
* List every version of a template — the current draft plus all published
|
|
3587
|
-
* versions — newest first. Returns the full set in one response (`.data`);
|
|
3588
|
-
* this list is not paginated.
|
|
3589
|
-
*
|
|
3590
|
-
* @example
|
|
3591
|
-
* const { data } = await bird.emailTemplates.listVersions("emt_abc123");
|
|
3592
|
-
* for (const v of data) console.log(v.version_number, v.status);
|
|
3593
|
-
*/
|
|
3594
|
-
listVersions(templateId: string, options?: RequestOptions): APIPromise<EmailTemplateVersionList>;
|
|
3595
|
-
/**
|
|
3596
|
-
* Fetch a single version of a template.
|
|
3597
|
-
*
|
|
3598
|
-
* @example
|
|
3599
|
-
* const version = await bird.emailTemplates.getVersion("emt_abc123", "emv_def456");
|
|
3600
|
-
* version.status; // "draft" | "published"
|
|
3601
|
-
*/
|
|
3602
|
-
getVersion(templateId: string, versionId: string, options?: RequestOptions): APIPromise<EmailTemplateVersion>;
|
|
3603
|
-
}
|
|
3604
|
-
//#endregion
|
|
3605
3285
|
//#region src/resources/sms.d.ts
|
|
3606
3286
|
/** Body for `bird.sms.send` — supply either `text` (with `category`) or `template`. */
|
|
3607
3287
|
type SmsSendParams = SmsMessageSendRequest;
|
|
@@ -3820,8 +3500,6 @@ declare class BirdClient<const O extends BirdClientOptions = BirdClientOptions>
|
|
|
3820
3500
|
protected readonly core: BirdHTTPClient;
|
|
3821
3501
|
/** The email channel — `bird.email.send(...)`, `.get(...)`, `.list(...)`. */
|
|
3822
3502
|
readonly email: EmailResource<EmailDefaultsOf<O>>;
|
|
3823
|
-
/** Email templates — `bird.emailTemplates.create(...)`, `.list(...)`, `.publish(...)`, … */
|
|
3824
|
-
readonly emailTemplates: EmailTemplatesResource;
|
|
3825
3503
|
/** The SMS channel — `bird.sms.send(...)`, `.get(...)`, `.list(...)`. */
|
|
3826
3504
|
readonly sms: SmsResource;
|
|
3827
3505
|
/** SMS templates — `bird.smsTemplates.list(...)`, `.get(...)`. */
|
|
@@ -3900,5 +3578,5 @@ declare const WebhookEventType: {
|
|
|
3900
3578
|
/** A known webhook event type value. */
|
|
3901
3579
|
type WebhookEventTypeValue = (typeof WebhookEventType)[keyof typeof WebhookEventType];
|
|
3902
3580
|
//#endregion
|
|
3903
|
-
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
|
|
3581
|
+
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, WebhookEventType, type WebhookEventTypeValue, type WebhookHeaders, type WebhookOptions, baseUrlForRegion, regionFromApiKey };
|
|
3904
3582
|
//# sourceMappingURL=index.d.mts.map
|