@messagebird/sdk 0.25.0 → 0.26.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 CHANGED
@@ -872,9 +872,9 @@ type EventVerifyVerificationCreated = {
872
872
  data: EventVerifyVerificationCreatedData;
873
873
  };
874
874
  /**
875
- * Why a passcode send did not deliver. Open enum — new reasons may be added over time, so treat any unrecognized value as a future reason rather than an error. Emitted reasons are `carrier_rejected` (SMS), `hard_bounce` (email, permanent bounce), `soft_bounce` (email, transient bounce such as a full mailbox), `undelivered` (a generic delivery failure), `channel_unavailable` (the channel could not be used and the verification failed over), and `channel_disabled` (Bird has temporarily stopped sending over that channel, so the verification moved on to the next one).
875
+ * Why a passcode send did not deliver. Open enum — new reasons may be added over time, so treat any unrecognized value as a future reason rather than an error. Emitted reasons are `carrier_rejected` (SMS), `hard_bounce` (email, permanent bounce), `soft_bounce` (email, transient bounce such as a full mailbox), `undelivered` (a generic delivery failure), `channel_unavailable` (the channel could not be used and the verification failed over), `channel_disabled` (Bird has temporarily stopped sending over that channel, so the verification moved on to the next one), and `delivery_timeout` (no delivery confirmation arrived before the channel's timeout, so the verification failed over).
876
876
  */
877
- type VerificationAttemptFailureReason$1 = "carrier_rejected" | "hard_bounce" | "soft_bounce" | "undelivered" | "channel_unavailable" | "channel_disabled" | (string & {});
877
+ type VerificationAttemptFailureReason$1 = "carrier_rejected" | "hard_bounce" | "soft_bounce" | "undelivered" | "channel_unavailable" | "channel_disabled" | "delivery_timeout" | (string & {});
878
878
  /**
879
879
  * Payload of the verify.attempt.undelivered event.
880
880
  */
@@ -1107,13 +1107,13 @@ type EventSmsUndelivered = {
1107
1107
  */
1108
1108
  type EventSmsSentData = EventSmsBase & {
1109
1109
  /**
1110
- * Carrier that handled the message, or null when not known.
1110
+ * Carrier that handled the message. Absent when the carrier does not report one.
1111
1111
  */
1112
- carrier: string | null;
1112
+ carrier?: string;
1113
1113
  /**
1114
- * Mobile country code and mobile network code of the carrier, or null when not known.
1114
+ * Mobile country code and mobile network code of the carrier. Absent when the carrier does not report one.
1115
1115
  */
1116
- mcc_mnc: string | null;
1116
+ mcc_mnc?: string;
1117
1117
  };
1118
1118
  /**
1119
1119
  * Bird handed the message to the carrier for delivery.
@@ -1152,6 +1152,65 @@ type EventSmsRejected = {
1152
1152
  timestamp: string;
1153
1153
  data: EventSmsRejectedData;
1154
1154
  };
1155
+ /**
1156
+ * Payload of the sms.received event.
1157
+ */
1158
+ type EventSmsReceivedData = EventSmsBase & unknown & {
1159
+ /**
1160
+ * The message body, so you can act on it without a follow-up read. Absent when the message carried only attachments and no text of its own.
1161
+ *
1162
+ */
1163
+ text?: string;
1164
+ /**
1165
+ * Segment breakdown of the received body.
1166
+ */
1167
+ segments: SmsSegments;
1168
+ /**
1169
+ * Carrier the message came in over. Absent where the carrier does not report one.
1170
+ */
1171
+ carrier?: string;
1172
+ /**
1173
+ * Mobile country code and mobile network code of the carrier. Absent when not known.
1174
+ */
1175
+ mcc_mnc?: string;
1176
+ /**
1177
+ * Subject line. Absent when the message carried none.
1178
+ */
1179
+ subject?: string;
1180
+ };
1181
+ /**
1182
+ * Segment breakdown for the message body. Segment count drives billing.
1183
+ */
1184
+ type SmsSegments = {
1185
+ /**
1186
+ * Number of segments the body is split into. Each segment is a billable unit.
1187
+ */
1188
+ readonly count: number;
1189
+ /**
1190
+ * 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).
1191
+ *
1192
+ */
1193
+ readonly encoding: "GSM_7BIT" | "UCS2";
1194
+ /**
1195
+ * Character count of the body under the selected encoding.
1196
+ */
1197
+ readonly characters: number;
1198
+ };
1199
+ /**
1200
+ * Event type.
1201
+ */
1202
+ type SmsReceivedEventType = "sms.received";
1203
+ /**
1204
+ * A message was received on one of your numbers.
1205
+ */
1206
+ type EventSmsReceived = {
1207
+ type: SmsReceivedEventType;
1208
+ /**
1209
+ * Time the sender sent the message.
1210
+ */
1211
+ timestamp: string;
1212
+ data: EventSmsReceivedData;
1213
+ };
1155
1214
  /**
1156
1215
  * Payload of the sms.failed event.
1157
1216
  */
@@ -1203,13 +1262,13 @@ type EventSmsExpired = {
1203
1262
  */
1204
1263
  type EventSmsDeliveredData = EventSmsBase & {
1205
1264
  /**
1206
- * Carrier that delivered the message, or null when not known.
1265
+ * Carrier that delivered the message. Absent when the carrier does not report one.
1207
1266
  */
1208
- carrier: string | null;
1267
+ carrier?: string;
1209
1268
  /**
1210
- * Mobile country code and mobile network code of the carrier, or null when not known.
1269
+ * Mobile country code and mobile network code of the carrier. Absent when the carrier does not report one.
1211
1270
  */
1212
- mcc_mnc: string | null;
1271
+ mcc_mnc?: string;
1213
1272
  };
1214
1273
  /**
1215
1274
  * The carrier confirmed delivery of the message to the recipient handset.
@@ -1228,7 +1287,12 @@ type EventSmsDelivered = {
1228
1287
  /**
1229
1288
  * Payload of the sms.accepted event.
1230
1289
  */
1231
- type EventSmsAcceptedData = EventSmsBase;
1290
+ type EventSmsAcceptedData = EventSmsBase & {
1291
+ /**
1292
+ * Segment breakdown of the body Bird accepted, which is what the send is billed on.
1293
+ */
1294
+ segments: SmsSegments;
1295
+ };
1232
1296
  /**
1233
1297
  * Bird accepted the SMS send request and queued it for processing.
1234
1298
  */
@@ -2142,6 +2206,8 @@ type WebhookEvent = ({
2142
2206
  } & EventSmsExpired) | ({
2143
2207
  type: "sms.failed";
2144
2208
  } & EventSmsFailed) | ({
2209
+ type: "sms.received";
2210
+ } & EventSmsReceived) | ({
2145
2211
  type: "sms.rejected";
2146
2212
  } & EventSmsRejected) | ({
2147
2213
  type: "sms.sent";
@@ -4726,24 +4792,6 @@ type SmsBatchSummary = {
4726
4792
  */
4727
4793
  accepted_count: number;
4728
4794
  };
4729
- /**
4730
- * Segment breakdown for the message body. Segment count drives billing.
4731
- */
4732
- type SmsSegments = {
4733
- /**
4734
- * Number of segments the body is split into. Each segment is a billable unit.
4735
- */
4736
- readonly count: number;
4737
- /**
4738
- * 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).
4739
- *
4740
- */
4741
- readonly encoding: "GSM_7BIT" | "UCS2";
4742
- /**
4743
- * Character count of the body under the selected encoding.
4744
- */
4745
- readonly characters: number;
4746
- };
4747
4795
  /**
4748
4796
  * Delivery status. `accepted` (the initial status of an outbound send) 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 or unreachable). `failed` is a terminal permanent failure. `rejected` means Bird refused it before it reached the carrier (for example insufficient balance). `expired` means the validity period elapsed without a terminal receipt. `scheduled` means the message is queued to send at a future time and has not been dispatched yet, and `canceled` means a scheduled message was canceled before it was sent. `received` applies to inbound messages.
4749
4797
  *
@@ -9379,6 +9427,7 @@ declare const WebhookEventType: {
9379
9427
  readonly SmsDelivered: "sms.delivered";
9380
9428
  readonly SmsExpired: "sms.expired";
9381
9429
  readonly SmsFailed: "sms.failed";
9430
+ readonly SmsReceived: "sms.received";
9382
9431
  readonly SmsRejected: "sms.rejected";
9383
9432
  readonly SmsSent: "sms.sent";
9384
9433
  readonly SmsUndelivered: "sms.undelivered";
@@ -9453,6 +9502,7 @@ declare const VerificationAttemptFailureReason: {
9453
9502
  readonly CarrierRejected: "carrier_rejected";
9454
9503
  readonly ChannelDisabled: "channel_disabled";
9455
9504
  readonly ChannelUnavailable: "channel_unavailable";
9505
+ readonly DeliveryTimeout: "delivery_timeout";
9456
9506
  readonly HardBounce: "hard_bounce";
9457
9507
  readonly SoftBounce: "soft_bounce";
9458
9508
  readonly Undelivered: "undelivered";
package/dist/index.mjs CHANGED
@@ -5238,9 +5238,9 @@ var BirdClient = class {
5238
5238
  this.#headers = {
5239
5239
  ...opts.defaultHeaders,
5240
5240
  Authorization: `Bearer ${opts.apiKey}`,
5241
- "User-Agent": `bird-sdk-js/0.25.0`,
5241
+ "User-Agent": `bird-sdk-js/0.26.0`,
5242
5242
  "Bird-Surface": "sdk-js",
5243
- "Bird-Version": "0.25.0"
5243
+ "Bird-Version": "0.26.0"
5244
5244
  };
5245
5245
  const caller = detectCaller();
5246
5246
  if (caller) this.#headers["Bird-Caller"] = caller;
@@ -5364,6 +5364,7 @@ const WebhookEventType = {
5364
5364
  SmsDelivered: "sms.delivered",
5365
5365
  SmsExpired: "sms.expired",
5366
5366
  SmsFailed: "sms.failed",
5367
+ SmsReceived: "sms.received",
5367
5368
  SmsRejected: "sms.rejected",
5368
5369
  SmsSent: "sms.sent",
5369
5370
  SmsUndelivered: "sms.undelivered",
@@ -5432,6 +5433,7 @@ const VerificationAttemptFailureReason = {
5432
5433
  CarrierRejected: "carrier_rejected",
5433
5434
  ChannelDisabled: "channel_disabled",
5434
5435
  ChannelUnavailable: "channel_unavailable",
5436
+ DeliveryTimeout: "delivery_timeout",
5435
5437
  HardBounce: "hard_bounce",
5436
5438
  SoftBounce: "soft_bounce",
5437
5439
  Undelivered: "undelivered"