@zernio/node 0.2.187 → 0.2.188

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.
@@ -3687,6 +3687,155 @@ export type event4 = 'ad.status_changed';
3687
3687
  */
3688
3688
  export type level = 'CAMPAIGN' | 'AD_SET' | 'AD';
3689
3689
 
3690
+ /**
3691
+ * Webhook payload for the `call.ended` event. Fires on call hangup
3692
+ * with the duration and a zero-markup billing breakdown.
3693
+ *
3694
+ */
3695
+ export type WebhookPayloadCallEnded = {
3696
+ id: string;
3697
+ event: 'call.ended';
3698
+ call: {
3699
+ id?: string;
3700
+ metaCallId?: (string) | null;
3701
+ accountId?: string;
3702
+ phoneNumberId?: string;
3703
+ direction?: 'inbound' | 'outbound';
3704
+ from?: string;
3705
+ to?: string;
3706
+ startedAt?: string;
3707
+ endedAt?: string;
3708
+ durationSeconds?: number;
3709
+ endReason?: 'hangup' | 'no_answer' | 'rejected' | 'error';
3710
+ recordingUrl?: string;
3711
+ recordingExpiresAt?: string;
3712
+ billing?: {
3713
+ metaCostUSD?: number;
3714
+ telnyxCostUSD?: number;
3715
+ recordingCostUSD?: number;
3716
+ totalCostUSD?: number;
3717
+ };
3718
+ };
3719
+ account: InboxWebhookAccount;
3720
+ timestamp: string;
3721
+ };
3722
+
3723
+ export type event5 = 'call.ended';
3724
+
3725
+ export type direction2 = 'inbound' | 'outbound';
3726
+
3727
+ export type endReason = 'hangup' | 'no_answer' | 'rejected' | 'error';
3728
+
3729
+ /**
3730
+ * Webhook payload for the `call.failed` event. Fired when a call
3731
+ * setup or in-progress call fails.
3732
+ *
3733
+ */
3734
+ export type WebhookPayloadCallFailed = {
3735
+ id: string;
3736
+ event: 'call.failed';
3737
+ call: {
3738
+ id?: string;
3739
+ metaCallId?: (string) | null;
3740
+ accountId?: string;
3741
+ phoneNumberId?: string;
3742
+ direction?: 'inbound' | 'outbound';
3743
+ from?: string;
3744
+ to?: string;
3745
+ failedAt?: string;
3746
+ error?: {
3747
+ code?: number;
3748
+ message?: string;
3749
+ };
3750
+ };
3751
+ account: InboxWebhookAccount;
3752
+ timestamp: string;
3753
+ };
3754
+
3755
+ export type event6 = 'call.failed';
3756
+
3757
+ /**
3758
+ * Webhook payload for the `call.permission_request` event. Fires
3759
+ * when a consumer accepts or rejects an interactive
3760
+ * `call_permission_request` message.
3761
+ *
3762
+ */
3763
+ export type WebhookPayloadCallPermissionRequest = {
3764
+ id: string;
3765
+ event: 'call.permission_request';
3766
+ permission: {
3767
+ /**
3768
+ * Consumer wa_id who replied
3769
+ */
3770
+ from?: string;
3771
+ response?: 'accept' | 'reject';
3772
+ isPermanent?: boolean;
3773
+ /**
3774
+ * Present only when temporary
3775
+ */
3776
+ expirationTimestamp?: string;
3777
+ /**
3778
+ * Meta's response source, typically `user_action`
3779
+ */
3780
+ responseSource?: string;
3781
+ };
3782
+ account: InboxWebhookAccount;
3783
+ timestamp: string;
3784
+ };
3785
+
3786
+ export type event7 = 'call.permission_request';
3787
+
3788
+ export type response = 'accept' | 'reject';
3789
+
3790
+ /**
3791
+ * Webhook payload for the `call.received` event. Fires for both
3792
+ * inbound (UIC) and outbound (BIC) calls; branch on
3793
+ * `call.direction` to tell them apart.
3794
+ *
3795
+ */
3796
+ export type WebhookPayloadCallReceived = {
3797
+ /**
3798
+ * Stable webhook event ID
3799
+ */
3800
+ id: string;
3801
+ event: 'call.received';
3802
+ call: {
3803
+ /**
3804
+ * Internal Zernio Call doc id
3805
+ */
3806
+ id?: string;
3807
+ /**
3808
+ * Meta wacid.* call id when known
3809
+ */
3810
+ metaCallId?: (string) | null;
3811
+ accountId?: string;
3812
+ /**
3813
+ * Meta phone_number_id
3814
+ */
3815
+ phoneNumberId?: string;
3816
+ direction?: 'inbound' | 'outbound';
3817
+ /**
3818
+ * Consumer wa_id / E.164
3819
+ */
3820
+ from?: string;
3821
+ /**
3822
+ * Business number (E.164)
3823
+ */
3824
+ to?: string;
3825
+ /**
3826
+ * Destination snapshot at routing time
3827
+ */
3828
+ forwardTo?: string;
3829
+ contactId?: string;
3830
+ conversationId?: string;
3831
+ startedAt?: string;
3832
+ };
3833
+ account: InboxWebhookAccount;
3834
+ timestamp: string;
3835
+ };
3836
+
3837
+ export type event8 = 'call.received';
3838
+
3690
3839
  /**
3691
3840
  * Webhook payload for comment received events (Instagram, Facebook, Twitter/X, YouTube, LinkedIn, Bluesky, Reddit)
3692
3841
  */
@@ -3778,7 +3927,7 @@ export type WebhookPayloadComment = {
3778
3927
  timestamp: string;
3779
3928
  };
3780
3929
 
3781
- export type event5 = 'comment.received';
3930
+ export type event9 = 'comment.received';
3782
3931
 
3783
3932
  export type platform7 = 'instagram' | 'facebook' | 'twitter' | 'youtube' | 'linkedin' | 'bluesky' | 'reddit';
3784
3933
 
@@ -3832,7 +3981,7 @@ export type WebhookPayloadConversationStarted = {
3832
3981
  timestamp: string;
3833
3982
  };
3834
3983
 
3835
- export type event6 = 'conversation.started';
3984
+ export type event10 = 'conversation.started';
3836
3985
 
3837
3986
  export type platform8 = 'instagram' | 'facebook' | 'telegram' | 'whatsapp' | 'twitter' | 'reddit' | 'bluesky';
3838
3987
 
@@ -3894,7 +4043,7 @@ export type WebhookPayloadLead = {
3894
4043
  timestamp: string;
3895
4044
  };
3896
4045
 
3897
- export type event7 = 'lead.received';
4046
+ export type event11 = 'lead.received';
3898
4047
 
3899
4048
  export type platform9 = 'facebook';
3900
4049
 
@@ -4170,7 +4319,7 @@ export type WebhookPayloadMessage = {
4170
4319
  timestamp: string;
4171
4320
  };
4172
4321
 
4173
- export type event8 = 'message.received';
4322
+ export type event12 = 'message.received';
4174
4323
 
4175
4324
  /**
4176
4325
  * WhatsApp only. Which kind of interactive reply the user sent:
@@ -4202,7 +4351,7 @@ export type WebhookPayloadMessageDeleted = {
4202
4351
  timestamp: string;
4203
4352
  };
4204
4353
 
4205
- export type event9 = 'message.deleted';
4354
+ export type event13 = 'message.deleted';
4206
4355
 
4207
4356
  /**
4208
4357
  * Shared payload for message.delivered, message.read, and
@@ -4237,7 +4386,7 @@ export type WebhookPayloadMessageDeliveryStatus = {
4237
4386
  timestamp: string;
4238
4387
  };
4239
4388
 
4240
- export type event10 = 'message.delivered' | 'message.read' | 'message.failed';
4389
+ export type event14 = 'message.delivered' | 'message.read' | 'message.failed';
4241
4390
 
4242
4391
  /**
4243
4392
  * Webhook payload for message.edited events. Fires when the sender
@@ -4279,7 +4428,7 @@ export type WebhookPayloadMessageEdited = {
4279
4428
  timestamp: string;
4280
4429
  };
4281
4430
 
4282
- export type event11 = 'message.edited';
4431
+ export type event15 = 'message.edited';
4283
4432
 
4284
4433
  /**
4285
4434
  * Webhook payload for message sent events (fired when a message is sent via the API)
@@ -4343,7 +4492,7 @@ export type WebhookPayloadMessageSent = {
4343
4492
  timestamp: string;
4344
4493
  };
4345
4494
 
4346
- export type event12 = 'message.sent';
4495
+ export type event16 = 'message.sent';
4347
4496
 
4348
4497
  /**
4349
4498
  * Webhook payload for post events
@@ -4371,7 +4520,7 @@ export type WebhookPayloadPost = {
4371
4520
  timestamp: string;
4372
4521
  };
4373
4522
 
4374
- export type event13 = 'post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled';
4523
+ export type event17 = 'post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled';
4375
4524
 
4376
4525
  /**
4377
4526
  * Webhook payload for the per-platform terminal events
@@ -4447,7 +4596,7 @@ export type WebhookPayloadPostPlatform = {
4447
4596
  timestamp: string;
4448
4597
  };
4449
4598
 
4450
- export type event14 = 'post.platform.published' | 'post.platform.failed';
4599
+ export type event18 = 'post.platform.published' | 'post.platform.failed';
4451
4600
 
4452
4601
  /**
4453
4602
  * Webhook payload for reaction received events (WhatsApp, Telegram)
@@ -4498,7 +4647,7 @@ export type WebhookPayloadReaction = {
4498
4647
  timestamp: string;
4499
4648
  };
4500
4649
 
4501
- export type event15 = 'reaction.received';
4650
+ export type event19 = 'reaction.received';
4502
4651
 
4503
4652
  export type action = 'added' | 'removed';
4504
4653
 
@@ -4520,7 +4669,7 @@ export type WebhookPayloadReviewNew = {
4520
4669
  timestamp: string;
4521
4670
  };
4522
4671
 
4523
- export type event16 = 'review.new';
4672
+ export type event20 = 'review.new';
4524
4673
 
4525
4674
  /**
4526
4675
  * Webhook payload for the review.updated event. Fired when the reviewer edits
@@ -4544,7 +4693,7 @@ export type WebhookPayloadReviewUpdated = {
4544
4693
  timestamp: string;
4545
4694
  };
4546
4695
 
4547
- export type event17 = 'review.updated';
4696
+ export type event21 = 'review.updated';
4548
4697
 
4549
4698
  /**
4550
4699
  * Webhook payload for test deliveries
@@ -4562,7 +4711,7 @@ export type WebhookPayloadTest = {
4562
4711
  timestamp: string;
4563
4712
  };
4564
4713
 
4565
- export type event18 = 'webhook.test';
4714
+ export type event22 = 'webhook.test';
4566
4715
 
4567
4716
  /**
4568
4717
  * Webhook payload for the `whatsapp.template.status_updated` event.
@@ -4617,7 +4766,7 @@ export type WebhookPayloadWhatsAppTemplateStatusUpdated = {
4617
4766
  timestamp: string;
4618
4767
  };
4619
4768
 
4620
- export type event19 = 'whatsapp.template.status_updated';
4769
+ export type event23 = 'whatsapp.template.status_updated';
4621
4770
 
4622
4771
  export type platform10 = 'whatsapp';
4623
4772
 
@@ -12642,6 +12791,262 @@ export type DeleteWhatsAppTemplateError = (unknown | {
12642
12791
  error?: string;
12643
12792
  });
12644
12793
 
12794
+ export type GetWhatsAppCallingConfigData = {
12795
+ query: {
12796
+ /**
12797
+ * WhatsApp social account ID
12798
+ */
12799
+ accountId: string;
12800
+ };
12801
+ };
12802
+
12803
+ export type GetWhatsAppCallingConfigResponse = ({
12804
+ /**
12805
+ * WhatsAppPhoneNumber Mongo ID (use on /v1/whatsapp/phone-numbers/{id}/calling)
12806
+ */
12807
+ phoneNumberDocId?: string;
12808
+ phoneNumber?: string;
12809
+ callingEnabled?: boolean;
12810
+ /**
12811
+ * tel:+E164 / sip:... / wss://... destination
12812
+ */
12813
+ forwardTo?: (string) | null;
12814
+ recordingEnabled?: boolean;
12815
+ sipAuthUsername?: (string) | null;
12816
+ /**
12817
+ * True when a SIP digest password is stored. The plaintext is never returned.
12818
+ */
12819
+ sipAuthPasswordConfigured?: boolean;
12820
+ callIconCountries?: Array<(string)> | null;
12821
+ });
12822
+
12823
+ export type GetWhatsAppCallingConfigError = ({
12824
+ error?: string;
12825
+ } | unknown);
12826
+
12827
+ export type EnableWhatsAppCallingData = {
12828
+ body: {
12829
+ accountId: string;
12830
+ /**
12831
+ * tel:+E164 / sip:... / wss://... destination
12832
+ */
12833
+ forwardTo: string;
12834
+ sipAuthUsername?: string;
12835
+ /**
12836
+ * Stored encrypted
12837
+ */
12838
+ sipAuthPassword?: string;
12839
+ recordingEnabled?: boolean;
12840
+ callIconCountries?: Array<(string)>;
12841
+ };
12842
+ path: {
12843
+ /**
12844
+ * WhatsAppPhoneNumber Mongo ID
12845
+ */
12846
+ id: string;
12847
+ };
12848
+ };
12849
+
12850
+ export type EnableWhatsAppCallingResponse = ({
12851
+ success?: boolean;
12852
+ callingEnabled?: boolean;
12853
+ sipHostname?: string;
12854
+ forwardTo?: string;
12855
+ });
12856
+
12857
+ export type EnableWhatsAppCallingError = ({
12858
+ error?: string;
12859
+ } | unknown);
12860
+
12861
+ export type UpdateWhatsAppCallingData = {
12862
+ body: {
12863
+ accountId: string;
12864
+ forwardTo?: string;
12865
+ sipAuthUsername?: (string) | null;
12866
+ sipAuthPassword?: (string) | null;
12867
+ recordingEnabled?: boolean;
12868
+ callIconCountries?: Array<(string)> | null;
12869
+ };
12870
+ path: {
12871
+ id: string;
12872
+ };
12873
+ };
12874
+
12875
+ export type UpdateWhatsAppCallingResponse = (unknown);
12876
+
12877
+ export type UpdateWhatsAppCallingError = ({
12878
+ error?: string;
12879
+ } | unknown);
12880
+
12881
+ export type DisableWhatsAppCallingData = {
12882
+ path: {
12883
+ id: string;
12884
+ };
12885
+ query: {
12886
+ accountId: string;
12887
+ };
12888
+ };
12889
+
12890
+ export type DisableWhatsAppCallingResponse = (unknown);
12891
+
12892
+ export type DisableWhatsAppCallingError = ({
12893
+ error?: string;
12894
+ } | unknown);
12895
+
12896
+ export type GetWhatsAppCallPermissionsData = {
12897
+ query: {
12898
+ accountId: string;
12899
+ /**
12900
+ * Consumer wa_id (E.164
12901
+ */
12902
+ to: string;
12903
+ };
12904
+ };
12905
+
12906
+ export type GetWhatsAppCallPermissionsResponse = ({
12907
+ permission?: {
12908
+ status?: 'temporary' | 'no_permission' | 'permanent';
12909
+ /**
12910
+ * Unix seconds when temporary
12911
+ */
12912
+ expiration_time?: number;
12913
+ };
12914
+ actions?: Array<{
12915
+ action_name?: 'send_call_permission_request' | 'start_call';
12916
+ can_perform_action?: boolean;
12917
+ }>;
12918
+ });
12919
+
12920
+ export type GetWhatsAppCallPermissionsError = ({
12921
+ error?: string;
12922
+ } | unknown);
12923
+
12924
+ export type InitiateWhatsAppCallData = {
12925
+ body: {
12926
+ accountId: string;
12927
+ /**
12928
+ * Consumer wa_id (E.164
12929
+ */
12930
+ to: string;
12931
+ /**
12932
+ * Per-call destination override. Same accepted shape as the
12933
+ * number's stored forwardTo (tel:+E164, sip:..., wss://...).
12934
+ *
12935
+ */
12936
+ forwardTo?: string;
12937
+ recordOverride?: boolean;
12938
+ /**
12939
+ * Accepted for forward compatibility. Not currently echoed
12940
+ * back in webhook payloads (SIP-first flow does not pass
12941
+ * through Meta's Graph API where Meta would echo this).
12942
+ *
12943
+ */
12944
+ biz_opaque_callback_data?: string;
12945
+ };
12946
+ };
12947
+
12948
+ export type InitiateWhatsAppCallResponse = ({
12949
+ success?: boolean;
12950
+ /**
12951
+ * Internal Call doc ID
12952
+ */
12953
+ callId?: string;
12954
+ /**
12955
+ * Telnyx call_control_id of the outbound leg
12956
+ */
12957
+ telnyxCallControlId?: string;
12958
+ status?: 'dialing';
12959
+ direction?: 'outbound';
12960
+ to?: string;
12961
+ forwardTo?: (string) | null;
12962
+ recordingEnabled?: boolean;
12963
+ });
12964
+
12965
+ export type InitiateWhatsAppCallError = ({
12966
+ error?: string;
12967
+ } | unknown);
12968
+
12969
+ export type ListWhatsAppCallsData = {
12970
+ query: {
12971
+ accountId: string;
12972
+ direction?: 'inbound' | 'outbound';
12973
+ limit?: number;
12974
+ since?: string;
12975
+ status?: 'ringing' | 'answered' | 'ended' | 'failed';
12976
+ until?: string;
12977
+ };
12978
+ };
12979
+
12980
+ export type ListWhatsAppCallsResponse = ({
12981
+ calls?: Array<{
12982
+ _id?: string;
12983
+ direction?: 'inbound' | 'outbound';
12984
+ from?: string;
12985
+ to?: string;
12986
+ status?: 'ringing' | 'answered' | 'ended' | 'failed';
12987
+ startedAt?: string;
12988
+ endedAt?: string;
12989
+ durationSeconds?: number;
12990
+ endReason?: 'hangup' | 'no_answer' | 'rejected' | 'error';
12991
+ recordingUrl?: string;
12992
+ billing?: {
12993
+ metaCostUSD?: number;
12994
+ telnyxCostUSD?: number;
12995
+ recordingCostUSD?: number;
12996
+ totalCostUSD?: number;
12997
+ currency?: string;
12998
+ };
12999
+ }>;
13000
+ });
13001
+
13002
+ export type ListWhatsAppCallsError = ({
13003
+ error?: string;
13004
+ });
13005
+
13006
+ export type GetWhatsAppCallData = {
13007
+ path: {
13008
+ callId: string;
13009
+ };
13010
+ query: {
13011
+ accountId: string;
13012
+ };
13013
+ };
13014
+
13015
+ export type GetWhatsAppCallResponse = ({
13016
+ call?: {
13017
+ [key: string]: unknown;
13018
+ };
13019
+ });
13020
+
13021
+ export type GetWhatsAppCallError = ({
13022
+ error?: string;
13023
+ } | unknown);
13024
+
13025
+ export type GetWhatsAppCallEstimateData = {
13026
+ query: {
13027
+ accountId: string;
13028
+ minutes?: number;
13029
+ recording?: boolean;
13030
+ to: string;
13031
+ };
13032
+ };
13033
+
13034
+ export type GetWhatsAppCallEstimateResponse = ({
13035
+ destinationCountry?: (string) | null;
13036
+ perMinuteUsd?: number;
13037
+ breakdown?: {
13038
+ metaMinutes?: number;
13039
+ metaCostUSD?: number;
13040
+ telnyxCostUSD?: number;
13041
+ recordingCostUSD?: number;
13042
+ totalCostUSD?: number;
13043
+ };
13044
+ });
13045
+
13046
+ export type GetWhatsAppCallEstimateError = ({
13047
+ error?: string;
13048
+ });
13049
+
12645
13050
  export type GetWhatsAppLibraryTemplateData = {
12646
13051
  query: {
12647
13052
  /**