@messagebird/sdk 0.2.2 → 0.3.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.ts +1043 -124
- package/dist/index.js +524 -12
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -284,11 +284,11 @@ type SmsError = {
|
|
|
284
284
|
occurred_at: string;
|
|
285
285
|
} | null;
|
|
286
286
|
/**
|
|
287
|
-
* Structured key/value
|
|
288
|
-
* Tag count and per-tag size are capped to keep per-send tag payloads small — see
|
|
287
|
+
* 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`.
|
|
288
|
+
* 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.
|
|
289
289
|
*
|
|
290
290
|
*/
|
|
291
|
-
type
|
|
291
|
+
type Tag = {
|
|
292
292
|
/**
|
|
293
293
|
* Tag name. ASCII letters, digits, underscore, and hyphen only. Case-sensitive. Maximum 32 characters.
|
|
294
294
|
*
|
|
@@ -326,7 +326,7 @@ type EventSmsBase = {
|
|
|
326
326
|
* Tags provided on the send request, echoed on every event for the message so you can route and correlate without an extra lookup. Null when the message carried no tags.
|
|
327
327
|
*
|
|
328
328
|
*/
|
|
329
|
-
tags: Array<
|
|
329
|
+
tags: Array<Tag> | null;
|
|
330
330
|
/**
|
|
331
331
|
* The metadata object provided on the send request, echoed on every event for the message so you can correlate events with your own records. Null when the message carried no metadata.
|
|
332
332
|
*
|
|
@@ -508,23 +508,6 @@ type EventEmailSuppressionCreated = {
|
|
|
508
508
|
* Payload of the email.unsubscribed event.
|
|
509
509
|
*/
|
|
510
510
|
type EventEmailUnsubscribedData = EventEmailBase;
|
|
511
|
-
/**
|
|
512
|
-
* Structured key/value tag attached to an email send. 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`.
|
|
513
|
-
* Tag count and per-tag size are capped to keep per-send tag payloads small — see EmailMessageSendRequest for the array maximum.
|
|
514
|
-
*
|
|
515
|
-
*/
|
|
516
|
-
type EmailTag = {
|
|
517
|
-
/**
|
|
518
|
-
* Tag name. ASCII letters, digits, underscore, and hyphen only. Case-sensitive. Maximum 32 characters.
|
|
519
|
-
*
|
|
520
|
-
*/
|
|
521
|
-
name: string;
|
|
522
|
-
/**
|
|
523
|
-
* Tag value. ASCII letters, digits, underscore, and hyphen only. Case-sensitive. Maximum 64 characters.
|
|
524
|
-
*
|
|
525
|
-
*/
|
|
526
|
-
value: string;
|
|
527
|
-
};
|
|
528
511
|
/**
|
|
529
512
|
* Envelope position of a recipient on an outbound email event.
|
|
530
513
|
*/
|
|
@@ -559,7 +542,7 @@ type EventEmailBase = {
|
|
|
559
542
|
* Tags provided on the send request, echoed on every event for the send so you can route and correlate without an extra lookup. Null when the send carried no tags.
|
|
560
543
|
*
|
|
561
544
|
*/
|
|
562
|
-
tags: Array<
|
|
545
|
+
tags: Array<Tag> | null;
|
|
563
546
|
/**
|
|
564
547
|
* The metadata object provided on the send request, echoed on every event for the send so you can correlate events with your own records. Null when the send carried no metadata.
|
|
565
548
|
*
|
|
@@ -607,7 +590,7 @@ type EventEmailMessageBase = {
|
|
|
607
590
|
* Tags provided on the send request, echoed on the event so you can route and correlate without an extra lookup. Null when the send carried no tags.
|
|
608
591
|
*
|
|
609
592
|
*/
|
|
610
|
-
tags: Array<
|
|
593
|
+
tags: Array<Tag> | null;
|
|
611
594
|
/**
|
|
612
595
|
* The metadata object provided on the send request, echoed on the event so you can correlate events with your own records. Null when the send carried no metadata.
|
|
613
596
|
*
|
|
@@ -998,106 +981,724 @@ type EventEmailAccepted = {
|
|
|
998
981
|
*/
|
|
999
982
|
type: "email.accepted";
|
|
1000
983
|
/**
|
|
1001
|
-
* Time Bird accepted the send.
|
|
984
|
+
* Time Bird accepted the send.
|
|
985
|
+
*/
|
|
986
|
+
timestamp: string;
|
|
987
|
+
data: EventEmailAcceptedData;
|
|
988
|
+
};
|
|
989
|
+
/**
|
|
990
|
+
* A sending domain completed DNS verification successfully. Payload schema not yet finalized.
|
|
991
|
+
*/
|
|
992
|
+
type EventDomainVerified = {
|
|
993
|
+
/**
|
|
994
|
+
* Event type.
|
|
995
|
+
*/
|
|
996
|
+
type: "domain.verified";
|
|
997
|
+
/**
|
|
998
|
+
* When the event occurred.
|
|
999
|
+
*/
|
|
1000
|
+
timestamp: string;
|
|
1001
|
+
/**
|
|
1002
|
+
* Event payload. The fields for this event are not yet finalized.
|
|
1003
|
+
*/
|
|
1004
|
+
data: {
|
|
1005
|
+
[key: string]: never;
|
|
1006
|
+
};
|
|
1007
|
+
};
|
|
1008
|
+
/**
|
|
1009
|
+
* A sending domain failed DNS verification. Payload schema not yet finalized.
|
|
1010
|
+
*/
|
|
1011
|
+
type EventDomainFailed = {
|
|
1012
|
+
/**
|
|
1013
|
+
* Event type.
|
|
1014
|
+
*/
|
|
1015
|
+
type: "domain.failed";
|
|
1016
|
+
/**
|
|
1017
|
+
* When the event occurred.
|
|
1018
|
+
*/
|
|
1019
|
+
timestamp: string;
|
|
1020
|
+
/**
|
|
1021
|
+
* Event payload. The fields for this event are not yet finalized.
|
|
1022
|
+
*/
|
|
1023
|
+
data: {
|
|
1024
|
+
[key: string]: never;
|
|
1025
|
+
};
|
|
1026
|
+
};
|
|
1027
|
+
/**
|
|
1028
|
+
* Discriminated union of every webhook event the Bird platform emits.
|
|
1029
|
+
* Each variant is the full delivery body: `type` names the event, `timestamp` is when the event occurred, and `data` carries the event-specific payload. The `type` property selects the variant — SDKs that consume this schema (openapi-typescript, oapi-codegen) generate a narrowed union keyed on `type`, so customer code can switch on the event id and access the variant-specific payload fields without casting.
|
|
1030
|
+
* Delivery metadata (the event id and per-attempt signature headers) rides in HTTP headers per Standard Webhooks and is handled by the SDK's webhook verification helper, which returns one of these variants.
|
|
1031
|
+
*
|
|
1032
|
+
*/
|
|
1033
|
+
type WebhookEvent = ({
|
|
1034
|
+
type: "domain.failed";
|
|
1035
|
+
} & EventDomainFailed) | ({
|
|
1036
|
+
type: "domain.verified";
|
|
1037
|
+
} & EventDomainVerified) | ({
|
|
1038
|
+
type: "email.accepted";
|
|
1039
|
+
} & EventEmailAccepted) | ({
|
|
1040
|
+
type: "email.bounced";
|
|
1041
|
+
} & EventEmailBounced) | ({
|
|
1042
|
+
type: "email.canceled";
|
|
1043
|
+
} & EventEmailCanceled) | ({
|
|
1044
|
+
type: "email.clicked";
|
|
1045
|
+
} & EventEmailClicked) | ({
|
|
1046
|
+
type: "email.complained";
|
|
1047
|
+
} & EventEmailComplained) | ({
|
|
1048
|
+
type: "email.deferred";
|
|
1049
|
+
} & EventEmailDeferred) | ({
|
|
1050
|
+
type: "email.delivered";
|
|
1051
|
+
} & EventEmailDelivered) | ({
|
|
1052
|
+
type: "email.list_unsubscribed";
|
|
1053
|
+
} & EventEmailListUnsubscribed) | ({
|
|
1054
|
+
type: "email.opened";
|
|
1055
|
+
} & EventEmailOpened) | ({
|
|
1056
|
+
type: "email.out_of_band_bounce";
|
|
1057
|
+
} & EventEmailOutOfBandBounce) | ({
|
|
1058
|
+
type: "email.processed";
|
|
1059
|
+
} & EventEmailProcessed) | ({
|
|
1060
|
+
type: "email.received";
|
|
1061
|
+
} & EventEmailReceived) | ({
|
|
1062
|
+
type: "email.rejected";
|
|
1063
|
+
} & EventEmailRejected) | ({
|
|
1064
|
+
type: "email.scheduled";
|
|
1065
|
+
} & EventEmailScheduled) | ({
|
|
1066
|
+
type: "email.unsubscribed";
|
|
1067
|
+
} & EventEmailUnsubscribed) | ({
|
|
1068
|
+
type: "email_suppression.created";
|
|
1069
|
+
} & EventEmailSuppressionCreated) | ({
|
|
1070
|
+
type: "sms.accepted";
|
|
1071
|
+
} & EventSmsAccepted) | ({
|
|
1072
|
+
type: "sms.delivered";
|
|
1073
|
+
} & EventSmsDelivered) | ({
|
|
1074
|
+
type: "sms.expired";
|
|
1075
|
+
} & EventSmsExpired) | ({
|
|
1076
|
+
type: "sms.failed";
|
|
1077
|
+
} & EventSmsFailed) | ({
|
|
1078
|
+
type: "sms.rejected";
|
|
1079
|
+
} & EventSmsRejected) | ({
|
|
1080
|
+
type: "sms.sent";
|
|
1081
|
+
} & EventSmsSent) | ({
|
|
1082
|
+
type: "sms.undelivered";
|
|
1083
|
+
} & EventSmsUndelivered);
|
|
1084
|
+
/**
|
|
1085
|
+
* An email address with an optional display name.
|
|
1086
|
+
*/
|
|
1087
|
+
type EmailAddress = {
|
|
1088
|
+
/**
|
|
1089
|
+
* Email address.
|
|
1090
|
+
*/
|
|
1091
|
+
email: string;
|
|
1092
|
+
/**
|
|
1093
|
+
* Display name shown alongside the address in mail clients.
|
|
1094
|
+
*/
|
|
1095
|
+
name?: string;
|
|
1096
|
+
};
|
|
1097
|
+
type EmailTemplateVersionList = {
|
|
1098
|
+
/**
|
|
1099
|
+
* All versions of the template, newest first.
|
|
1100
|
+
*/
|
|
1101
|
+
data: Array<EmailTemplateVersion>;
|
|
1102
|
+
};
|
|
1103
|
+
/**
|
|
1104
|
+
* 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.
|
|
1105
|
+
*
|
|
1106
|
+
*/
|
|
1107
|
+
type TemplateVariable = {
|
|
1108
|
+
/**
|
|
1109
|
+
* The parameters key this slot is filled with.
|
|
1110
|
+
*/
|
|
1111
|
+
readonly key: string;
|
|
1112
|
+
/**
|
|
1113
|
+
* The value type this slot accepts. Open enum — treat any unrecognized value as a future type rather than an error. SMS templates use the typed slots (`code`, `amount`, …); email templates use `text`.
|
|
1114
|
+
*
|
|
1115
|
+
*/
|
|
1116
|
+
readonly type: string;
|
|
1117
|
+
/**
|
|
1118
|
+
* Whether the slot must be supplied when sending. Advisory for email templates, where a missing value renders as empty rather than rejecting the send.
|
|
1119
|
+
*
|
|
1120
|
+
*/
|
|
1121
|
+
readonly required: boolean;
|
|
1122
|
+
/**
|
|
1123
|
+
* A human-readable description of the accepted values.
|
|
1124
|
+
*/
|
|
1125
|
+
readonly constraint: string;
|
|
1126
|
+
};
|
|
1127
|
+
type EmailTemplateId = string;
|
|
1128
|
+
type EmailTemplateVersionId = string;
|
|
1129
|
+
type EmailTemplateVersion = {
|
|
1130
|
+
/**
|
|
1131
|
+
* Template version ID.
|
|
1132
|
+
*/
|
|
1133
|
+
readonly id: EmailTemplateVersionId;
|
|
1134
|
+
/**
|
|
1135
|
+
* The template this version belongs to.
|
|
1136
|
+
*/
|
|
1137
|
+
readonly template_id: EmailTemplateId;
|
|
1138
|
+
/**
|
|
1139
|
+
* Sequential published-version number (1, 2, 3…). Null while the version is a draft.
|
|
1140
|
+
*/
|
|
1141
|
+
readonly version_number?: number | null;
|
|
1142
|
+
/**
|
|
1143
|
+
* Lifecycle status of this version.
|
|
1144
|
+
*/
|
|
1145
|
+
readonly status: "draft" | "published";
|
|
1146
|
+
/**
|
|
1147
|
+
* The version's revision counter.
|
|
1148
|
+
*/
|
|
1149
|
+
readonly revision: number;
|
|
1150
|
+
/**
|
|
1151
|
+
* The variable slots this version's content fills in from the values you supply when sending.
|
|
1152
|
+
*/
|
|
1153
|
+
readonly variables: Array<TemplateVariable>;
|
|
1154
|
+
/**
|
|
1155
|
+
* When this version was created.
|
|
1156
|
+
*/
|
|
1157
|
+
readonly created_at: string;
|
|
1158
|
+
/**
|
|
1159
|
+
* When this version was published, or null if it has not been published.
|
|
1160
|
+
*/
|
|
1161
|
+
readonly published_at?: string | null;
|
|
1162
|
+
};
|
|
1163
|
+
/**
|
|
1164
|
+
* 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.
|
|
1165
|
+
*
|
|
1166
|
+
*/
|
|
1167
|
+
type EmailTemplateUpdate = {
|
|
1168
|
+
/**
|
|
1169
|
+
* The draft revision you last read (from the template's `revision` field). A stale value returns a conflict so you can reload and retry.
|
|
1170
|
+
*
|
|
1171
|
+
*/
|
|
1172
|
+
revision: number;
|
|
1173
|
+
/**
|
|
1174
|
+
* New template name. Must stay unique within the workspace.
|
|
1175
|
+
*/
|
|
1176
|
+
name?: string;
|
|
1177
|
+
/**
|
|
1178
|
+
* New workspace-unique slug handle for send-by-template. Send null to clear it. Lowercase letters, numbers, and hyphens.
|
|
1179
|
+
*
|
|
1180
|
+
*/
|
|
1181
|
+
alias?: string | null;
|
|
1182
|
+
/**
|
|
1183
|
+
* New description of the template's purpose. Send null to clear it.
|
|
1184
|
+
*/
|
|
1185
|
+
description?: string | null;
|
|
1186
|
+
/**
|
|
1187
|
+
* New email subject line for the draft. Send null to clear it.
|
|
1188
|
+
*/
|
|
1189
|
+
subject?: string | null;
|
|
1190
|
+
/**
|
|
1191
|
+
* New HTML body — the source markup for the template's format.
|
|
1192
|
+
*/
|
|
1193
|
+
html?: string;
|
|
1194
|
+
/**
|
|
1195
|
+
* New plain-text body for the draft. Send null to clear it.
|
|
1196
|
+
*/
|
|
1197
|
+
text?: string | null;
|
|
1198
|
+
/**
|
|
1199
|
+
* Brand kit to apply to the draft.
|
|
1200
|
+
*/
|
|
1201
|
+
brand_kit_id?: BrandKitId;
|
|
1202
|
+
};
|
|
1203
|
+
type BrandKitId = string;
|
|
1204
|
+
type EmailTemplate = {
|
|
1205
|
+
/**
|
|
1206
|
+
* Template ID.
|
|
1207
|
+
*/
|
|
1208
|
+
readonly id: EmailTemplateId;
|
|
1209
|
+
/**
|
|
1210
|
+
* Workspace that owns the template.
|
|
1211
|
+
*/
|
|
1212
|
+
readonly workspace_id: WorkspaceId;
|
|
1213
|
+
/**
|
|
1214
|
+
* Human-readable template name, unique within the workspace.
|
|
1215
|
+
*/
|
|
1216
|
+
name: string;
|
|
1217
|
+
/**
|
|
1218
|
+
* The template's workspace-unique slug handle for send-by-template, or null if unset.
|
|
1219
|
+
*/
|
|
1220
|
+
alias?: string | null;
|
|
1221
|
+
/**
|
|
1222
|
+
* Optional description of the template's purpose. Null when unset.
|
|
1223
|
+
*/
|
|
1224
|
+
description?: string | null;
|
|
1225
|
+
scope: TemplateScope;
|
|
1226
|
+
category: EmailTemplateCategory;
|
|
1227
|
+
source: EmailTemplateSource;
|
|
1228
|
+
/**
|
|
1229
|
+
* The variable slots this template's current draft fills in from the values you supply when sending.
|
|
1230
|
+
*/
|
|
1231
|
+
readonly variables: Array<TemplateVariable>;
|
|
1232
|
+
/**
|
|
1233
|
+
* The current editable draft version.
|
|
1234
|
+
*/
|
|
1235
|
+
readonly draft_version_id: EmailTemplateVersionId;
|
|
1236
|
+
/**
|
|
1237
|
+
* The currently published version, or null if the template has never been published.
|
|
1238
|
+
*/
|
|
1239
|
+
readonly published_version_id?: EmailTemplateVersionId | null;
|
|
1240
|
+
/**
|
|
1241
|
+
* The draft's revision counter. Send it back on the next update to detect concurrent edits.
|
|
1242
|
+
*/
|
|
1243
|
+
readonly revision: number;
|
|
1244
|
+
/**
|
|
1245
|
+
* The draft's email subject line. Null when unset.
|
|
1246
|
+
*/
|
|
1247
|
+
subject?: string | null;
|
|
1248
|
+
/**
|
|
1249
|
+
* The draft's HTML body. Null when unset.
|
|
1250
|
+
*/
|
|
1251
|
+
html?: string | null;
|
|
1252
|
+
/**
|
|
1253
|
+
* The draft's plain-text body. Null when unset.
|
|
1254
|
+
*/
|
|
1255
|
+
text?: string | null;
|
|
1256
|
+
/**
|
|
1257
|
+
* The brand kit applied to the draft, or null if none.
|
|
1258
|
+
*/
|
|
1259
|
+
readonly brand_kit_id?: BrandKitId | null;
|
|
1260
|
+
/**
|
|
1261
|
+
* When the template was created.
|
|
1262
|
+
*/
|
|
1263
|
+
readonly created_at: string;
|
|
1264
|
+
/**
|
|
1265
|
+
* When the template was last modified.
|
|
1266
|
+
*/
|
|
1267
|
+
readonly updated_at: string;
|
|
1268
|
+
};
|
|
1269
|
+
/**
|
|
1270
|
+
* The authoring format the template is written in. Fixed at creation.
|
|
1271
|
+
*/
|
|
1272
|
+
type EmailTemplateSource = "liquid" | "handlebars" | "html";
|
|
1273
|
+
/**
|
|
1274
|
+
* Whether the template is transactional or marketing email.
|
|
1275
|
+
*/
|
|
1276
|
+
type EmailTemplateCategory = "transactional" | "marketing";
|
|
1277
|
+
/**
|
|
1278
|
+
* Whether the template is a built-in Bird template (`system`) or one your workspace authored (`workspace`).
|
|
1279
|
+
*/
|
|
1280
|
+
type TemplateScope = "system" | "workspace";
|
|
1281
|
+
/**
|
|
1282
|
+
* Parameters for creating an email template and its initial draft.
|
|
1283
|
+
*/
|
|
1284
|
+
type EmailTemplateCreate = {
|
|
1285
|
+
/**
|
|
1286
|
+
* Human-readable template name, unique within the workspace.
|
|
1287
|
+
*/
|
|
1288
|
+
name: string;
|
|
1289
|
+
/**
|
|
1290
|
+
* Optional workspace-unique slug handle for the template — a stable alternative to the template ID when sending by template. Lowercase letters, numbers, and hyphens.
|
|
1291
|
+
*
|
|
1292
|
+
*/
|
|
1293
|
+
alias?: string;
|
|
1294
|
+
/**
|
|
1295
|
+
* Optional description of the template's purpose.
|
|
1296
|
+
*/
|
|
1297
|
+
description?: string;
|
|
1298
|
+
category: EmailTemplateCategory;
|
|
1299
|
+
/**
|
|
1300
|
+
* 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.
|
|
1301
|
+
*
|
|
1302
|
+
*/
|
|
1303
|
+
source: EmailTemplateSource;
|
|
1304
|
+
/**
|
|
1305
|
+
* The email subject line for the initial draft.
|
|
1306
|
+
*/
|
|
1307
|
+
subject?: string;
|
|
1308
|
+
/**
|
|
1309
|
+
* The HTML body — the source markup for the chosen format.
|
|
1310
|
+
*/
|
|
1311
|
+
html?: string;
|
|
1312
|
+
/**
|
|
1313
|
+
* The optional plain-text body.
|
|
1314
|
+
*/
|
|
1315
|
+
text?: string;
|
|
1316
|
+
/**
|
|
1317
|
+
* Optional brand kit to apply to the draft.
|
|
1318
|
+
*/
|
|
1319
|
+
brand_kit_id?: BrandKitId;
|
|
1320
|
+
};
|
|
1321
|
+
type EmailTemplateSummary = {
|
|
1322
|
+
/**
|
|
1323
|
+
* Template ID.
|
|
1324
|
+
*/
|
|
1325
|
+
readonly id: EmailTemplateId;
|
|
1326
|
+
/**
|
|
1327
|
+
* Workspace that owns the template.
|
|
1328
|
+
*/
|
|
1329
|
+
readonly workspace_id: WorkspaceId;
|
|
1330
|
+
/**
|
|
1331
|
+
* Human-readable template name, unique within the workspace.
|
|
1332
|
+
*/
|
|
1333
|
+
name: string;
|
|
1334
|
+
/**
|
|
1335
|
+
* The template's workspace-unique slug handle for send-by-template, or null if unset.
|
|
1336
|
+
*/
|
|
1337
|
+
alias?: string | null;
|
|
1338
|
+
/**
|
|
1339
|
+
* Optional description of the template's purpose. Null when unset.
|
|
1340
|
+
*/
|
|
1341
|
+
description?: string | null;
|
|
1342
|
+
scope: TemplateScope;
|
|
1343
|
+
category: EmailTemplateCategory;
|
|
1344
|
+
source: EmailTemplateSource;
|
|
1345
|
+
/**
|
|
1346
|
+
* The current editable draft version.
|
|
1347
|
+
*/
|
|
1348
|
+
readonly draft_version_id: EmailTemplateVersionId;
|
|
1349
|
+
/**
|
|
1350
|
+
* The currently published version, or null if never published.
|
|
1351
|
+
*/
|
|
1352
|
+
readonly published_version_id?: EmailTemplateVersionId | null;
|
|
1353
|
+
/**
|
|
1354
|
+
* When the template was created.
|
|
1355
|
+
*/
|
|
1356
|
+
readonly created_at: string;
|
|
1357
|
+
/**
|
|
1358
|
+
* When the template was last modified.
|
|
1359
|
+
*/
|
|
1360
|
+
readonly updated_at: string;
|
|
1361
|
+
};
|
|
1362
|
+
type SmsTemplateList = {
|
|
1363
|
+
/**
|
|
1364
|
+
* The templates available to your workspace. The catalogue is small and returned in full — this list is not paginated.
|
|
1365
|
+
*/
|
|
1366
|
+
data: Array<SmsTemplate>;
|
|
1367
|
+
};
|
|
1368
|
+
type SmsTemplateVersionId = string;
|
|
1369
|
+
/**
|
|
1370
|
+
* Content classification. Drives opt-out (STOP) policy, quiet-hours, and per-country compliance.
|
|
1371
|
+
*/
|
|
1372
|
+
type SmsMessageCategory = "transactional" | "marketing" | "authentication" | "service";
|
|
1373
|
+
type SmsTemplateId = string;
|
|
1374
|
+
type SmsTemplate = {
|
|
1375
|
+
/**
|
|
1376
|
+
* Unique identifier for the template.
|
|
1377
|
+
*/
|
|
1378
|
+
readonly id: SmsTemplateId;
|
|
1379
|
+
/**
|
|
1380
|
+
* Human-readable description of what the template is for.
|
|
1381
|
+
*/
|
|
1382
|
+
readonly name: string;
|
|
1383
|
+
/**
|
|
1384
|
+
* The template's stable handle. Pass it (or the id) as the template reference when sending.
|
|
1385
|
+
*/
|
|
1386
|
+
readonly alias: string;
|
|
1387
|
+
scope: TemplateScope;
|
|
1388
|
+
/**
|
|
1389
|
+
* Content classification applied to messages sent from this template.
|
|
1390
|
+
*/
|
|
1391
|
+
readonly category: SmsMessageCategory;
|
|
1392
|
+
/**
|
|
1393
|
+
* The template body in its default language, shown for preview.
|
|
1394
|
+
*/
|
|
1395
|
+
readonly body: string;
|
|
1396
|
+
/**
|
|
1397
|
+
* The typed slots this template fills in from the values you supply when sending.
|
|
1398
|
+
*/
|
|
1399
|
+
readonly variables: Array<TemplateVariable>;
|
|
1400
|
+
/**
|
|
1401
|
+
* The languages this template is available in, as BCP-47 tags.
|
|
1402
|
+
*/
|
|
1403
|
+
readonly available_locales: Array<string>;
|
|
1404
|
+
/**
|
|
1405
|
+
* The template's lifecycle state. Built-in templates are always `active`.
|
|
1406
|
+
*/
|
|
1407
|
+
readonly status: "active" | "draft" | "pending" | "approved" | "rejected";
|
|
1408
|
+
/**
|
|
1409
|
+
* The current editable draft version. Always null today — SMS templates are not yet versioned; present for parity with email templates.
|
|
1410
|
+
*/
|
|
1411
|
+
readonly draft_version_id: SmsTemplateVersionId | null;
|
|
1412
|
+
/**
|
|
1413
|
+
* The currently published version, or null if the template has never been published. Always null today — SMS templates are not yet versioned; present for parity with email templates.
|
|
1414
|
+
*/
|
|
1415
|
+
readonly published_version_id?: SmsTemplateVersionId | null;
|
|
1416
|
+
/**
|
|
1417
|
+
* The draft's revision counter. Always null today — SMS templates are not yet versioned; present for parity with email templates.
|
|
1418
|
+
*/
|
|
1419
|
+
readonly revision: number | null;
|
|
1420
|
+
/**
|
|
1421
|
+
* When the template was created. Null for built-in templates.
|
|
1422
|
+
*/
|
|
1423
|
+
readonly created_at: string | null;
|
|
1424
|
+
/**
|
|
1425
|
+
* When the template was last updated. Null for built-in templates.
|
|
1426
|
+
*/
|
|
1427
|
+
readonly updated_at: string | null;
|
|
1428
|
+
};
|
|
1429
|
+
type SmsMessageBatchResponse = {
|
|
1430
|
+
/**
|
|
1431
|
+
* One entry per message in the batch, in submission order.
|
|
1432
|
+
*/
|
|
1433
|
+
data: Array<SmsMessage>;
|
|
1434
|
+
/**
|
|
1435
|
+
* Aggregate result for the batch.
|
|
1436
|
+
*/
|
|
1437
|
+
summary: SmsBatchSummary;
|
|
1438
|
+
};
|
|
1439
|
+
/**
|
|
1440
|
+
* Aggregate result for an SMS batch.
|
|
1441
|
+
*/
|
|
1442
|
+
type SmsBatchSummary = {
|
|
1443
|
+
/**
|
|
1444
|
+
* Number of messages accepted in the batch.
|
|
1445
|
+
*/
|
|
1446
|
+
accepted_count: number;
|
|
1447
|
+
};
|
|
1448
|
+
/**
|
|
1449
|
+
* Per-component cost breakdown. Returned on single-message reads; omitted from list rows.
|
|
1450
|
+
*/
|
|
1451
|
+
type SmsCostBreakdown = {
|
|
1452
|
+
/**
|
|
1453
|
+
* Per-segment price as a decimal string.
|
|
1454
|
+
*/
|
|
1455
|
+
per_segment: string;
|
|
1456
|
+
/**
|
|
1457
|
+
* Number of billable segments.
|
|
1458
|
+
*/
|
|
1459
|
+
segments: number;
|
|
1460
|
+
/**
|
|
1461
|
+
* ISO 3166-1 alpha-2 destination country the price was resolved for.
|
|
1462
|
+
*/
|
|
1463
|
+
country_code: string;
|
|
1464
|
+
/**
|
|
1465
|
+
* Carrier surcharge component as a decimal string (for example US 10DLC fees). `0.0000` when none applies.
|
|
1466
|
+
*/
|
|
1467
|
+
carrier_surcharge: string;
|
|
1468
|
+
};
|
|
1469
|
+
/**
|
|
1470
|
+
* ISO 4217 three-letter currency code.
|
|
1471
|
+
*/
|
|
1472
|
+
type CurrencyCode = string;
|
|
1473
|
+
/**
|
|
1474
|
+
* Cost of the message. Null until the message has been priced; the cost is populated as the message is processed, not at the moment it is accepted.
|
|
1475
|
+
*/
|
|
1476
|
+
type SmsCost = {
|
|
1477
|
+
/**
|
|
1478
|
+
* ISO 4217 currency code for the cost amount. Omitted when the cost is not denominated in a currency (for example a zero-priced internal send).
|
|
1479
|
+
*/
|
|
1480
|
+
readonly currency_code?: CurrencyCode;
|
|
1481
|
+
/**
|
|
1482
|
+
* Total cost as a decimal string — the per-segment rate multiplied by the segment count, plus any surcharges.
|
|
1483
|
+
*/
|
|
1484
|
+
readonly amount: string;
|
|
1485
|
+
/**
|
|
1486
|
+
* Per-component cost breakdown. Returned on single-message reads; omitted from list rows.
|
|
1487
|
+
*/
|
|
1488
|
+
breakdown?: SmsCostBreakdown;
|
|
1489
|
+
} | null;
|
|
1490
|
+
/**
|
|
1491
|
+
* Segment breakdown for the message body. Segment count drives billing.
|
|
1492
|
+
*/
|
|
1493
|
+
type SmsSegments = {
|
|
1494
|
+
/**
|
|
1495
|
+
* Number of segments the body is split into. Each segment is a billable unit.
|
|
1496
|
+
*/
|
|
1497
|
+
readonly count: number;
|
|
1498
|
+
/**
|
|
1499
|
+
* Encoding used for the body. `GSM_7BIT` fits 160 characters in a single segment (153 per part when multi-segment); `UCS2` is used when the body contains any character outside the GSM 03.38 alphabet (emoji, CJK, some accented characters) and fits 70 characters in a single segment (67 per part when multi-segment).
|
|
1500
|
+
*
|
|
1501
|
+
*/
|
|
1502
|
+
readonly encoding: "GSM_7BIT" | "UCS2";
|
|
1503
|
+
/**
|
|
1504
|
+
* Character count of the body under the selected encoding.
|
|
1505
|
+
*/
|
|
1506
|
+
readonly characters: number;
|
|
1507
|
+
};
|
|
1508
|
+
/**
|
|
1509
|
+
* Delivery status. `scheduled` means the message is queued to send at a future time and has not been dispatched yet. `accepted` means Bird accepted the request and it is awaiting handoff to the carrier network. `sent` means it was handed to the carrier and is awaiting a delivery receipt. `delivered` is confirmed delivery. `undelivered` is a non-permanent non-delivery (handset off, content blocked). `failed` is a terminal permanent failure. `rejected` means Bird refused it before reaching the carrier. `canceled` means a scheduled message was canceled before it was sent. `expired` means the validity period elapsed without a terminal receipt. `received` applies to inbound messages.
|
|
1510
|
+
*
|
|
1511
|
+
*/
|
|
1512
|
+
type SmsMessageStatus = "scheduled" | "accepted" | "sent" | "delivered" | "undelivered" | "failed" | "rejected" | "canceled" | "expired" | "received";
|
|
1513
|
+
type SmsMessage = {
|
|
1514
|
+
/**
|
|
1515
|
+
* Message ID.
|
|
1516
|
+
*/
|
|
1517
|
+
readonly id: SmsMessageId;
|
|
1518
|
+
/**
|
|
1519
|
+
* Whether the message was sent from a Bird sender (`outbound`) or received from a subscriber (`inbound`).
|
|
1520
|
+
*/
|
|
1521
|
+
readonly direction: "outbound" | "inbound";
|
|
1522
|
+
readonly status: SmsMessageStatus;
|
|
1523
|
+
/**
|
|
1524
|
+
* Recipient phone number in E.164 format.
|
|
1525
|
+
*/
|
|
1526
|
+
to: string;
|
|
1527
|
+
/**
|
|
1528
|
+
* Sender the message was sent from — an E.164 number, an alphanumeric sender ID, or a short code.
|
|
1529
|
+
*/
|
|
1530
|
+
from: string;
|
|
1531
|
+
/**
|
|
1532
|
+
* Message body.
|
|
1533
|
+
*/
|
|
1534
|
+
text: string;
|
|
1535
|
+
/**
|
|
1536
|
+
* Content classification supplied on the send. Null for inbound messages.
|
|
1537
|
+
*/
|
|
1538
|
+
category?: SmsMessageCategory | null;
|
|
1539
|
+
/**
|
|
1540
|
+
* Segment breakdown for the body.
|
|
1541
|
+
*/
|
|
1542
|
+
segments: SmsSegments;
|
|
1543
|
+
/**
|
|
1544
|
+
* Cost of the message. Null until the message has been priced.
|
|
1545
|
+
*/
|
|
1546
|
+
cost?: SmsCost;
|
|
1547
|
+
/**
|
|
1548
|
+
* Structured `{name, value}` filter labels applied to this message.
|
|
1549
|
+
*/
|
|
1550
|
+
tags?: Array<Tag>;
|
|
1551
|
+
/**
|
|
1552
|
+
* Arbitrary JSON metadata stored on the message and echoed in webhook payloads.
|
|
1553
|
+
*/
|
|
1554
|
+
metadata?: {
|
|
1555
|
+
[key: string]: unknown;
|
|
1556
|
+
};
|
|
1557
|
+
/**
|
|
1558
|
+
* How long, in seconds, Bird keeps trying to deliver before the message transitions to `expired`.
|
|
1559
|
+
*/
|
|
1560
|
+
readonly validity_period?: number;
|
|
1561
|
+
/**
|
|
1562
|
+
* Carrier that handled the message, when known. Populated once a delivery receipt identifies it.
|
|
1563
|
+
*/
|
|
1564
|
+
readonly carrier?: string | null;
|
|
1565
|
+
/**
|
|
1566
|
+
* Mobile country code and mobile network code of the carrier, when known.
|
|
1567
|
+
*/
|
|
1568
|
+
readonly mcc_mnc?: string | null;
|
|
1569
|
+
/**
|
|
1570
|
+
* Failure detail on a terminally failed or rejected message. Null otherwise.
|
|
1571
|
+
*/
|
|
1572
|
+
last_error?: SmsError;
|
|
1573
|
+
/**
|
|
1574
|
+
* When the message was accepted (outbound) or received (inbound).
|
|
1575
|
+
*/
|
|
1576
|
+
readonly created_at: string;
|
|
1577
|
+
/**
|
|
1578
|
+
* When the message was handed to the carrier. Null until then.
|
|
1579
|
+
*/
|
|
1580
|
+
readonly sent_at?: string | null;
|
|
1581
|
+
/**
|
|
1582
|
+
* When delivery was confirmed. Null until then.
|
|
1583
|
+
*/
|
|
1584
|
+
readonly delivered_at?: string | null;
|
|
1585
|
+
};
|
|
1586
|
+
/**
|
|
1587
|
+
* Batch of SMS message send requests. All items are validated before any are queued.
|
|
1588
|
+
*/
|
|
1589
|
+
type SmsMessageBatchRequest = Array<SmsMessageSendRequest>;
|
|
1590
|
+
type SmsTemplateSend = unknown & {
|
|
1591
|
+
/**
|
|
1592
|
+
* The template to send, by its id.
|
|
1593
|
+
*/
|
|
1594
|
+
id?: SmsTemplateId;
|
|
1595
|
+
/**
|
|
1596
|
+
* The template to send, by its alias handle (for example `bird_otp_verification`). Browse the available templates and their variables with the templates endpoint.
|
|
1597
|
+
*
|
|
1598
|
+
*/
|
|
1599
|
+
alias?: string;
|
|
1600
|
+
/**
|
|
1601
|
+
* 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.
|
|
1602
|
+
*
|
|
1603
|
+
*/
|
|
1604
|
+
locale?: string;
|
|
1605
|
+
/**
|
|
1606
|
+
* Values for the template's variables, keyed by variable name. The accepted keys and their formats are fixed per template — see the template's `variables` on the templates endpoint. Every required variable must be supplied, and no undeclared key may be present. Cap: 16 KB serialized.
|
|
1607
|
+
*
|
|
1608
|
+
*/
|
|
1609
|
+
parameters?: {
|
|
1610
|
+
[key: string]: unknown;
|
|
1611
|
+
};
|
|
1612
|
+
};
|
|
1613
|
+
type SmsMessageSendRequest = unknown & {
|
|
1614
|
+
/**
|
|
1615
|
+
* Recipient phone number in E.164 format (for example `+15551234567`). One recipient per message.
|
|
1616
|
+
*/
|
|
1617
|
+
to: string;
|
|
1618
|
+
/**
|
|
1619
|
+
* Sender to send from: an E.164 number (`+15557654321`), an alphanumeric sender ID (up to 11 characters, for example `MyBrand`), or a short code (5–6 digits). When omitted, Bird selects an eligible sender for you.
|
|
1620
|
+
*
|
|
1621
|
+
*/
|
|
1622
|
+
from?: string;
|
|
1623
|
+
/**
|
|
1624
|
+
* Free-text message body. Required unless `template` is supplied (the two are mutually exclusive). At least 1 character, up to a 12-segment cap (roughly 1836 GSM-7 or 804 UCS-2 characters). Bird does not truncate; a body exceeding 12 segments is rejected with a 422. The limit is on segment count, not characters, because GSM-7 and UCS-2 encodings differ in characters per segment.
|
|
1625
|
+
*
|
|
1626
|
+
*/
|
|
1627
|
+
text?: string;
|
|
1628
|
+
/**
|
|
1629
|
+
* Content classification. Drives opt-out (STOP) policy, quiet-hours, and per-country compliance. Required on a free-text send; omit it on a template send, where the category is derived from the template.
|
|
1630
|
+
*
|
|
1631
|
+
*/
|
|
1632
|
+
category?: SmsMessageCategory;
|
|
1633
|
+
/**
|
|
1634
|
+
* Preview feature — how long, in seconds (60–172800), Bird keeps trying to deliver before the message transitions to `expired`. Currently unavailable; supplying this field returns `422 unsupported_feature`.
|
|
1635
|
+
*
|
|
1636
|
+
*/
|
|
1637
|
+
validity_period?: number;
|
|
1638
|
+
/**
|
|
1639
|
+
* Structured `{name, value}` labels for filtering and analytics. Tags become first-class query dimensions: filter the list endpoint by tag name, slice analytics by tag, and surface in webhook payloads. Maximum 20 tags per send. Use tags for low-cardinality dimensions (`category`, `experiment_variant`). For arbitrary structured context you do not need as a filter dimension, use `metadata` instead.
|
|
1640
|
+
*
|
|
1641
|
+
*/
|
|
1642
|
+
tags?: Array<Tag>;
|
|
1643
|
+
/**
|
|
1644
|
+
* Arbitrary JSON object stored on the message, returned on API reads, and echoed in webhook payloads. Maximum 2 KB serialized. Use metadata for per-send context like internal IDs and foreign keys. For low-cardinality filterable labels, use `tags` instead.
|
|
1645
|
+
*
|
|
1646
|
+
*/
|
|
1647
|
+
metadata?: {
|
|
1648
|
+
[key: string]: unknown;
|
|
1649
|
+
};
|
|
1650
|
+
/**
|
|
1651
|
+
* Preview feature — multimedia (MMS) attachments. Currently unavailable; supplying this field returns `422 unsupported_feature`.
|
|
1652
|
+
*/
|
|
1653
|
+
media_urls?: Array<string>;
|
|
1654
|
+
/**
|
|
1655
|
+
* Preview feature — sender selection from a messaging profile pool. Currently unavailable; supplying this field returns `422 unsupported_feature`.
|
|
1656
|
+
*/
|
|
1657
|
+
messaging_profile_id?: string;
|
|
1658
|
+
/**
|
|
1659
|
+
* Preview feature — send-later scheduling. Currently unavailable; supplying this field returns `422 unsupported_feature`.
|
|
1660
|
+
*/
|
|
1661
|
+
scheduled_at?: string;
|
|
1662
|
+
/**
|
|
1663
|
+
* Send using a stored template instead of free text. Mutually exclusive with `text`; the message category is derived from the template, so `from`, `category`, and `media_urls` are not accepted alongside it.
|
|
1664
|
+
*
|
|
1665
|
+
*/
|
|
1666
|
+
template?: SmsTemplateSend;
|
|
1667
|
+
/**
|
|
1668
|
+
* Preview feature — broadcast correlation. Currently unavailable; supplying this field returns `422 unsupported_feature`.
|
|
1002
1669
|
*/
|
|
1003
|
-
|
|
1004
|
-
data: EventEmailAcceptedData;
|
|
1005
|
-
};
|
|
1006
|
-
/**
|
|
1007
|
-
* A sending domain completed DNS verification successfully. Payload schema not yet finalized.
|
|
1008
|
-
*/
|
|
1009
|
-
type EventDomainVerified = {
|
|
1670
|
+
broadcast_id?: string;
|
|
1010
1671
|
/**
|
|
1011
|
-
*
|
|
1672
|
+
* Preview feature — campaign correlation for analytics. Currently unavailable; supplying this field returns `422 unsupported_feature`.
|
|
1012
1673
|
*/
|
|
1013
|
-
|
|
1674
|
+
campaign_id?: string;
|
|
1014
1675
|
/**
|
|
1015
|
-
*
|
|
1676
|
+
* Preview feature — audience-targeted sends. Currently unavailable; supplying this field returns `422 unsupported_feature`.
|
|
1016
1677
|
*/
|
|
1017
|
-
|
|
1678
|
+
audience_id?: string;
|
|
1018
1679
|
/**
|
|
1019
|
-
*
|
|
1680
|
+
* Preview feature — contact-targeted sends. Currently unavailable; supplying this field returns `422 unsupported_feature`.
|
|
1020
1681
|
*/
|
|
1021
|
-
|
|
1022
|
-
[key: string]: never;
|
|
1023
|
-
};
|
|
1024
|
-
};
|
|
1025
|
-
/**
|
|
1026
|
-
* A sending domain failed DNS verification. Payload schema not yet finalized.
|
|
1027
|
-
*/
|
|
1028
|
-
type EventDomainFailed = {
|
|
1682
|
+
contact_id?: string;
|
|
1029
1683
|
/**
|
|
1030
|
-
*
|
|
1684
|
+
* Preview feature — topic-gated sends. Currently unavailable; supplying this field returns `422 unsupported_feature`.
|
|
1031
1685
|
*/
|
|
1032
|
-
|
|
1686
|
+
topic_id?: string;
|
|
1033
1687
|
/**
|
|
1034
|
-
*
|
|
1688
|
+
* Preview feature — per-segment price ceiling. Currently unavailable; supplying this field returns `422 unsupported_feature`.
|
|
1035
1689
|
*/
|
|
1036
|
-
|
|
1690
|
+
max_price_per_segment?: number;
|
|
1037
1691
|
/**
|
|
1038
|
-
*
|
|
1692
|
+
* Preview feature — per-recipient substitution for batch sends. Currently unavailable; supplying this field returns `422 unsupported_feature`.
|
|
1039
1693
|
*/
|
|
1040
|
-
|
|
1041
|
-
[key: string]:
|
|
1694
|
+
personalization?: {
|
|
1695
|
+
[key: string]: unknown;
|
|
1042
1696
|
};
|
|
1697
|
+
/**
|
|
1698
|
+
* Preview feature — link click tracking. Defaults to `false`. Currently unavailable; setting this to `true` returns `422 unsupported_feature`.
|
|
1699
|
+
*/
|
|
1700
|
+
track_clicks?: boolean;
|
|
1043
1701
|
};
|
|
1044
|
-
/**
|
|
1045
|
-
* Discriminated union of every webhook event the Bird platform emits.
|
|
1046
|
-
* Each variant is the full delivery body: `type` names the event, `timestamp` is when the event occurred, and `data` carries the event-specific payload. The `type` property selects the variant — SDKs that consume this schema (openapi-typescript, oapi-codegen) generate a narrowed union keyed on `type`, so customer code can switch on the event id and access the variant-specific payload fields without casting.
|
|
1047
|
-
* Delivery metadata (the event id and per-attempt signature headers) rides in HTTP headers per Standard Webhooks and is handled by the SDK's webhook verification helper, which returns one of these variants.
|
|
1048
|
-
*
|
|
1049
|
-
*/
|
|
1050
|
-
type WebhookEvent = ({
|
|
1051
|
-
type: "domain.failed";
|
|
1052
|
-
} & EventDomainFailed) | ({
|
|
1053
|
-
type: "domain.verified";
|
|
1054
|
-
} & EventDomainVerified) | ({
|
|
1055
|
-
type: "email.accepted";
|
|
1056
|
-
} & EventEmailAccepted) | ({
|
|
1057
|
-
type: "email.bounced";
|
|
1058
|
-
} & EventEmailBounced) | ({
|
|
1059
|
-
type: "email.canceled";
|
|
1060
|
-
} & EventEmailCanceled) | ({
|
|
1061
|
-
type: "email.clicked";
|
|
1062
|
-
} & EventEmailClicked) | ({
|
|
1063
|
-
type: "email.complained";
|
|
1064
|
-
} & EventEmailComplained) | ({
|
|
1065
|
-
type: "email.deferred";
|
|
1066
|
-
} & EventEmailDeferred) | ({
|
|
1067
|
-
type: "email.delivered";
|
|
1068
|
-
} & EventEmailDelivered) | ({
|
|
1069
|
-
type: "email.list_unsubscribed";
|
|
1070
|
-
} & EventEmailListUnsubscribed) | ({
|
|
1071
|
-
type: "email.opened";
|
|
1072
|
-
} & EventEmailOpened) | ({
|
|
1073
|
-
type: "email.out_of_band_bounce";
|
|
1074
|
-
} & EventEmailOutOfBandBounce) | ({
|
|
1075
|
-
type: "email.processed";
|
|
1076
|
-
} & EventEmailProcessed) | ({
|
|
1077
|
-
type: "email.received";
|
|
1078
|
-
} & EventEmailReceived) | ({
|
|
1079
|
-
type: "email.rejected";
|
|
1080
|
-
} & EventEmailRejected) | ({
|
|
1081
|
-
type: "email.scheduled";
|
|
1082
|
-
} & EventEmailScheduled) | ({
|
|
1083
|
-
type: "email.unsubscribed";
|
|
1084
|
-
} & EventEmailUnsubscribed) | ({
|
|
1085
|
-
type: "email_suppression.created";
|
|
1086
|
-
} & EventEmailSuppressionCreated) | ({
|
|
1087
|
-
type: "sms.accepted";
|
|
1088
|
-
} & EventSmsAccepted) | ({
|
|
1089
|
-
type: "sms.delivered";
|
|
1090
|
-
} & EventSmsDelivered) | ({
|
|
1091
|
-
type: "sms.expired";
|
|
1092
|
-
} & EventSmsExpired) | ({
|
|
1093
|
-
type: "sms.failed";
|
|
1094
|
-
} & EventSmsFailed) | ({
|
|
1095
|
-
type: "sms.rejected";
|
|
1096
|
-
} & EventSmsRejected) | ({
|
|
1097
|
-
type: "sms.sent";
|
|
1098
|
-
} & EventSmsSent) | ({
|
|
1099
|
-
type: "sms.undelivered";
|
|
1100
|
-
} & EventSmsUndelivered);
|
|
1101
1702
|
type EmailMessageBatchResponse = {
|
|
1102
1703
|
/**
|
|
1103
1704
|
* One entry per message in the batch, in submission order.
|
|
@@ -1157,18 +1758,22 @@ type EmailAttachment = {
|
|
|
1157
1758
|
*/
|
|
1158
1759
|
content_id?: string;
|
|
1159
1760
|
};
|
|
1160
|
-
|
|
1161
|
-
* An email address with an optional display name.
|
|
1162
|
-
*/
|
|
1163
|
-
type EmailAddress = {
|
|
1761
|
+
type EmailTemplateSend = unknown & {
|
|
1164
1762
|
/**
|
|
1165
|
-
*
|
|
1763
|
+
* The template to send, by its id.
|
|
1166
1764
|
*/
|
|
1167
|
-
|
|
1765
|
+
id?: EmailTemplateId;
|
|
1168
1766
|
/**
|
|
1169
|
-
*
|
|
1767
|
+
* The template to send, by its alias handle (for example `welcome-email`).
|
|
1170
1768
|
*/
|
|
1171
|
-
|
|
1769
|
+
alias?: string;
|
|
1770
|
+
/**
|
|
1771
|
+
* Values for the template's variables, keyed by variable name. A token with no matching value renders empty. Cap: 16 KB serialized.
|
|
1772
|
+
*
|
|
1773
|
+
*/
|
|
1774
|
+
parameters?: {
|
|
1775
|
+
[key: string]: unknown;
|
|
1776
|
+
};
|
|
1172
1777
|
};
|
|
1173
1778
|
/**
|
|
1174
1779
|
* A sender or recipient address. Accepts a plain email string (`jane@example.com`), an RFC 5322 mailbox string with an embedded display name (`Jane Doe <jane@example.com>`), or an object carrying the address and an optional display name. All forms can be mixed freely within one request; responses always return the object form.
|
|
@@ -1193,9 +1798,9 @@ type EmailMessageSendRequest = {
|
|
|
1193
1798
|
*/
|
|
1194
1799
|
bcc?: Array<EmailAddressInput>;
|
|
1195
1800
|
/**
|
|
1196
|
-
* Message subject line.
|
|
1801
|
+
* Message subject line. Required for inline sends; omit it when sending a `template` (the template supplies the subject).
|
|
1197
1802
|
*/
|
|
1198
|
-
subject
|
|
1803
|
+
subject?: string;
|
|
1199
1804
|
/**
|
|
1200
1805
|
* HTML body. At least one of html or text must be provided.
|
|
1201
1806
|
*/
|
|
@@ -1219,7 +1824,7 @@ type EmailMessageSendRequest = {
|
|
|
1219
1824
|
* Structured `{name, value}` labels for **filtering and analytics**. Tags become first-class query dimensions: filter the list endpoint by tag name, slice analytics rollups by tag, and surface in webhook payloads. Cap: 20 tags per send. Use tags for low-cardinality dimensions (`category`, `experiment_variant`, `template_id`). For arbitrary structured context that you do not need as a filter dimension, use `metadata` instead.
|
|
1220
1825
|
*
|
|
1221
1826
|
*/
|
|
1222
|
-
tags?: Array<
|
|
1827
|
+
tags?: Array<Tag>;
|
|
1223
1828
|
/**
|
|
1224
1829
|
* Arbitrary JSON object **stored, returned on API reads, and echoed in webhook payloads**. Path-queryable in analytics (e.g. filter on `metadata.order_id`) but not surfaced as a first-class dashboard filter dimension. Cap: 2 KB serialized. Use metadata for per-send context like internal IDs, foreign keys, and structured payloads you want round-tripped through events. For low-cardinality filterable labels, use `tags` instead.
|
|
1225
1830
|
*
|
|
@@ -1227,6 +1832,18 @@ type EmailMessageSendRequest = {
|
|
|
1227
1832
|
metadata?: {
|
|
1228
1833
|
[key: string]: unknown;
|
|
1229
1834
|
};
|
|
1835
|
+
/**
|
|
1836
|
+
* Template variables used to personalize inline content. Tokens in the subject and body (e.g. `{{ first_name }}`) are replaced with these values at send time. Shared across all recipients of this send. A token with no matching key renders empty. Cap: 16 KB serialized. When sending a stored `template`, put the values in `template.parameters` instead.
|
|
1837
|
+
*
|
|
1838
|
+
*/
|
|
1839
|
+
parameters?: {
|
|
1840
|
+
[key: string]: unknown;
|
|
1841
|
+
};
|
|
1842
|
+
/**
|
|
1843
|
+
* Send a stored template instead of inline content. When set, omit `subject`/`html`/`text` — the template supplies them; personalize with `template.parameters`.
|
|
1844
|
+
*
|
|
1845
|
+
*/
|
|
1846
|
+
template?: EmailTemplateSend;
|
|
1230
1847
|
/**
|
|
1231
1848
|
* Whether to track open events for this message.
|
|
1232
1849
|
*/
|
|
@@ -1394,7 +2011,7 @@ type EmailMessage = {
|
|
|
1394
2011
|
/**
|
|
1395
2012
|
* Structured `{name, value}` filter labels applied to this send. See EmailMessageSendRequest for the tags vs metadata distinction.
|
|
1396
2013
|
*/
|
|
1397
|
-
tags?: Array<
|
|
2014
|
+
tags?: Array<Tag>;
|
|
1398
2015
|
/**
|
|
1399
2016
|
* Arbitrary JSON metadata stored on the message object and echoed in webhook payloads. See EmailMessageSendRequest for the tags vs metadata distinction.
|
|
1400
2017
|
*/
|
|
@@ -1463,10 +2080,10 @@ type ListEmailMessagesData = {
|
|
|
1463
2080
|
*/
|
|
1464
2081
|
status?: "scheduled" | "accepted" | "processed" | "deferred" | "delivered" | "partial_failure" | "bounced" | "complained" | "rejected" | "canceled";
|
|
1465
2082
|
/**
|
|
1466
|
-
* Filter by tag. Accepts `name` to match any send carrying that tag name, or `name:value` to match a specific tag pair (e.g. `category:welcome`).
|
|
2083
|
+
* Filter by tag. Accepts `name` to match any send carrying that tag name, or `name:value` to match a specific tag pair (e.g. `category:welcome`). Repeat the parameter to AND-combine several tag filters.
|
|
1467
2084
|
*
|
|
1468
2085
|
*/
|
|
1469
|
-
tag?: string
|
|
2086
|
+
tag?: Array<string>;
|
|
1470
2087
|
/**
|
|
1471
2088
|
* Filter by category.
|
|
1472
2089
|
*/
|
|
@@ -1484,6 +2101,114 @@ type ListEmailMessagesData = {
|
|
|
1484
2101
|
};
|
|
1485
2102
|
url: "/v1/email/messages";
|
|
1486
2103
|
};
|
|
2104
|
+
type ListSmsMessagesData = {
|
|
2105
|
+
body?: never;
|
|
2106
|
+
path?: never;
|
|
2107
|
+
query?: {
|
|
2108
|
+
/**
|
|
2109
|
+
* Maximum number of items to return per page.
|
|
2110
|
+
*/
|
|
2111
|
+
limit?: number;
|
|
2112
|
+
/**
|
|
2113
|
+
* Cursor from the `next_cursor` field of a previous list response. Returns items immediately after the cursor position in the current sort order.
|
|
2114
|
+
*/
|
|
2115
|
+
starting_after?: string;
|
|
2116
|
+
/**
|
|
2117
|
+
* Cursor from the `prev_cursor` field of a previous list response. Returns items immediately before the cursor position in the current sort order.
|
|
2118
|
+
*/
|
|
2119
|
+
ending_before?: string;
|
|
2120
|
+
/**
|
|
2121
|
+
* Return only resources created strictly after this timestamp. RFC 3339 / ISO 8601 with timezone.
|
|
2122
|
+
*/
|
|
2123
|
+
created_after?: string;
|
|
2124
|
+
/**
|
|
2125
|
+
* Return only resources created strictly before this timestamp. RFC 3339 / ISO 8601 with timezone.
|
|
2126
|
+
*/
|
|
2127
|
+
created_before?: string;
|
|
2128
|
+
/**
|
|
2129
|
+
* Filter by direction. Omit for both.
|
|
2130
|
+
*/
|
|
2131
|
+
direction?: "outbound" | "inbound";
|
|
2132
|
+
/**
|
|
2133
|
+
* Filter by status; repeat the parameter to match any of several. One of scheduled, accepted, sent, delivered, undelivered, failed, rejected, canceled, expired, or received.
|
|
2134
|
+
*
|
|
2135
|
+
*/
|
|
2136
|
+
status?: Array<string>;
|
|
2137
|
+
/**
|
|
2138
|
+
* Filter to messages whose failure reason matches one of the supplied values; repeat the parameter to match any of several. One of invalid_destination, unreachable, blocked_by_carrier, blocked_by_recipient, landline_unreachable, content_rejected, sender_unregistered, recipient_opted_out, provider_unavailable, or unknown.
|
|
2139
|
+
*
|
|
2140
|
+
*/
|
|
2141
|
+
error_code?: Array<string>;
|
|
2142
|
+
/**
|
|
2143
|
+
* Filter by category.
|
|
2144
|
+
*/
|
|
2145
|
+
category?: "transactional" | "marketing" | "authentication" | "service";
|
|
2146
|
+
/**
|
|
2147
|
+
* Filter by recipient phone number (E.164 exact match).
|
|
2148
|
+
*/
|
|
2149
|
+
to?: string;
|
|
2150
|
+
/**
|
|
2151
|
+
* Filter by sender (E.164, alphanumeric, or short code — exact match).
|
|
2152
|
+
*/
|
|
2153
|
+
from?: string;
|
|
2154
|
+
/**
|
|
2155
|
+
* Filter by tag. Accepts `name` to match any message carrying that tag name, or `name:value` to match a specific tag pair. Repeat the parameter to AND-combine several tag filters.
|
|
2156
|
+
*
|
|
2157
|
+
*/
|
|
2158
|
+
tag?: Array<string>;
|
|
2159
|
+
};
|
|
2160
|
+
url: "/v1/sms/messages";
|
|
2161
|
+
};
|
|
2162
|
+
type ListSmsTemplatesData = {
|
|
2163
|
+
body?: never;
|
|
2164
|
+
path?: never;
|
|
2165
|
+
query?: {
|
|
2166
|
+
/**
|
|
2167
|
+
* Filter by scope. Omit for all.
|
|
2168
|
+
*/
|
|
2169
|
+
scope?: "system" | "workspace";
|
|
2170
|
+
/**
|
|
2171
|
+
* Filter by category.
|
|
2172
|
+
*/
|
|
2173
|
+
category?: "transactional" | "marketing" | "authentication" | "service";
|
|
2174
|
+
/**
|
|
2175
|
+
* Keep only templates available in this language, as a BCP-47 tag.
|
|
2176
|
+
*/
|
|
2177
|
+
locale?: string;
|
|
2178
|
+
};
|
|
2179
|
+
url: "/v1/sms/templates";
|
|
2180
|
+
};
|
|
2181
|
+
type ListEmailTemplatesData = {
|
|
2182
|
+
body?: never;
|
|
2183
|
+
path?: never;
|
|
2184
|
+
query?: {
|
|
2185
|
+
/**
|
|
2186
|
+
* Filter by template category.
|
|
2187
|
+
*/
|
|
2188
|
+
category?: EmailTemplateCategory;
|
|
2189
|
+
/**
|
|
2190
|
+
* Filter by authoring format.
|
|
2191
|
+
*/
|
|
2192
|
+
source?: EmailTemplateSource;
|
|
2193
|
+
/**
|
|
2194
|
+
* Filter by name prefix (case-insensitive).
|
|
2195
|
+
*/
|
|
2196
|
+
name?: string;
|
|
2197
|
+
/**
|
|
2198
|
+
* Maximum number of items to return per page.
|
|
2199
|
+
*/
|
|
2200
|
+
limit?: number;
|
|
2201
|
+
/**
|
|
2202
|
+
* Cursor from the `next_cursor` field of a previous list response. Returns items immediately after the cursor position in the current sort order.
|
|
2203
|
+
*/
|
|
2204
|
+
starting_after?: string;
|
|
2205
|
+
/**
|
|
2206
|
+
* Cursor from the `prev_cursor` field of a previous list response. Returns items immediately before the cursor position in the current sort order.
|
|
2207
|
+
*/
|
|
2208
|
+
ending_before?: string;
|
|
2209
|
+
};
|
|
2210
|
+
url: "/v1/email/templates";
|
|
2211
|
+
};
|
|
1487
2212
|
|
|
1488
2213
|
type AuthToken = string | undefined;
|
|
1489
2214
|
interface Auth {
|
|
@@ -1778,7 +2503,7 @@ interface ClientOptions {
|
|
|
1778
2503
|
throwOnError?: boolean;
|
|
1779
2504
|
}
|
|
1780
2505
|
type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method">) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
1781
|
-
type SseFn = <TData = unknown,
|
|
2506
|
+
type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, "method">) => Promise<ServerSentEventsResult<TData>>;
|
|
1782
2507
|
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method"> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, "method">) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
1783
2508
|
type BuildUrlFn = <TData extends {
|
|
1784
2509
|
body?: unknown;
|
|
@@ -1947,6 +2672,194 @@ declare class EmailResource<D extends EmailChannelDefaults | undefined = undefin
|
|
|
1947
2672
|
list(query?: EmailListQuery, options?: RequestOptions$1): PaginatedPromise<EmailMessage>;
|
|
1948
2673
|
}
|
|
1949
2674
|
|
|
2675
|
+
/** Body for `bird.emailTemplates.create`. */
|
|
2676
|
+
type EmailTemplateCreateParams = EmailTemplateCreate;
|
|
2677
|
+
/** Body for `bird.emailTemplates.update` — a partial patch of the draft. */
|
|
2678
|
+
type EmailTemplateUpdateParams = EmailTemplateUpdate;
|
|
2679
|
+
/** Filters and cursor params for `bird.emailTemplates.list`. */
|
|
2680
|
+
type EmailTemplateListQuery = NonNullable<ListEmailTemplatesData["query"]>;
|
|
2681
|
+
declare class EmailTemplatesResource extends Resource {
|
|
2682
|
+
/**
|
|
2683
|
+
* Create a template and its initial editable draft. Pick the authoring format
|
|
2684
|
+
* with `source` (`liquid`, `handlebars`, or `html`); the name must be unique
|
|
2685
|
+
* in the workspace or the call throws a `BirdConflictError`.
|
|
2686
|
+
*
|
|
2687
|
+
* @example Create a template
|
|
2688
|
+
* const tpl = await bird.emailTemplates.create({
|
|
2689
|
+
* name: "Welcome",
|
|
2690
|
+
* category: "transactional",
|
|
2691
|
+
* source: "handlebars",
|
|
2692
|
+
* subject: "Welcome, {{ first_name }}!",
|
|
2693
|
+
* html: "<h1>Hi {{ first_name }}</h1>",
|
|
2694
|
+
* });
|
|
2695
|
+
* console.log(tpl.id, tpl.revision); // "emt_…", 0
|
|
2696
|
+
*/
|
|
2697
|
+
create(params: EmailTemplateCreateParams, options?: RequestOptions$1): APIPromise<EmailTemplate>;
|
|
2698
|
+
/**
|
|
2699
|
+
* List the workspace's templates, newest first. `await` resolves the first
|
|
2700
|
+
* page; `for await` walks every template across all pages. Filter by
|
|
2701
|
+
* `category`, `source`, or a case-insensitive `name` prefix.
|
|
2702
|
+
*
|
|
2703
|
+
* @example Iterate every template, or take one page
|
|
2704
|
+
* for await (const tpl of bird.emailTemplates.list({ category: "transactional" })) {
|
|
2705
|
+
* console.log(tpl.id, tpl.name);
|
|
2706
|
+
* }
|
|
2707
|
+
* const page = await bird.emailTemplates.list({ limit: 50 }); // page.data, page.next_cursor
|
|
2708
|
+
*/
|
|
2709
|
+
list(query?: EmailTemplateListQuery, options?: RequestOptions$1): PaginatedPromise<EmailTemplateSummary>;
|
|
2710
|
+
/**
|
|
2711
|
+
* Fetch a template with its current draft content (subject, HTML, text), the
|
|
2712
|
+
* draft `revision`, and its draft/published version ids.
|
|
2713
|
+
*
|
|
2714
|
+
* @example
|
|
2715
|
+
* const tpl = await bird.emailTemplates.get("emt_abc123");
|
|
2716
|
+
* tpl.subject;
|
|
2717
|
+
* tpl.published_version_id; // null until first publish
|
|
2718
|
+
*/
|
|
2719
|
+
get(templateId: string, options?: RequestOptions$1): APIPromise<EmailTemplate>;
|
|
2720
|
+
/**
|
|
2721
|
+
* Update a template's metadata and draft content. Only the fields you send
|
|
2722
|
+
* change. Pass the draft `revision` you last read; if another edit landed
|
|
2723
|
+
* first the call throws a `BirdConflictError` — reload and retry.
|
|
2724
|
+
*
|
|
2725
|
+
* @example Edit the draft, guarded by the revision you read
|
|
2726
|
+
* const tpl = await bird.emailTemplates.get("emt_abc123");
|
|
2727
|
+
* const updated = await bird.emailTemplates.update("emt_abc123", {
|
|
2728
|
+
* revision: tpl.revision,
|
|
2729
|
+
* subject: "Welcome aboard, {{ first_name }}!",
|
|
2730
|
+
* });
|
|
2731
|
+
*/
|
|
2732
|
+
update(templateId: string, params: EmailTemplateUpdateParams, options?: RequestOptions$1): APIPromise<EmailTemplate>;
|
|
2733
|
+
/**
|
|
2734
|
+
* Delete a template and all its versions. The name becomes available for
|
|
2735
|
+
* reuse in the workspace.
|
|
2736
|
+
*
|
|
2737
|
+
* @example
|
|
2738
|
+
* await bird.emailTemplates.delete("emt_abc123");
|
|
2739
|
+
*/
|
|
2740
|
+
delete(templateId: string, options?: RequestOptions$1): APIPromise<void>;
|
|
2741
|
+
/**
|
|
2742
|
+
* Publish the current draft as a new immutable, numbered version and make it
|
|
2743
|
+
* the live version used by sends. The draft stays editable. The draft must
|
|
2744
|
+
* have a subject and a body, or the call throws.
|
|
2745
|
+
*
|
|
2746
|
+
* @example Publish, then send by template
|
|
2747
|
+
* const version = await bird.emailTemplates.publish("emt_abc123");
|
|
2748
|
+
* console.log(version.version_number); // 1, 2, 3…
|
|
2749
|
+
* await bird.email.send({
|
|
2750
|
+
* from: "hello@acme.com",
|
|
2751
|
+
* to: ["alice@example.com"],
|
|
2752
|
+
* template: { id: "emt_abc123", parameters: { first_name: "Alice" } },
|
|
2753
|
+
* });
|
|
2754
|
+
*/
|
|
2755
|
+
publish(templateId: string, options?: RequestOptions$1): APIPromise<EmailTemplateVersion>;
|
|
2756
|
+
/**
|
|
2757
|
+
* List every version of a template — the current draft plus all published
|
|
2758
|
+
* versions — newest first. Returns the full set in one response (`.data`);
|
|
2759
|
+
* this list is not paginated.
|
|
2760
|
+
*
|
|
2761
|
+
* @example
|
|
2762
|
+
* const { data } = await bird.emailTemplates.listVersions("emt_abc123");
|
|
2763
|
+
* for (const v of data) console.log(v.version_number, v.status);
|
|
2764
|
+
*/
|
|
2765
|
+
listVersions(templateId: string, options?: RequestOptions$1): APIPromise<EmailTemplateVersionList>;
|
|
2766
|
+
/**
|
|
2767
|
+
* Fetch a single version of a template.
|
|
2768
|
+
*
|
|
2769
|
+
* @example
|
|
2770
|
+
* const version = await bird.emailTemplates.getVersion("emt_abc123", "emv_def456");
|
|
2771
|
+
* version.status; // "draft" | "published"
|
|
2772
|
+
*/
|
|
2773
|
+
getVersion(templateId: string, versionId: string, options?: RequestOptions$1): APIPromise<EmailTemplateVersion>;
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
/** Body for `bird.sms.send` — supply either `text` (with `category`) or `template`. */
|
|
2777
|
+
type SmsSendParams = SmsMessageSendRequest;
|
|
2778
|
+
/** Body for `bird.sms.sendBatch` — an array of up to 100 sends. */
|
|
2779
|
+
type SmsSendBatchParams = SmsMessageBatchRequest;
|
|
2780
|
+
/** Result of `bird.sms.sendBatch`. */
|
|
2781
|
+
type SmsSendBatchResult = SmsMessageBatchResponse;
|
|
2782
|
+
/** Filters and cursor params for `bird.sms.list`. */
|
|
2783
|
+
type SmsListQuery = NonNullable<ListSmsMessagesData["query"]>;
|
|
2784
|
+
declare class SmsResource extends Resource {
|
|
2785
|
+
/**
|
|
2786
|
+
* Send one SMS to a single recipient. Supply either `text` (with a `category`)
|
|
2787
|
+
* or a stored `template` (by `id` or `alias`, with its `parameters`). The
|
|
2788
|
+
* result is `accepted`, not yet delivered — read it back with `get` to confirm.
|
|
2789
|
+
*
|
|
2790
|
+
* @example Send free text
|
|
2791
|
+
* const msg = await bird.sms.send({
|
|
2792
|
+
* to: "+15551234567",
|
|
2793
|
+
* text: "Your verification code is 123456.",
|
|
2794
|
+
* category: "authentication",
|
|
2795
|
+
* });
|
|
2796
|
+
* console.log(msg.id, msg.status);
|
|
2797
|
+
*
|
|
2798
|
+
* @example Send by template
|
|
2799
|
+
* await bird.sms.send({
|
|
2800
|
+
* to: "+15551234567",
|
|
2801
|
+
* template: { alias: "bird_otp_verification", parameters: { code: "123456" } },
|
|
2802
|
+
* });
|
|
2803
|
+
*/
|
|
2804
|
+
send(params: SmsSendParams, options?: RequestOptions$1): APIPromise<SmsMessage>;
|
|
2805
|
+
/**
|
|
2806
|
+
* Send up to 100 independent SMS messages in one call. Each item is a full send
|
|
2807
|
+
* (free text or template); all items are validated before any are queued.
|
|
2808
|
+
*
|
|
2809
|
+
* @example
|
|
2810
|
+
* const result = await bird.sms.sendBatch([
|
|
2811
|
+
* { to: "+15551111111", text: "Hi Alice!", category: "marketing" },
|
|
2812
|
+
* { to: "+15552222222", text: "Hi Bob!", category: "marketing" },
|
|
2813
|
+
* ]);
|
|
2814
|
+
*/
|
|
2815
|
+
sendBatch(params: SmsSendBatchParams, options?: RequestOptions$1): APIPromise<SmsSendBatchResult>;
|
|
2816
|
+
/**
|
|
2817
|
+
* Fetch a single SMS message: its current delivery status, segment breakdown,
|
|
2818
|
+
* cost, and failure detail if it failed.
|
|
2819
|
+
*
|
|
2820
|
+
* @example
|
|
2821
|
+
* const msg = await bird.sms.get("sms_abc123");
|
|
2822
|
+
* msg.status; // "accepted" | "delivered" | …
|
|
2823
|
+
*/
|
|
2824
|
+
get(messageId: string, options?: RequestOptions$1): APIPromise<SmsMessage>;
|
|
2825
|
+
/**
|
|
2826
|
+
* List SMS messages, newest first. `await` resolves the first page; `for await`
|
|
2827
|
+
* walks every message across all pages. Filter by direction, status, category,
|
|
2828
|
+
* recipient, sender, or tag.
|
|
2829
|
+
*
|
|
2830
|
+
* @example
|
|
2831
|
+
* for await (const msg of bird.sms.list({ direction: "outbound" })) {
|
|
2832
|
+
* console.log(msg.id, msg.status);
|
|
2833
|
+
* }
|
|
2834
|
+
*/
|
|
2835
|
+
list(query?: SmsListQuery, options?: RequestOptions$1): PaginatedPromise<SmsMessage>;
|
|
2836
|
+
}
|
|
2837
|
+
|
|
2838
|
+
/** Filters for `bird.smsTemplates.list`. */
|
|
2839
|
+
type SmsTemplateListQuery = NonNullable<ListSmsTemplatesData["query"]>;
|
|
2840
|
+
declare class SmsTemplatesResource extends Resource {
|
|
2841
|
+
/**
|
|
2842
|
+
* List the SMS templates available to the workspace — Bird's built-in
|
|
2843
|
+
* templates plus any the workspace authored. The catalogue is small and
|
|
2844
|
+
* returned in full (`.data`); this list is not paginated. Filter by `scope`,
|
|
2845
|
+
* `category`, or `locale` (a BCP-47 language tag).
|
|
2846
|
+
*
|
|
2847
|
+
* @example List the built-in templates
|
|
2848
|
+
* const { data } = await bird.smsTemplates.list({ scope: "system" });
|
|
2849
|
+
* for (const tpl of data) console.log(tpl.id, tpl.name);
|
|
2850
|
+
*/
|
|
2851
|
+
list(query?: SmsTemplateListQuery, options?: RequestOptions$1): APIPromise<SmsTemplateList>;
|
|
2852
|
+
/**
|
|
2853
|
+
* Fetch a single SMS template by its alias or id, including its body and the
|
|
2854
|
+
* variables it expects.
|
|
2855
|
+
*
|
|
2856
|
+
* @example
|
|
2857
|
+
* const tpl = await bird.smsTemplates.get("bird_otp_verification");
|
|
2858
|
+
* console.log(tpl.body, tpl.variables);
|
|
2859
|
+
*/
|
|
2860
|
+
get(templateRef: string, options?: RequestOptions$1): APIPromise<SmsTemplate>;
|
|
2861
|
+
}
|
|
2862
|
+
|
|
1950
2863
|
/** A verified webhook event — discriminated on `type` (ADR-0028 wire contract). */
|
|
1951
2864
|
type BirdWebhookEvent = WebhookEvent;
|
|
1952
2865
|
/** Inbound request headers, as a `Headers` object or a plain record. */
|
|
@@ -2074,6 +2987,12 @@ declare class BirdClient<const O extends BirdClientOptions = BirdClientOptions>
|
|
|
2074
2987
|
protected readonly core: BirdHTTPClient;
|
|
2075
2988
|
/** The email channel — `bird.email.send(...)`, `.get(...)`, `.list(...)`. */
|
|
2076
2989
|
readonly email: EmailResource<EmailDefaultsOf<O>>;
|
|
2990
|
+
/** Email templates — `bird.emailTemplates.create(...)`, `.list(...)`, `.publish(...)`, … */
|
|
2991
|
+
readonly emailTemplates: EmailTemplatesResource;
|
|
2992
|
+
/** The SMS channel — `bird.sms.send(...)`, `.get(...)`, `.list(...)`. */
|
|
2993
|
+
readonly sms: SmsResource;
|
|
2994
|
+
/** SMS templates — `bird.smsTemplates.list(...)`, `.get(...)`. */
|
|
2995
|
+
readonly smsTemplates: SmsTemplatesResource;
|
|
2077
2996
|
/** Webhooks — `bird.webhooks.unwrap(payload, headers)` verifies an inbound delivery. */
|
|
2078
2997
|
readonly webhooks: WebhooksResource;
|
|
2079
2998
|
constructor(options: O);
|
|
@@ -2132,4 +3051,4 @@ declare const WebhookEventType: {
|
|
|
2132
3051
|
/** A known webhook event type value. */
|
|
2133
3052
|
type WebhookEventTypeValue = (typeof WebhookEventType)[keyof typeof WebhookEventType];
|
|
2134
3053
|
|
|
2135
|
-
export { type APIPromise, 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 CursorPage, type EmailChannelDefaults, type EmailListQuery, type EmailMessage, type EmailSendBatchParams, type EmailSendBatchResult, type EmailSendParams, type ErrorDetail, type ErrorNextAction, type PaginatedPromise, type RequestOptions$1 as RequestOptions, type SafeResult, WebhookEventType, type WebhookEventTypeValue, type WebhookHeaders, type WebhookOptions, baseUrlForRegion, regionFromApiKey };
|
|
3054
|
+
export { type APIPromise, 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 CursorPage, type EmailChannelDefaults, type EmailListQuery, type EmailMessage, type EmailSendBatchParams, type EmailSendBatchResult, type EmailSendParams, type EmailTemplate, type EmailTemplateCreateParams, type EmailTemplateListQuery, type EmailTemplateSummary, type EmailTemplateUpdateParams, type EmailTemplateVersion, type ErrorDetail, type ErrorNextAction, type PaginatedPromise, type RequestOptions$1 as RequestOptions, type SafeResult, type SmsListQuery, type SmsMessage, type SmsSendBatchParams, type SmsSendBatchResult, type SmsSendParams, type SmsTemplate, type SmsTemplateList, type SmsTemplateListQuery, WebhookEventType, type WebhookEventTypeValue, type WebhookHeaders, type WebhookOptions, baseUrlForRegion, regionFromApiKey };
|