@messagebird/sdk 0.10.0 → 0.11.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 +61 -35
- package/dist/index.mjs +6 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -358,30 +358,21 @@ type EventWhatsAppSent = {
|
|
|
358
358
|
data: EventWhatsAppSentData;
|
|
359
359
|
};
|
|
360
360
|
/**
|
|
361
|
-
* Payload of the whatsapp.
|
|
362
|
-
*/
|
|
363
|
-
type EventWhatsAppReadData = EventWhatsAppBase;
|
|
364
|
-
/**
|
|
365
|
-
* The recipient read the message.
|
|
361
|
+
* Payload of the whatsapp.rejected event.
|
|
366
362
|
*/
|
|
367
|
-
type
|
|
363
|
+
type EventWhatsAppRejectedData = EventWhatsAppBase & {
|
|
368
364
|
/**
|
|
369
|
-
*
|
|
370
|
-
*/
|
|
371
|
-
type: "whatsapp.read";
|
|
372
|
-
/**
|
|
373
|
-
* Time the recipient read the message.
|
|
365
|
+
* Why the message was rejected before sending.
|
|
374
366
|
*/
|
|
375
|
-
|
|
376
|
-
data: EventWhatsAppReadData;
|
|
367
|
+
error: WhatsAppError;
|
|
377
368
|
};
|
|
378
369
|
/**
|
|
379
|
-
*
|
|
370
|
+
* Failure reason, uniform whether the failure happened internally or was reported by the WhatsApp network. `insufficient_balance`: the workspace could not afford the send. `price_not_found`: no price was configured for this destination/template combination. `internal_error`: an unexpected Bird-side failure. `undeliverable`: the recipient could not be reached (for example not on WhatsApp, or the number is invalid). `service_window_expired`: the 24-hour customer care window has closed and a free-form message cannot be sent; send a template instead. `rate_limited`: the send was throttled. `recipient_suppressed`: the recipient is on the workspace's suppression list; the message was rejected before sending. Open enum: new codes may be added over time, so treat any unrecognized value as a future code rather than an error.
|
|
380
371
|
*
|
|
381
372
|
*/
|
|
382
373
|
type WhatsAppErrorCode = string;
|
|
383
374
|
/**
|
|
384
|
-
* Failure detail for a message that could not be delivered.
|
|
375
|
+
* Failure detail for a message that could not be delivered or was rejected.
|
|
385
376
|
*/
|
|
386
377
|
type WhatsAppError = {
|
|
387
378
|
code: WhatsAppErrorCode;
|
|
@@ -398,6 +389,38 @@ type WhatsAppError = {
|
|
|
398
389
|
*/
|
|
399
390
|
readonly occurred_at: string;
|
|
400
391
|
} | null;
|
|
392
|
+
/**
|
|
393
|
+
* Bird rejected the message before sending it to WhatsApp (the recipient is on the workspace suppression list).
|
|
394
|
+
*/
|
|
395
|
+
type EventWhatsAppRejected = {
|
|
396
|
+
/**
|
|
397
|
+
* Event type.
|
|
398
|
+
*/
|
|
399
|
+
type: "whatsapp.rejected";
|
|
400
|
+
/**
|
|
401
|
+
* Time the rejection was recorded.
|
|
402
|
+
*/
|
|
403
|
+
timestamp: string;
|
|
404
|
+
data: EventWhatsAppRejectedData;
|
|
405
|
+
};
|
|
406
|
+
/**
|
|
407
|
+
* Payload of the whatsapp.read event.
|
|
408
|
+
*/
|
|
409
|
+
type EventWhatsAppReadData = EventWhatsAppBase;
|
|
410
|
+
/**
|
|
411
|
+
* The recipient read the message.
|
|
412
|
+
*/
|
|
413
|
+
type EventWhatsAppRead = {
|
|
414
|
+
/**
|
|
415
|
+
* Event type.
|
|
416
|
+
*/
|
|
417
|
+
type: "whatsapp.read";
|
|
418
|
+
/**
|
|
419
|
+
* Time the recipient read the message.
|
|
420
|
+
*/
|
|
421
|
+
timestamp: string;
|
|
422
|
+
data: EventWhatsAppReadData;
|
|
423
|
+
};
|
|
401
424
|
/**
|
|
402
425
|
* Payload of the whatsapp.failed event.
|
|
403
426
|
*/
|
|
@@ -458,7 +481,7 @@ type EventWhatsAppAccepted = {
|
|
|
458
481
|
data: EventWhatsAppAcceptedData;
|
|
459
482
|
};
|
|
460
483
|
/**
|
|
461
|
-
* Payload of the
|
|
484
|
+
* Payload of the voice_call.initiated event.
|
|
462
485
|
*/
|
|
463
486
|
type EventVoiceCallInitiatedData = EventVoiceBase;
|
|
464
487
|
/**
|
|
@@ -500,7 +523,7 @@ type EventVoiceCallInitiated = {
|
|
|
500
523
|
/**
|
|
501
524
|
* Event type.
|
|
502
525
|
*/
|
|
503
|
-
type: "
|
|
526
|
+
type: "voice_call.initiated";
|
|
504
527
|
/**
|
|
505
528
|
* Time the call was initiated.
|
|
506
529
|
*/
|
|
@@ -513,7 +536,7 @@ type EventVoiceCallInitiated = {
|
|
|
513
536
|
*/
|
|
514
537
|
type VoiceCallStatus = "answered" | "no_answer" | "busy" | "canceled" | "failed" | "rejected" | "unknown" | "ringing" | "in_progress";
|
|
515
538
|
/**
|
|
516
|
-
* Payload of the
|
|
539
|
+
* Payload of the voice_call.ended event.
|
|
517
540
|
*/
|
|
518
541
|
type EventVoiceCallEndedData = EventVoiceBase & {
|
|
519
542
|
status: VoiceCallStatus;
|
|
@@ -537,7 +560,7 @@ type EventVoiceCallEnded = {
|
|
|
537
560
|
/**
|
|
538
561
|
* Event type.
|
|
539
562
|
*/
|
|
540
|
-
type: "
|
|
563
|
+
type: "voice_call.ended";
|
|
541
564
|
/**
|
|
542
565
|
* When the call ended (BYE or final non-2xx response).
|
|
543
566
|
*/
|
|
@@ -545,7 +568,7 @@ type EventVoiceCallEnded = {
|
|
|
545
568
|
data: EventVoiceCallEndedData;
|
|
546
569
|
};
|
|
547
570
|
/**
|
|
548
|
-
* Payload of the
|
|
571
|
+
* Payload of the voice_call.answered event.
|
|
549
572
|
*/
|
|
550
573
|
type EventVoiceCallAnsweredData = EventVoiceBase;
|
|
551
574
|
/**
|
|
@@ -555,7 +578,7 @@ type EventVoiceCallAnswered = {
|
|
|
555
578
|
/**
|
|
556
579
|
* Event type.
|
|
557
580
|
*/
|
|
558
|
-
type: "
|
|
581
|
+
type: "voice_call.answered";
|
|
559
582
|
/**
|
|
560
583
|
* Time the call was answered.
|
|
561
584
|
*/
|
|
@@ -1795,11 +1818,11 @@ type WebhookEvent = ({
|
|
|
1795
1818
|
} & EventSmsTfnVerificationSubmitted) | ({
|
|
1796
1819
|
type: "sms.undelivered";
|
|
1797
1820
|
} & EventSmsUndelivered) | ({
|
|
1798
|
-
type: "
|
|
1821
|
+
type: "voice_call.answered";
|
|
1799
1822
|
} & EventVoiceCallAnswered) | ({
|
|
1800
|
-
type: "
|
|
1823
|
+
type: "voice_call.ended";
|
|
1801
1824
|
} & EventVoiceCallEnded) | ({
|
|
1802
|
-
type: "
|
|
1825
|
+
type: "voice_call.initiated";
|
|
1803
1826
|
} & EventVoiceCallInitiated) | ({
|
|
1804
1827
|
type: "whatsapp.accepted";
|
|
1805
1828
|
} & EventWhatsAppAccepted) | ({
|
|
@@ -1809,6 +1832,8 @@ type WebhookEvent = ({
|
|
|
1809
1832
|
} & EventWhatsAppFailed) | ({
|
|
1810
1833
|
type: "whatsapp.read";
|
|
1811
1834
|
} & EventWhatsAppRead) | ({
|
|
1835
|
+
type: "whatsapp.rejected";
|
|
1836
|
+
} & EventWhatsAppRejected) | ({
|
|
1812
1837
|
type: "whatsapp.sent";
|
|
1813
1838
|
} & EventWhatsAppSent);
|
|
1814
1839
|
type Timestamps = {
|
|
@@ -3339,10 +3364,10 @@ type WhatsAppTemplateSend = {
|
|
|
3339
3364
|
components?: Array<WhatsAppMessageTemplateComponent>;
|
|
3340
3365
|
};
|
|
3341
3366
|
/**
|
|
3342
|
-
* Delivery status. `accepted` (the initial status of an outbound send) means Bird accepted the request and it is queued for sending. `sent` means it was handed to the WhatsApp network. `delivered` is confirmed delivery to the recipient's device. `failed` is a terminal permanent failure. There is no `read` status: a read receipt is reported as `read_at` and a `whatsapp.read` event, not a status value. The remaining values are reserved and not returned today: `scheduled` (queued to send at a future time), `canceled` (a scheduled message canceled before sending), and `received` (an inbound message, `direction: inbound`, sent to you by a contact).
|
|
3367
|
+
* Delivery status. `accepted` (the initial status of an outbound send) means Bird accepted the request and it is queued for sending. `sent` means it was handed to the WhatsApp network. `delivered` is confirmed delivery to the recipient's device. `failed` is a terminal permanent failure. `rejected` means the recipient is on the workspace's suppression list; the message was not sent and not charged. There is no `read` status: a read receipt is reported as `read_at` and a `whatsapp.read` event, not a status value. The remaining values are reserved and not returned today: `scheduled` (queued to send at a future time), `canceled` (a scheduled message canceled before sending), and `received` (an inbound message, `direction: inbound`, sent to you by a contact).
|
|
3343
3368
|
*
|
|
3344
3369
|
*/
|
|
3345
|
-
type WhatsAppMessageStatus = "scheduled" | "accepted" | "sent" | "delivered" | "failed" | "canceled" | "received";
|
|
3370
|
+
type WhatsAppMessageStatus = "scheduled" | "accepted" | "sent" | "delivered" | "failed" | "rejected" | "canceled" | "received";
|
|
3346
3371
|
/**
|
|
3347
3372
|
* The template a message was sent from. On reads `name`, `language`, `category`, and `components` are always present; `components` is an empty array for an authentication template (the filled-in values, for example a verification code, are never returned).
|
|
3348
3373
|
*
|
|
@@ -4551,11 +4576,11 @@ type ListEmailMessagesData = {
|
|
|
4551
4576
|
*/
|
|
4552
4577
|
ending_before?: string;
|
|
4553
4578
|
/**
|
|
4554
|
-
* Return only resources created
|
|
4579
|
+
* Return only resources created at or after this timestamp (inclusive lower bound). Combine with `created_before` to filter to a time window. RFC 3339 / ISO 8601 with timezone.
|
|
4555
4580
|
*/
|
|
4556
4581
|
created_after?: string;
|
|
4557
4582
|
/**
|
|
4558
|
-
* Return only resources created strictly before this timestamp. RFC 3339 / ISO 8601 with timezone.
|
|
4583
|
+
* Return only resources created strictly before this timestamp (exclusive upper bound). Combine with `created_after` to filter to a time window. RFC 3339 / ISO 8601 with timezone.
|
|
4559
4584
|
*/
|
|
4560
4585
|
created_before?: string;
|
|
4561
4586
|
/**
|
|
@@ -4702,11 +4727,11 @@ type ListSmsMessagesData = {
|
|
|
4702
4727
|
*/
|
|
4703
4728
|
ending_before?: string;
|
|
4704
4729
|
/**
|
|
4705
|
-
* Return only resources created
|
|
4730
|
+
* Return only resources created at or after this timestamp (inclusive lower bound). Combine with `created_before` to filter to a time window. RFC 3339 / ISO 8601 with timezone.
|
|
4706
4731
|
*/
|
|
4707
4732
|
created_after?: string;
|
|
4708
4733
|
/**
|
|
4709
|
-
* Return only resources created strictly before this timestamp. RFC 3339 / ISO 8601 with timezone.
|
|
4734
|
+
* Return only resources created strictly before this timestamp (exclusive upper bound). Combine with `created_after` to filter to a time window. RFC 3339 / ISO 8601 with timezone.
|
|
4710
4735
|
*/
|
|
4711
4736
|
created_before?: string;
|
|
4712
4737
|
/**
|
|
@@ -4781,11 +4806,11 @@ type ListWhatsAppMessagesData = {
|
|
|
4781
4806
|
*/
|
|
4782
4807
|
ending_before?: string;
|
|
4783
4808
|
/**
|
|
4784
|
-
* Return only resources created
|
|
4809
|
+
* Return only resources created at or after this timestamp (inclusive lower bound). Combine with `created_before` to filter to a time window. RFC 3339 / ISO 8601 with timezone.
|
|
4785
4810
|
*/
|
|
4786
4811
|
created_after?: string;
|
|
4787
4812
|
/**
|
|
4788
|
-
* Return only resources created strictly before this timestamp. RFC 3339 / ISO 8601 with timezone.
|
|
4813
|
+
* Return only resources created strictly before this timestamp (exclusive upper bound). Combine with `created_after` to filter to a time window. RFC 3339 / ISO 8601 with timezone.
|
|
4789
4814
|
*/
|
|
4790
4815
|
created_before?: string;
|
|
4791
4816
|
/**
|
|
@@ -6937,13 +6962,14 @@ declare const WebhookEventType: {
|
|
|
6937
6962
|
readonly SmsTfnVerificationRejected: "sms.tfn_verification.rejected";
|
|
6938
6963
|
readonly SmsTfnVerificationSubmitted: "sms.tfn_verification.submitted";
|
|
6939
6964
|
readonly SmsUndelivered: "sms.undelivered";
|
|
6940
|
-
readonly VoiceCallAnswered: "
|
|
6941
|
-
readonly VoiceCallEnded: "
|
|
6942
|
-
readonly VoiceCallInitiated: "
|
|
6965
|
+
readonly VoiceCallAnswered: "voice_call.answered";
|
|
6966
|
+
readonly VoiceCallEnded: "voice_call.ended";
|
|
6967
|
+
readonly VoiceCallInitiated: "voice_call.initiated";
|
|
6943
6968
|
readonly WhatsappAccepted: "whatsapp.accepted";
|
|
6944
6969
|
readonly WhatsappDelivered: "whatsapp.delivered";
|
|
6945
6970
|
readonly WhatsappFailed: "whatsapp.failed";
|
|
6946
6971
|
readonly WhatsappRead: "whatsapp.read";
|
|
6972
|
+
readonly WhatsappRejected: "whatsapp.rejected";
|
|
6947
6973
|
readonly WhatsappSent: "whatsapp.sent";
|
|
6948
6974
|
};
|
|
6949
6975
|
/** A known webhook event type value. */
|
package/dist/index.mjs
CHANGED
|
@@ -3935,9 +3935,9 @@ var BirdClient = class {
|
|
|
3935
3935
|
this.#headers = {
|
|
3936
3936
|
...opts.defaultHeaders,
|
|
3937
3937
|
Authorization: `Bearer ${opts.apiKey}`,
|
|
3938
|
-
"User-Agent": `bird-sdk-js/0.
|
|
3938
|
+
"User-Agent": `bird-sdk-js/0.11.0`,
|
|
3939
3939
|
"Bird-Surface": "sdk-js",
|
|
3940
|
-
"Bird-Version": "0.
|
|
3940
|
+
"Bird-Version": "0.11.0"
|
|
3941
3941
|
};
|
|
3942
3942
|
const caller = detectCaller();
|
|
3943
3943
|
if (caller) this.#headers["Bird-Caller"] = caller;
|
|
@@ -4060,13 +4060,14 @@ const WebhookEventType = {
|
|
|
4060
4060
|
SmsTfnVerificationRejected: "sms.tfn_verification.rejected",
|
|
4061
4061
|
SmsTfnVerificationSubmitted: "sms.tfn_verification.submitted",
|
|
4062
4062
|
SmsUndelivered: "sms.undelivered",
|
|
4063
|
-
VoiceCallAnswered: "
|
|
4064
|
-
VoiceCallEnded: "
|
|
4065
|
-
VoiceCallInitiated: "
|
|
4063
|
+
VoiceCallAnswered: "voice_call.answered",
|
|
4064
|
+
VoiceCallEnded: "voice_call.ended",
|
|
4065
|
+
VoiceCallInitiated: "voice_call.initiated",
|
|
4066
4066
|
WhatsappAccepted: "whatsapp.accepted",
|
|
4067
4067
|
WhatsappDelivered: "whatsapp.delivered",
|
|
4068
4068
|
WhatsappFailed: "whatsapp.failed",
|
|
4069
4069
|
WhatsappRead: "whatsapp.read",
|
|
4070
|
+
WhatsappRejected: "whatsapp.rejected",
|
|
4070
4071
|
WhatsappSent: "whatsapp.sent"
|
|
4071
4072
|
};
|
|
4072
4073
|
//#endregion
|