@messagebird/sdk 0.9.1 → 0.9.3

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
@@ -457,6 +457,111 @@ type EventWhatsAppAccepted = {
457
457
  timestamp: string;
458
458
  data: EventWhatsAppAcceptedData;
459
459
  };
460
+ /**
461
+ * Payload of the voice.call.initiated event.
462
+ */
463
+ type EventVoiceCallInitiatedData = EventVoiceBase;
464
+ /**
465
+ * Whether the call originated from your PBX (outbound) or arrived from a remote party (inbound).
466
+ */
467
+ type VoiceCallDirection = "inbound" | "outbound";
468
+ type VoiceSessionId = string;
469
+ type VoiceCallId = string;
470
+ /**
471
+ * Identity fields shared by every voice call lifecycle event payload.
472
+ */
473
+ type EventVoiceBase = {
474
+ /**
475
+ * ID of the call record.
476
+ */
477
+ call_id: VoiceCallId;
478
+ /**
479
+ * Session identifier shared across all legs of a multi-party or transferred call. Use this to correlate related call records. Null when session correlation is not available for the call.
480
+ */
481
+ session_id?: VoiceSessionId | null;
482
+ /**
483
+ * ID of the workspace.
484
+ */
485
+ workspace_id: WorkspaceId;
486
+ direction: VoiceCallDirection;
487
+ /**
488
+ * Calling party number in E.164 format.
489
+ */
490
+ src_number: string;
491
+ /**
492
+ * Called party number in E.164 format.
493
+ */
494
+ dst_number: string;
495
+ };
496
+ /**
497
+ * A call was initiated — Bird received the INVITE and began routing it.
498
+ */
499
+ type EventVoiceCallInitiated = {
500
+ /**
501
+ * Event type.
502
+ */
503
+ type: "voice.call.initiated";
504
+ /**
505
+ * Time the call was initiated.
506
+ */
507
+ timestamp: string;
508
+ data: EventVoiceCallInitiatedData;
509
+ };
510
+ /**
511
+ * Call status. v1 records are always terminal and carry one of answered, no_answer, failed, rejected, or unknown. The remaining values are declared ahead of planned features so their arrival is not a breaking contract change: busy and canceled arrive with inbound (DID) termination — today both outcomes are folded into failed — and ringing and in_progress with a live-calls surface.
512
+ *
513
+ */
514
+ type VoiceCallStatus = "answered" | "no_answer" | "busy" | "canceled" | "failed" | "rejected" | "unknown" | "ringing" | "in_progress";
515
+ /**
516
+ * Payload of the voice.call.ended event.
517
+ */
518
+ type EventVoiceCallEndedData = EventVoiceBase & {
519
+ status: VoiceCallStatus;
520
+ /**
521
+ * Final SIP response code received from the carrier. Null when no SIP response was received, for example on timeout or DNS failure.
522
+ */
523
+ sip_response_code: number | null;
524
+ /**
525
+ * Total call duration in milliseconds, measured from the first INVITE to the BYE or final response.
526
+ */
527
+ duration_ms: number;
528
+ /**
529
+ * Billable duration in milliseconds, measured from answer to call end. Zero for unanswered calls.
530
+ */
531
+ billable_ms: number;
532
+ };
533
+ /**
534
+ * The call ended — a BYE or final non-2xx response was received and the call record was written.
535
+ */
536
+ type EventVoiceCallEnded = {
537
+ /**
538
+ * Event type.
539
+ */
540
+ type: "voice.call.ended";
541
+ /**
542
+ * When the call ended (BYE or final non-2xx response).
543
+ */
544
+ timestamp: string;
545
+ data: EventVoiceCallEndedData;
546
+ };
547
+ /**
548
+ * Payload of the voice.call.answered event.
549
+ */
550
+ type EventVoiceCallAnsweredData = EventVoiceBase;
551
+ /**
552
+ * The called party answered — the carrier returned a 200 OK and media is flowing.
553
+ */
554
+ type EventVoiceCallAnswered = {
555
+ /**
556
+ * Event type.
557
+ */
558
+ type: "voice.call.answered";
559
+ /**
560
+ * Time the call was answered.
561
+ */
562
+ timestamp: string;
563
+ data: EventVoiceCallAnsweredData;
564
+ };
460
565
  /**
461
566
  * Payload of the sms.undelivered event.
462
567
  */
@@ -687,9 +792,10 @@ type EventEmailSuppressionCreatedData = {
687
792
  */
688
793
  email: string;
689
794
  /**
690
- * Why the address was suppressed.
795
+ * Why the address was suppressed. This list grows over time — treat unknown values as informational rather than rejecting the event.
796
+ *
691
797
  */
692
- reason: "hard_bounce" | "complaint" | "unsubscribe" | "manual";
798
+ reason: string;
693
799
  /**
694
800
  * The workspace the suppression belongs to.
695
801
  */
@@ -1569,6 +1675,12 @@ type WebhookEvent = ({
1569
1675
  } & EventSmsSent) | ({
1570
1676
  type: "sms.undelivered";
1571
1677
  } & EventSmsUndelivered) | ({
1678
+ type: "voice.call.answered";
1679
+ } & EventVoiceCallAnswered) | ({
1680
+ type: "voice.call.ended";
1681
+ } & EventVoiceCallEnded) | ({
1682
+ type: "voice.call.initiated";
1683
+ } & EventVoiceCallInitiated) | ({
1572
1684
  type: "whatsapp.accepted";
1573
1685
  } & EventWhatsAppAccepted) | ({
1574
1686
  type: "whatsapp.delivered";
@@ -4730,6 +4842,9 @@ declare const WebhookEventType: {
4730
4842
  readonly SmsRejected: "sms.rejected";
4731
4843
  readonly SmsSent: "sms.sent";
4732
4844
  readonly SmsUndelivered: "sms.undelivered";
4845
+ readonly VoiceCallAnswered: "voice.call.answered";
4846
+ readonly VoiceCallEnded: "voice.call.ended";
4847
+ readonly VoiceCallInitiated: "voice.call.initiated";
4733
4848
  readonly WhatsappAccepted: "whatsapp.accepted";
4734
4849
  readonly WhatsappDelivered: "whatsapp.delivered";
4735
4850
  readonly WhatsappFailed: "whatsapp.failed";
package/dist/index.mjs CHANGED
@@ -3153,9 +3153,9 @@ var BirdClient = class {
3153
3153
  this.#headers = {
3154
3154
  ...opts.defaultHeaders,
3155
3155
  Authorization: `Bearer ${opts.apiKey}`,
3156
- "User-Agent": `bird-sdk-js/0.9.1`,
3156
+ "User-Agent": `bird-sdk-js/0.9.3`,
3157
3157
  "Bird-Surface": "sdk-js",
3158
- "Bird-Version": "0.9.1"
3158
+ "Bird-Version": "0.9.3"
3159
3159
  };
3160
3160
  const caller = detectCaller();
3161
3161
  if (caller) this.#headers["Bird-Caller"] = caller;
@@ -3274,6 +3274,9 @@ const WebhookEventType = {
3274
3274
  SmsRejected: "sms.rejected",
3275
3275
  SmsSent: "sms.sent",
3276
3276
  SmsUndelivered: "sms.undelivered",
3277
+ VoiceCallAnswered: "voice.call.answered",
3278
+ VoiceCallEnded: "voice.call.ended",
3279
+ VoiceCallInitiated: "voice.call.initiated",
3277
3280
  WhatsappAccepted: "whatsapp.accepted",
3278
3281
  WhatsappDelivered: "whatsapp.delivered",
3279
3282
  WhatsappFailed: "whatsapp.failed",