@messagebird/sdk 0.38.2 → 0.39.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 +146 -12
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1497,24 +1497,26 @@ type AudienceContactsRemoveRequest = {
|
|
|
1497
1497
|
*/
|
|
1498
1498
|
type MessageDirection = "outbound" | "inbound";
|
|
1499
1499
|
/**
|
|
1500
|
-
* Content classification.
|
|
1500
|
+
* Content classification: why you are sending. Carriers see it, and where a destination country requires the sender to be registered, that registration is approved for a category: a send outside what it covers returns a `422` `SenderCategoryNotPermitted`. A registration approved for `marketing` covers all four values; one approved for `transactional`, `authentication`, or `service` covers those three and not `marketing`. Use `authentication` for a one-time passcode and `marketing` for a promotion; otherwise pick the value matching the message's purpose.
|
|
1501
1501
|
*/
|
|
1502
1502
|
type SmsMessageCategory = "transactional" | "marketing" | "authentication" | "service";
|
|
1503
1503
|
type SmsMessageId = string;
|
|
1504
1504
|
/**
|
|
1505
1505
|
* Delivery status:
|
|
1506
1506
|
*
|
|
1507
|
-
* - `scheduled`: Queued for a future send time.
|
|
1508
1507
|
* - `accepted`: Accepted and awaiting carrier handoff.
|
|
1509
1508
|
* - `sent`: Handed to the carrier and awaiting a delivery receipt.
|
|
1510
1509
|
* - `delivered`: Confirmed as delivered.
|
|
1511
|
-
* - `undelivered`:
|
|
1512
|
-
* - `failed`:
|
|
1510
|
+
* - `undelivered`: The carrier reported delivery as failed for a reason that may clear later, such as a handset out of coverage or a carrier at capacity. Final all the same: the message is not retried, so reaching the recipient means sending again.
|
|
1511
|
+
* - `failed`: The carrier reported delivery as failed for a reason that will not clear, such as an unassigned number, a recipient who has opted out, or content the carrier refused.
|
|
1513
1512
|
* - `rejected`: Refused before carrier handoff.
|
|
1514
|
-
* - `canceled`: Canceled before a scheduled send.
|
|
1515
1513
|
* - `expired`: Reached its validity limit without a final receipt.
|
|
1516
1514
|
* - `received`: Received as an inbound message.
|
|
1517
1515
|
*
|
|
1516
|
+
* `scheduled` and `canceled` are declared ahead of the send-later scheduling
|
|
1517
|
+
* feature that produces them, so their arrival is not a breaking change. No
|
|
1518
|
+
* message carries either status today.
|
|
1519
|
+
*
|
|
1518
1520
|
*/
|
|
1519
1521
|
type SmsMessageStatus = "scheduled" | "accepted" | "sent" | "delivered" | "undelivered" | "failed" | "rejected" | "canceled" | "expired" | "received";
|
|
1520
1522
|
/**
|
|
@@ -1600,7 +1602,7 @@ type SmsErrorCode = "invalid_destination" | "unreachable" | "blocked_by_carrier"
|
|
|
1600
1602
|
type SmsError = {
|
|
1601
1603
|
code: SmsErrorCode;
|
|
1602
1604
|
/**
|
|
1603
|
-
*
|
|
1605
|
+
* The failure in words, from whatever refused the message: the carrier's own reason text on a delivery receipt, or ours on a message stopped before a carrier saw it. Free-form, so branch on `code` and show this to a human.
|
|
1604
1606
|
*/
|
|
1605
1607
|
description: string;
|
|
1606
1608
|
/**
|
|
@@ -1661,12 +1663,12 @@ type SmsMessage = {
|
|
|
1661
1663
|
[key: string]: unknown;
|
|
1662
1664
|
};
|
|
1663
1665
|
/**
|
|
1664
|
-
*
|
|
1666
|
+
* The settings applied to this message, with any option you omitted filled in with the default in force when you sent it. Absent on inbound messages, and on any outbound message for which no settings were recorded.
|
|
1665
1667
|
*
|
|
1666
1668
|
*/
|
|
1667
1669
|
readonly options?: SmsMessageEffectiveOptions;
|
|
1668
1670
|
/**
|
|
1669
|
-
*
|
|
1671
|
+
* Preview feature: how long, in seconds, the carrier may keep attempting delivery before the message is marked `expired`. Not returned yet.
|
|
1670
1672
|
*/
|
|
1671
1673
|
readonly validity_period?: number;
|
|
1672
1674
|
/**
|
|
@@ -1765,12 +1767,12 @@ type SmsMessageSendRequest = unknown & {
|
|
|
1765
1767
|
*/
|
|
1766
1768
|
text?: string;
|
|
1767
1769
|
/**
|
|
1768
|
-
* Content classification
|
|
1770
|
+
* Content classification: why you are sending. Required on a free-text send; omit it on a template send, where the category is derived from the template. Where the destination country requires the sender to be registered, a category outside what that registration covers returns a `422` `SenderCategoryNotPermitted`.
|
|
1769
1771
|
*
|
|
1770
1772
|
*/
|
|
1771
1773
|
category?: SmsMessageCategory;
|
|
1772
1774
|
/**
|
|
1773
|
-
* Preview feature: how long, in seconds (60-172800),
|
|
1775
|
+
* Preview feature: how long, in seconds (60-172800), the carrier may keep attempting delivery before the message is marked `expired`. Currently unavailable; supplying this field returns `422 SMSUnsupportedFeature`.
|
|
1774
1776
|
*
|
|
1775
1777
|
*/
|
|
1776
1778
|
validity_period?: number;
|
|
@@ -1996,7 +1998,7 @@ type SmsTemplateVersionId = string;
|
|
|
1996
1998
|
*/
|
|
1997
1999
|
type SmsTemplate = {
|
|
1998
2000
|
/**
|
|
1999
|
-
*
|
|
2001
|
+
* The template's generated identifier. Accepted anywhere a template is referenced: the `{template_ref}` path segment, and `template.id` on a send. The `slug` works in the same places and is more readable.
|
|
2000
2002
|
*/
|
|
2001
2003
|
readonly id: SmsTemplateId;
|
|
2002
2004
|
/**
|
|
@@ -3846,6 +3848,128 @@ type WhatsAppLocation = {
|
|
|
3846
3848
|
*/
|
|
3847
3849
|
url?: string;
|
|
3848
3850
|
};
|
|
3851
|
+
/**
|
|
3852
|
+
* The contact's name, in the parts their device supplied. Every part is optional: WhatsApp sends what the card holds and omits the rest.
|
|
3853
|
+
*
|
|
3854
|
+
*/
|
|
3855
|
+
type WhatsAppContactName = {
|
|
3856
|
+
/**
|
|
3857
|
+
* The whole name as the contact's device renders it.
|
|
3858
|
+
*/
|
|
3859
|
+
formatted_name?: string;
|
|
3860
|
+
first_name?: string;
|
|
3861
|
+
middle_name?: string;
|
|
3862
|
+
last_name?: string;
|
|
3863
|
+
prefix?: string;
|
|
3864
|
+
suffix?: string;
|
|
3865
|
+
};
|
|
3866
|
+
/**
|
|
3867
|
+
* Where the contact works, as their card records it.
|
|
3868
|
+
*/
|
|
3869
|
+
type WhatsAppContactOrg = {
|
|
3870
|
+
company?: string;
|
|
3871
|
+
department?: string;
|
|
3872
|
+
title?: string;
|
|
3873
|
+
};
|
|
3874
|
+
/**
|
|
3875
|
+
* One phone number on a shared contact card.
|
|
3876
|
+
*/
|
|
3877
|
+
type WhatsAppContactPhone = {
|
|
3878
|
+
/**
|
|
3879
|
+
* The number as the card holds it, normalized to E.164 where we can parse it. A card is whatever the contact's device stored, so a number that no country's numbering plan accepts, an extension among them, is passed through exactly as it arrived rather than dropped. Parse defensively: most values are E.164 and none is guaranteed to be.
|
|
3880
|
+
*
|
|
3881
|
+
*/
|
|
3882
|
+
phone_number?: string;
|
|
3883
|
+
/**
|
|
3884
|
+
* The label the contact's device attached, for example `CELL`, `Home` or `iPhone`. Free text passed through verbatim: WhatsApp declares no vocabulary here and does not normalize the casing, so neither do we.
|
|
3885
|
+
*
|
|
3886
|
+
*/
|
|
3887
|
+
type?: string;
|
|
3888
|
+
};
|
|
3889
|
+
/**
|
|
3890
|
+
* One email address on a shared contact card.
|
|
3891
|
+
*/
|
|
3892
|
+
type WhatsAppContactEmail = {
|
|
3893
|
+
email?: string;
|
|
3894
|
+
/**
|
|
3895
|
+
* The label the contact's device attached, for example `Personal` or `Work`. Free text passed through verbatim.
|
|
3896
|
+
*
|
|
3897
|
+
*/
|
|
3898
|
+
type?: string;
|
|
3899
|
+
};
|
|
3900
|
+
/**
|
|
3901
|
+
* One website on a shared contact card.
|
|
3902
|
+
*/
|
|
3903
|
+
type WhatsAppContactUrl = {
|
|
3904
|
+
/**
|
|
3905
|
+
* The address as the card holds it, which is often bare rather than a full URL, so it is passed through as text rather than validated.
|
|
3906
|
+
*
|
|
3907
|
+
*/
|
|
3908
|
+
url?: string;
|
|
3909
|
+
/**
|
|
3910
|
+
* The label the contact's device attached, for example `Company`. Free text passed through verbatim.
|
|
3911
|
+
*
|
|
3912
|
+
*/
|
|
3913
|
+
type?: string;
|
|
3914
|
+
};
|
|
3915
|
+
/**
|
|
3916
|
+
* One postal address on a shared contact card.
|
|
3917
|
+
*/
|
|
3918
|
+
type WhatsAppContactAddress = {
|
|
3919
|
+
street?: string;
|
|
3920
|
+
city?: string;
|
|
3921
|
+
state?: string;
|
|
3922
|
+
zip?: string;
|
|
3923
|
+
country?: string;
|
|
3924
|
+
/**
|
|
3925
|
+
* The country as the card holds it, left exactly as WhatsApp sent it: it describes a postal address rather than a routing destination.
|
|
3926
|
+
*
|
|
3927
|
+
*/
|
|
3928
|
+
country_code?: string;
|
|
3929
|
+
/**
|
|
3930
|
+
* The label the contact's device attached, for example `Home`. Free text passed through verbatim.
|
|
3931
|
+
*
|
|
3932
|
+
*/
|
|
3933
|
+
type?: string;
|
|
3934
|
+
};
|
|
3935
|
+
/**
|
|
3936
|
+
* A contact card the contact shared, either by tapping a button that asked for their number or by sending a card from their address book. Inbound only.
|
|
3937
|
+
* Nothing here is required. WhatsApp sends the parts the card holds and omits the rest, and a card that arrives with only an `origin` is still meaningful, so an empty card reads back empty rather than being dropped.
|
|
3938
|
+
*
|
|
3939
|
+
*/
|
|
3940
|
+
type WhatsAppContactCard = {
|
|
3941
|
+
/**
|
|
3942
|
+
* Why the card arrived. `contact_request` means the contact tapped a button this workspace sent asking for their number, which is the only signal that the message answers that ask; `other` means they shared a card in the chat. Open enum: treat an unrecognized value as a way of sharing added since.
|
|
3943
|
+
*
|
|
3944
|
+
*/
|
|
3945
|
+
origin?: string;
|
|
3946
|
+
/**
|
|
3947
|
+
* The contact's card in vCard format. WhatsApp sends it on a card shared in the chat and omits it on a button tap, which carries the number alone.
|
|
3948
|
+
*
|
|
3949
|
+
*/
|
|
3950
|
+
vcard?: string;
|
|
3951
|
+
/**
|
|
3952
|
+
* The contact's name, when the card carries one.
|
|
3953
|
+
*/
|
|
3954
|
+
name?: WhatsAppContactName;
|
|
3955
|
+
/**
|
|
3956
|
+
* Where the contact works, when the card carries it.
|
|
3957
|
+
*/
|
|
3958
|
+
org?: WhatsAppContactOrg;
|
|
3959
|
+
/**
|
|
3960
|
+
* The contact's birthday, which WhatsApp sends as `YYYY-MM-DD`. Passed through as text rather than typed as a date: the value comes off the contact's own device unvalidated, and a card we could not parse would otherwise have to lose the field or fail the whole read.
|
|
3961
|
+
*
|
|
3962
|
+
*/
|
|
3963
|
+
birthday?: string;
|
|
3964
|
+
/**
|
|
3965
|
+
* The numbers on the card. A button tap carries the contact's own number here, which is the point of asking.
|
|
3966
|
+
*
|
|
3967
|
+
*/
|
|
3968
|
+
phone_numbers?: Array<WhatsAppContactPhone>;
|
|
3969
|
+
emails?: Array<WhatsAppContactEmail>;
|
|
3970
|
+
urls?: Array<WhatsAppContactUrl>;
|
|
3971
|
+
addresses?: Array<WhatsAppContactAddress>;
|
|
3972
|
+
};
|
|
3849
3973
|
/**
|
|
3850
3974
|
* A message whose content we do not model, named so it is visible in the message log rather than arriving empty. Inbound only.
|
|
3851
3975
|
*
|
|
@@ -3941,6 +4065,11 @@ type WhatsAppMessage = {
|
|
|
3941
4065
|
* Location the message carried.
|
|
3942
4066
|
*/
|
|
3943
4067
|
readonly location?: WhatsAppLocation;
|
|
4068
|
+
/**
|
|
4069
|
+
* Contact cards the contact shared, either by tapping a button that asked for their number or by sending a card from their address book. Inbound only: sending a contact card is not supported.
|
|
4070
|
+
*
|
|
4071
|
+
*/
|
|
4072
|
+
readonly contact_cards?: Array<WhatsAppContactCard>;
|
|
3944
4073
|
/**
|
|
3945
4074
|
* Set when the contact sent content we do not model, naming the WhatsApp content type so the message is not silently empty. Inbound only.
|
|
3946
4075
|
*
|
|
@@ -8126,6 +8255,11 @@ type EventWhatsAppReceivedData = EventWhatsAppBase & {
|
|
|
8126
8255
|
* Location the contact sent.
|
|
8127
8256
|
*/
|
|
8128
8257
|
location?: WhatsAppLocation;
|
|
8258
|
+
/**
|
|
8259
|
+
* Contact cards the contact shared, either by tapping a button that asked for their number or by sending a card from their address book.
|
|
8260
|
+
*
|
|
8261
|
+
*/
|
|
8262
|
+
contact_cards?: Array<WhatsAppContactCard>;
|
|
8129
8263
|
/**
|
|
8130
8264
|
* Set when the contact sent content the API does not model, naming the WhatsApp content type.
|
|
8131
8265
|
*
|
|
@@ -9147,7 +9281,7 @@ type ListSmsMessagesData = {
|
|
|
9147
9281
|
*/
|
|
9148
9282
|
direction?: MessageDirection;
|
|
9149
9283
|
/**
|
|
9150
|
-
* Keep only messages whose current `status` matches; repeat the parameter to match any of several. One of `scheduled`, `accepted`, `sent`, `delivered`, `undelivered`, `failed`, `rejected`, `canceled`, `expired`, or `received`.
|
|
9284
|
+
* Keep only messages whose current `status` matches; repeat the parameter to match any of several. One of `scheduled`, `accepted`, `sent`, `delivered`, `undelivered`, `failed`, `rejected`, `canceled`, `expired`, or `received`. `scheduled` and `canceled` are accepted but match nothing until send-later scheduling ships.
|
|
9151
9285
|
*
|
|
9152
9286
|
*/
|
|
9153
9287
|
status?: Array<string>;
|
package/dist/index.mjs
CHANGED
|
@@ -7378,9 +7378,9 @@ var BirdClient = class {
|
|
|
7378
7378
|
this.#headers = {
|
|
7379
7379
|
...opts.defaultHeaders,
|
|
7380
7380
|
Authorization: `Bearer ${opts.apiKey}`,
|
|
7381
|
-
"User-Agent": `bird-sdk-js/0.
|
|
7381
|
+
"User-Agent": `bird-sdk-js/0.39.0`,
|
|
7382
7382
|
"Bird-Surface": "sdk-js",
|
|
7383
|
-
"Bird-Version": "0.
|
|
7383
|
+
"Bird-Version": "0.39.0"
|
|
7384
7384
|
};
|
|
7385
7385
|
const caller = detectCaller();
|
|
7386
7386
|
if (caller) this.#headers["Bird-Caller"] = caller;
|
package/package.json
CHANGED