meta-cloud-api 1.1.10 → 1.1.11

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.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Agent } from "https";
2
+ import { IncomingHttpHeaders, IncomingMessage } from "http";
2
3
 
3
4
  //#region src/types/enums.d.ts
4
5
  declare namespace enums_d_exports {
@@ -745,6 +746,131 @@ type WabaConfigType = {
745
746
  [WabaConfigEnum.Passphrase]: string;
746
747
  };
747
748
  //#endregion
749
+ //#region src/types/request.d.ts
750
+ type GeneralRequestBody = Record<string, unknown>;
751
+ interface GeneralHeaderInterface {
752
+ /**
753
+ * Authorization token. This is required for all HTTP requests made to the graph API.
754
+ * @default 'Bearer '
755
+ */
756
+ Authorization: string;
757
+ /**
758
+ * Content type of the message being sent. This is required for all HTTP requests made to the graph API.
759
+ * @default 'application/json'
760
+ */
761
+ 'Content-Type': string;
762
+ /**
763
+ * User agent field sent in all requests. This is used to gather SDK usage metrics and help
764
+ * better triage support requests.
765
+ * @default `WA_SDK/${ SDK_version } (Node.js ${ process.version })`
766
+ */
767
+ 'User-Agent': string;
768
+ }
769
+ interface RequesterResponseInterface<T> {
770
+ json: () => Promise<T>;
771
+ }
772
+ interface ResponseSuccess {
773
+ success: boolean;
774
+ }
775
+ interface ResponseData<T> {
776
+ data: T;
777
+ }
778
+ interface ResponsePagination<T> {
779
+ data: T[];
780
+ paging: Paging;
781
+ }
782
+ interface Paging {
783
+ cursors: {
784
+ before: string;
785
+ after: string;
786
+ };
787
+ next: string;
788
+ }
789
+ declare class RequesterClass {
790
+ constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
791
+ sendRequest: (method: HttpMethodsEnum, path: string, timeout: number, body?: GeneralRequestBody, contentType?: string, additionalHeaders?: Record<string, string>) => Promise<RequesterResponseInterface<unknown>>;
792
+ getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: GeneralRequestBody, additionalHeaders?: Record<string, string>): Promise<T>;
793
+ sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
794
+ sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
795
+ }
796
+ //#endregion
797
+ //#region src/types/httpsClient.d.ts
798
+ type ResponseHeaderValue = string | string[] | undefined;
799
+ type ResponseHeaders = Record<string, ResponseHeaderValue>;
800
+ type ResponseJSONBody = Record<string, unknown>;
801
+ declare class HttpsClientResponseClass {
802
+ constructor(resp: Response);
803
+ statusCode: () => number;
804
+ headers: () => ResponseHeaders;
805
+ rawResponse: () => Response;
806
+ json: () => Promise<ResponseJSONBody>;
807
+ }
808
+ declare class HttpsClientClass {
809
+ constructor();
810
+ clearSockets: () => boolean;
811
+ sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
812
+ }
813
+ //#endregion
814
+ //#region src/utils/http/httpsClient.d.ts
815
+ declare class HttpsClient implements HttpsClientClass {
816
+ agent: Agent;
817
+ constructor();
818
+ clearSockets(): boolean;
819
+ sendRequest(hostname: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null): Promise<HttpsClientResponseClass>;
820
+ }
821
+ //#endregion
822
+ //#region src/utils/http/request.d.ts
823
+ declare class Requester implements RequesterClass {
824
+ client: Readonly<HttpsClient>;
825
+ accessToken: Readonly<string>;
826
+ phoneNumberId: Readonly<number>;
827
+ businessAcctId: Readonly<string>;
828
+ apiVersion: Readonly<string>;
829
+ userAgent: Readonly<string>;
830
+ host: Readonly<string>;
831
+ protocol: Readonly<string>;
832
+ constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
833
+ buildHeader(contentType: string, additionalHeaders?: Record<string, string>): HeadersInit;
834
+ buildCAPIPath(endpoint: string): string;
835
+ sendRequest(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, contentType?: string, additionalHeaders?: Record<string, string>): Promise<HttpsClientResponseClass>;
836
+ getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, additionalHeaders?: Record<string, string>): Promise<T>;
837
+ sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
838
+ sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
839
+ }
840
+ //#endregion
841
+ //#region src/types/base.d.ts
842
+ declare class BaseClass {
843
+ constructor(config: WabaConfigType);
844
+ }
845
+ declare class BaseAPI implements BaseClass {
846
+ protected config: WabaConfigType;
847
+ protected client: RequesterClass;
848
+ constructor(config: WabaConfigType, client: RequesterClass);
849
+ protected sendJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
850
+ protected sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
851
+ protected sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
852
+ }
853
+ //#endregion
854
+ //#region src/api/encryption/types/publicKey.d.ts
855
+ type EncryptionPublicKeyResponse = ResponseData<{
856
+ business_public_key: string;
857
+ business_public_key_signature_status: 'VALID' | 'MISMATCH';
858
+ }>;
859
+ //#endregion
860
+ //#region src/api/encryption/types/common.d.ts
861
+ interface EncryptionClass {
862
+ getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
863
+ setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
864
+ }
865
+ //#endregion
866
+ //#region src/api/encryption/EncryptionApi.d.ts
867
+ declare class EncryptionApi extends BaseAPI implements EncryptionClass {
868
+ private readonly endpoint;
869
+ constructor(config: WabaConfigType, client: RequesterClass);
870
+ getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
871
+ setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
872
+ }
873
+ //#endregion
748
874
  //#region src/core/webhook/types.d.ts
749
875
  interface WebhookContact {
750
876
  /**
@@ -1401,64 +1527,13 @@ declare enum MessageStatus {
1401
1527
  SENT = "sent",
1402
1528
  }
1403
1529
  //#endregion
1404
- //#region src/types/request.d.ts
1405
- type GeneralRequestBody = Record<string, unknown>;
1406
- interface RequesterResponseInterface<T> {
1407
- json: () => Promise<T>;
1408
- }
1409
- interface ResponseSuccess {
1410
- success: boolean;
1411
- }
1412
- interface ResponseData<T> {
1413
- data: T;
1414
- }
1415
- interface ResponsePagination<T> {
1416
- data: T[];
1417
- paging: Paging;
1418
- }
1419
- interface Paging {
1420
- cursors: {
1421
- before: string;
1422
- after: string;
1423
- };
1424
- next: string;
1425
- }
1426
- declare class RequesterClass {
1427
- constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
1428
- sendRequest: (method: HttpMethodsEnum, path: string, timeout: number, body?: GeneralRequestBody, contentType?: string, additionalHeaders?: Record<string, string>) => Promise<RequesterResponseInterface<unknown>>;
1429
- getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: GeneralRequestBody, additionalHeaders?: Record<string, string>): Promise<T>;
1430
- sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
1431
- sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
1432
- }
1433
- //#endregion
1434
- //#region src/types/httpsClient.d.ts
1435
- type ResponseHeaderValue = string | string[] | undefined;
1436
- type ResponseHeaders = Record<string, ResponseHeaderValue>;
1437
- type ResponseJSONBody = Record<string, unknown>;
1438
- declare class HttpsClientResponseClass {
1439
- constructor(resp: Response);
1440
- statusCode: () => number;
1441
- headers: () => ResponseHeaders;
1442
- rawResponse: () => Response;
1443
- json: () => Promise<ResponseJSONBody>;
1444
- }
1445
- declare class HttpsClientClass {
1446
- constructor();
1447
- clearSockets: () => boolean;
1448
- sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
1449
- }
1450
- //#endregion
1451
- //#region src/types/base.d.ts
1452
- declare class BaseClass {
1453
- constructor(config: WabaConfigType);
1454
- }
1455
- declare class BaseAPI implements BaseClass {
1456
- protected config: WabaConfigType;
1457
- protected client: RequesterClass;
1458
- constructor(config: WabaConfigType, client: RequesterClass);
1459
- protected sendJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
1460
- protected sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
1461
- protected sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
1530
+ //#region src/types/logger.d.ts
1531
+ interface LoggerInterface {
1532
+ log(...data: any[]): void;
1533
+ error(...data: any[]): void;
1534
+ warn(...data: any[]): void;
1535
+ info(...data: any[]): void;
1536
+ debug(...data: any[]): void;
1462
1537
  }
1463
1538
  //#endregion
1464
1539
  //#region src/api/profile/types/upload.d.ts
@@ -2545,57 +2620,232 @@ interface MediaClass {
2545
2620
  downloadMedia(mediaUrl: string): Promise<Blob>;
2546
2621
  }
2547
2622
  //#endregion
2548
- //#region src/api/flow/types/common.d.ts
2623
+ //#region src/api/qrCode/types/common.d.ts
2624
+ type QrCodeResponse = {
2625
+ code: string;
2626
+ prefilled_message: string;
2627
+ deep_link_url: string;
2628
+ qr_image_url?: string;
2629
+ };
2630
+ type QrCodesResponse = ResponseData<QrCodeResponse[]>;
2631
+ type CreateQrCodeRequest = {
2632
+ prefilled_message: string;
2633
+ generate_qr_image?: 'SVG' | 'PNG';
2634
+ };
2635
+ type UpdateQrCodeRequest = {
2636
+ code: string;
2637
+ prefilled_message: string;
2638
+ };
2639
+ interface QrCodeClass {
2640
+ createQrCode(request: CreateQrCodeRequest): Promise<QrCodeResponse>;
2641
+ getQrCodes(): Promise<QrCodesResponse>;
2642
+ getQrCode(qrCodeId: string): Promise<QrCodeResponse>;
2643
+ updateQrCode(request: UpdateQrCodeRequest): Promise<QrCodeResponse>;
2644
+ deleteQrCode(qrCodeId: string): Promise<ResponseSuccess>;
2645
+ }
2646
+ //#endregion
2647
+ //#region src/api/waba/types/common.d.ts
2549
2648
  /**
2550
- * Enum for Flow Status
2649
+ * WhatsApp Business Account subscription configuration
2551
2650
  */
2552
- declare enum FlowStatusEnum {
2553
- Draft = "DRAFT",
2554
- Published = "PUBLISHED",
2555
- Throttled = "THROTTLED",
2556
- Blocked = "BLOCKED",
2557
- Deprecated = "DEPRECATED",
2558
- }
2651
+ type WabaSubscription = {
2652
+ whatsapp_business_api_data: {
2653
+ id: string;
2654
+ link: string;
2655
+ name: string;
2656
+ category: string;
2657
+ };
2658
+ override_callback_uri?: string;
2659
+ };
2559
2660
  /**
2560
- * Enum for Flow Categories
2661
+ * Parameters for updating WABA subscription
2561
2662
  */
2562
- declare enum FlowCategoryEnum {
2563
- SignUp = "SIGN_UP",
2564
- SignIn = "SIGN_IN",
2565
- AppointmentBooking = "APPOINTMENT_BOOKING",
2566
- LeadGeneration = "LEAD_GENERATION",
2567
- ContactUs = "CONTACT_US",
2568
- CustomerSupport = "CUSTOMER_SUPPORT",
2569
- Survey = "SURVEY",
2570
- Other = "OTHER",
2571
- }
2572
- declare enum FlowActionEnum {
2573
- INIT = "INIT",
2574
- BACK = "BACK",
2575
- DATA_EXCHANGE = "data_exchange",
2663
+ interface UpdateWabaSubscription {
2664
+ override_callback_uri: string;
2665
+ verify_token: string;
2576
2666
  }
2577
2667
  /**
2578
- * Enum for Flow Types in webhook handlers
2579
- * Used to register handlers for specific flow events
2668
+ * Response containing all WABA subscriptions
2580
2669
  */
2581
- declare enum FlowTypeEnum {
2582
- /** Health check/ping requests */
2583
- Ping = "ping",
2584
- /** Data exchange requests */
2585
- Change = "data_exchange",
2586
- /** Error notification requests */
2587
- Error = "error",
2588
- /** Match all flow action types */
2589
- All = "*",
2670
+ interface WabaSubscriptions {
2671
+ data: Array<WabaSubscription>;
2590
2672
  }
2591
- type FlowType = (typeof FlowTypeEnum)[keyof typeof FlowTypeEnum];
2592
2673
  /**
2593
- * Flow Validation Error Pointer
2674
+ * WABA account review status enumeration
2594
2675
  */
2595
- interface FlowValidationErrorPointer {
2596
- line_start: number;
2597
- line_end: number;
2598
- column_start: number;
2676
+ declare enum WabaAccountReviewStatus {
2677
+ Approved = "APPROVED",
2678
+ Active = "ACTIVE",
2679
+ Inactive = "INACTIVE",
2680
+ Disabled = "DISABLED",
2681
+ }
2682
+ /**
2683
+ * WABA health status for message sending capability
2684
+ */
2685
+ declare enum WabaHealthStatusCanSendMessage {
2686
+ Blocked = "BLOCKED",
2687
+ Limited = "LIMITED",
2688
+ Available = "AVAILABLE",
2689
+ }
2690
+ /**
2691
+ * WABA account status enumeration
2692
+ */
2693
+ declare enum WabaAccountStatus {
2694
+ Approved = "APPROVED",
2695
+ Active = "ACTIVE",
2696
+ Inactive = "INACTIVE",
2697
+ Disabled = "DISABLED",
2698
+ }
2699
+ /**
2700
+ * Business verification status enumeration
2701
+ */
2702
+ declare enum WabaBusinessVerificationStatus {
2703
+ Verified = "verified",
2704
+ PendingSubmission = "pending_submission",
2705
+ Unverified = "unverified",
2706
+ Rejected = "rejected",
2707
+ }
2708
+ /**
2709
+ * WABA health status error details
2710
+ */
2711
+ interface WabaHealthStatusError {
2712
+ error_code?: number;
2713
+ error_description?: string;
2714
+ possible_solution?: string;
2715
+ }
2716
+ /**
2717
+ * WABA health status entity information
2718
+ */
2719
+ interface WabaHealthStatusEntity {
2720
+ entity_type?: string;
2721
+ id?: string;
2722
+ can_send_message?: string;
2723
+ errors?: WabaHealthStatusError[];
2724
+ }
2725
+ /**
2726
+ * Overall WABA health status
2727
+ */
2728
+ interface WabaHealthStatus {
2729
+ can_send_message?: WabaHealthStatusCanSendMessage;
2730
+ entities?: WabaHealthStatusEntity[];
2731
+ }
2732
+ /**
2733
+ * WhatsApp Business Account information
2734
+ */
2735
+ interface WabaAccount {
2736
+ account_review_status?: WabaAccountReviewStatus;
2737
+ id?: string;
2738
+ health_status?: WabaHealthStatus;
2739
+ status?: WabaAccountStatus;
2740
+ business_verification_status?: WabaBusinessVerificationStatus;
2741
+ message_template_namespace?: string;
2742
+ name?: string;
2743
+ ownership_type?: string;
2744
+ currency?: string;
2745
+ }
2746
+ /**
2747
+ * Available fields for WABA account queries
2748
+ */
2749
+ type WabaAccountFields = 'id' | 'name' | 'account_review_status' | 'auth_international_rate_eligibility' | 'business_verification_status' | 'country' | 'currency' | 'health_status' | 'status' | 'ownership_type' | 'message_template_namespace';
2750
+ /**
2751
+ * Parameter type for specifying which WABA account fields to retrieve
2752
+ */
2753
+ type WabaAccountFieldsParam = WabaAccountFields[];
2754
+ /**
2755
+ * Interface defining all WABA API methods
2756
+ */
2757
+ interface WABAClass {
2758
+ getWabaAccount(fields?: WabaAccountFieldsParam): Promise<WabaAccount>;
2759
+ getAllWabaSubscriptions(): Promise<WabaSubscriptions>;
2760
+ updateWabaSubscription(params: UpdateWabaSubscription): Promise<ResponseSuccess>;
2761
+ unsubscribeFromWaba(): Promise<ResponseSuccess>;
2762
+ }
2763
+ //#endregion
2764
+ //#region src/api/registration/types/common.d.ts
2765
+ type RegistrationRequest = {
2766
+ messaging_product: 'whatsapp';
2767
+ pin: string;
2768
+ data_localization_region?: DataLocalizationRegionEnum;
2769
+ };
2770
+ interface RegistrationClass {
2771
+ register(pin: string, dataLocalizationRegion?: DataLocalizationRegionEnum): Promise<ResponseSuccess>;
2772
+ deregister(): Promise<ResponseSuccess>;
2773
+ }
2774
+ //#endregion
2775
+ //#region src/api/twoStepVerification/types/common.d.ts
2776
+ type TwoStepVerificationRequest = {
2777
+ pin: string;
2778
+ };
2779
+ interface TwoStepVerificationClass {
2780
+ setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
2781
+ }
2782
+ //#endregion
2783
+ //#region src/utils/isMetaError.d.ts
2784
+ interface MetaError extends Error {
2785
+ error: {
2786
+ message: string;
2787
+ type: string;
2788
+ code: number;
2789
+ error_data?: {
2790
+ messaging_product: 'whatsapp';
2791
+ details: string;
2792
+ };
2793
+ error_subcode?: number;
2794
+ fbtrace_id: string;
2795
+ };
2796
+ }
2797
+ //#endregion
2798
+ //#region src/api/flow/types/common.d.ts
2799
+ /**
2800
+ * Enum for Flow Status
2801
+ */
2802
+ declare enum FlowStatusEnum {
2803
+ Draft = "DRAFT",
2804
+ Published = "PUBLISHED",
2805
+ Throttled = "THROTTLED",
2806
+ Blocked = "BLOCKED",
2807
+ Deprecated = "DEPRECATED",
2808
+ }
2809
+ /**
2810
+ * Enum for Flow Categories
2811
+ */
2812
+ declare enum FlowCategoryEnum {
2813
+ SignUp = "SIGN_UP",
2814
+ SignIn = "SIGN_IN",
2815
+ AppointmentBooking = "APPOINTMENT_BOOKING",
2816
+ LeadGeneration = "LEAD_GENERATION",
2817
+ ContactUs = "CONTACT_US",
2818
+ CustomerSupport = "CUSTOMER_SUPPORT",
2819
+ Survey = "SURVEY",
2820
+ Other = "OTHER",
2821
+ }
2822
+ declare enum FlowActionEnum {
2823
+ INIT = "INIT",
2824
+ BACK = "BACK",
2825
+ DATA_EXCHANGE = "data_exchange",
2826
+ }
2827
+ /**
2828
+ * Enum for Flow Types in webhook handlers
2829
+ * Used to register handlers for specific flow events
2830
+ */
2831
+ declare enum FlowTypeEnum {
2832
+ /** Health check/ping requests */
2833
+ Ping = "ping",
2834
+ /** Data exchange requests */
2835
+ Change = "data_exchange",
2836
+ /** Error notification requests */
2837
+ Error = "error",
2838
+ /** Match all flow action types */
2839
+ All = "*",
2840
+ }
2841
+ type FlowType = (typeof FlowTypeEnum)[keyof typeof FlowTypeEnum];
2842
+ /**
2843
+ * Flow Validation Error Pointer
2844
+ */
2845
+ interface FlowValidationErrorPointer {
2846
+ line_start: number;
2847
+ line_end: number;
2848
+ column_start: number;
2599
2849
  column_end: number;
2600
2850
  path: string;
2601
2851
  }
@@ -2717,6 +2967,40 @@ interface ValidateFlowJsonResponse {
2717
2967
  success: boolean;
2718
2968
  validation_errors?: FlowValidationError[];
2719
2969
  }
2970
+ /**
2971
+ * WhatsApp Flow Endpoint - Encrypted Request Payload
2972
+ * Represents the raw encrypted data received from WhatsApp
2973
+ */
2974
+ interface FlowEncryptedRequestPayload {
2975
+ encrypted_aes_key: string;
2976
+ encrypted_flow_data: string;
2977
+ initial_vector: string;
2978
+ }
2979
+ /**
2980
+ * WhatsApp Flow Endpoint - Decrypted Request Response
2981
+ * Represents the successfully decrypted data and encryption keys
2982
+ */
2983
+ interface FlowDecryptedRequestResponse {
2984
+ decryptedBody: any;
2985
+ aesKeyBuffer: Buffer;
2986
+ initialVectorBuffer: Buffer;
2987
+ }
2988
+ /**
2989
+ * WhatsApp Flow Endpoint - HTTP Request with Body
2990
+ * Represents an HTTP request with the encrypted payload
2991
+ */
2992
+ interface FlowHttpRequest extends IncomingMessage {
2993
+ body: FlowEncryptedRequestPayload;
2994
+ headers: IncomingHttpHeaders;
2995
+ }
2996
+ /**
2997
+ * WhatsApp Flow Endpoint - Health Check Request
2998
+ * Represents the structure of a health check request
2999
+ */
3000
+ interface FlowHealthCheckRequest {
3001
+ action: 'ping';
3002
+ version: '3.0';
3003
+ }
2720
3004
  /**
2721
3005
  * WhatsApp Flow Endpoint - Health Check Response
2722
3006
  * The expected response structure for health check requests
@@ -2726,6 +3010,19 @@ interface FlowHealthCheckResponse {
2726
3010
  status: 'active';
2727
3011
  };
2728
3012
  }
3013
+ /**
3014
+ * WhatsApp Flow Endpoint - Data Exchange Request
3015
+ * Represents the structure of a data exchange request
3016
+ */
3017
+ interface FlowDataExchangeRequest {
3018
+ version: '3.0';
3019
+ action: FlowActionEnum;
3020
+ screen: string;
3021
+ flow_token: string;
3022
+ data?: Record<string, any> & {
3023
+ error_message?: string;
3024
+ };
3025
+ }
2729
3026
  /**
2730
3027
  * WhatsApp Flow Endpoint - Data Exchange Response
2731
3028
  * The expected response structure for data exchange requests
@@ -2751,6 +3048,20 @@ interface FlowSuccessScreenResponse {
2751
3048
  };
2752
3049
  };
2753
3050
  }
3051
+ /**
3052
+ * WhatsApp Flow Endpoint - Error Notification Request
3053
+ * Represents the structure of an error notification request
3054
+ */
3055
+ interface FlowErrorNotificationRequest {
3056
+ version: '3.0';
3057
+ action: Exclude<FlowActionEnum, FlowActionEnum.BACK>;
3058
+ screen: string;
3059
+ flow_token: string;
3060
+ data: {
3061
+ error: string;
3062
+ error_message: string;
3063
+ };
3064
+ }
2754
3065
  /**
2755
3066
  * WhatsApp Flow Endpoint - Error Notification Response
2756
3067
  * The expected response structure for error notification requests
@@ -2884,213 +3195,6 @@ interface FlowClass {
2884
3195
  }): Promise<FlowMigrationResponse>;
2885
3196
  }
2886
3197
  //#endregion
2887
- //#region src/api/qrCode/types/common.d.ts
2888
- type QrCodeResponse = {
2889
- code: string;
2890
- prefilled_message: string;
2891
- deep_link_url: string;
2892
- qr_image_url?: string;
2893
- };
2894
- type QrCodesResponse = ResponseData<QrCodeResponse[]>;
2895
- type CreateQrCodeRequest = {
2896
- prefilled_message: string;
2897
- generate_qr_image?: 'SVG' | 'PNG';
2898
- };
2899
- type UpdateQrCodeRequest = {
2900
- code: string;
2901
- prefilled_message: string;
2902
- };
2903
- interface QrCodeClass {
2904
- createQrCode(request: CreateQrCodeRequest): Promise<QrCodeResponse>;
2905
- getQrCodes(): Promise<QrCodesResponse>;
2906
- getQrCode(qrCodeId: string): Promise<QrCodeResponse>;
2907
- updateQrCode(request: UpdateQrCodeRequest): Promise<QrCodeResponse>;
2908
- deleteQrCode(qrCodeId: string): Promise<ResponseSuccess>;
2909
- }
2910
- //#endregion
2911
- //#region src/api/waba/types/common.d.ts
2912
- /**
2913
- * WhatsApp Business Account subscription configuration
2914
- */
2915
- type WabaSubscription = {
2916
- whatsapp_business_api_data: {
2917
- id: string;
2918
- link: string;
2919
- name: string;
2920
- category: string;
2921
- };
2922
- override_callback_uri?: string;
2923
- };
2924
- /**
2925
- * Parameters for updating WABA subscription
2926
- */
2927
- interface UpdateWabaSubscription {
2928
- override_callback_uri: string;
2929
- verify_token: string;
2930
- }
2931
- /**
2932
- * Response containing all WABA subscriptions
2933
- */
2934
- interface WabaSubscriptions {
2935
- data: Array<WabaSubscription>;
2936
- }
2937
- /**
2938
- * WABA account review status enumeration
2939
- */
2940
- declare enum WabaAccountReviewStatus {
2941
- Approved = "APPROVED",
2942
- Active = "ACTIVE",
2943
- Inactive = "INACTIVE",
2944
- Disabled = "DISABLED",
2945
- }
2946
- /**
2947
- * WABA health status for message sending capability
2948
- */
2949
- declare enum WabaHealthStatusCanSendMessage {
2950
- Blocked = "BLOCKED",
2951
- Limited = "LIMITED",
2952
- Available = "AVAILABLE",
2953
- }
2954
- /**
2955
- * WABA account status enumeration
2956
- */
2957
- declare enum WabaAccountStatus {
2958
- Approved = "APPROVED",
2959
- Active = "ACTIVE",
2960
- Inactive = "INACTIVE",
2961
- Disabled = "DISABLED",
2962
- }
2963
- /**
2964
- * Business verification status enumeration
2965
- */
2966
- declare enum WabaBusinessVerificationStatus {
2967
- Verified = "verified",
2968
- PendingSubmission = "pending_submission",
2969
- Unverified = "unverified",
2970
- Rejected = "rejected",
2971
- }
2972
- /**
2973
- * WABA health status error details
2974
- */
2975
- interface WabaHealthStatusError {
2976
- error_code?: number;
2977
- error_description?: string;
2978
- possible_solution?: string;
2979
- }
2980
- /**
2981
- * WABA health status entity information
2982
- */
2983
- interface WabaHealthStatusEntity {
2984
- entity_type?: string;
2985
- id?: string;
2986
- can_send_message?: string;
2987
- errors?: WabaHealthStatusError[];
2988
- }
2989
- /**
2990
- * Overall WABA health status
2991
- */
2992
- interface WabaHealthStatus {
2993
- can_send_message?: WabaHealthStatusCanSendMessage;
2994
- entities?: WabaHealthStatusEntity[];
2995
- }
2996
- /**
2997
- * WhatsApp Business Account information
2998
- */
2999
- interface WabaAccount {
3000
- account_review_status?: WabaAccountReviewStatus;
3001
- id?: string;
3002
- health_status?: WabaHealthStatus;
3003
- status?: WabaAccountStatus;
3004
- business_verification_status?: WabaBusinessVerificationStatus;
3005
- message_template_namespace?: string;
3006
- name?: string;
3007
- ownership_type?: string;
3008
- currency?: string;
3009
- }
3010
- /**
3011
- * Available fields for WABA account queries
3012
- */
3013
- type WabaAccountFields = 'id' | 'name' | 'account_review_status' | 'auth_international_rate_eligibility' | 'business_verification_status' | 'country' | 'currency' | 'health_status' | 'status' | 'ownership_type' | 'message_template_namespace';
3014
- /**
3015
- * Parameter type for specifying which WABA account fields to retrieve
3016
- */
3017
- type WabaAccountFieldsParam = WabaAccountFields[];
3018
- /**
3019
- * Interface defining all WABA API methods
3020
- */
3021
- interface WABAClass {
3022
- getWabaAccount(fields?: WabaAccountFieldsParam): Promise<WabaAccount>;
3023
- getAllWabaSubscriptions(): Promise<WabaSubscriptions>;
3024
- updateWabaSubscription(params: UpdateWabaSubscription): Promise<ResponseSuccess>;
3025
- unsubscribeFromWaba(): Promise<ResponseSuccess>;
3026
- }
3027
- //#endregion
3028
- //#region src/api/registration/types/common.d.ts
3029
- type RegistrationRequest = {
3030
- messaging_product: 'whatsapp';
3031
- pin: string;
3032
- data_localization_region?: DataLocalizationRegionEnum;
3033
- };
3034
- interface RegistrationClass {
3035
- register(pin: string, dataLocalizationRegion?: DataLocalizationRegionEnum): Promise<ResponseSuccess>;
3036
- deregister(): Promise<ResponseSuccess>;
3037
- }
3038
- //#endregion
3039
- //#region src/api/twoStepVerification/types/common.d.ts
3040
- type TwoStepVerificationRequest = {
3041
- pin: string;
3042
- };
3043
- interface TwoStepVerificationClass {
3044
- setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
3045
- }
3046
- //#endregion
3047
- //#region src/api/encryption/types/publicKey.d.ts
3048
- type EncryptionPublicKeyResponse = ResponseData<{
3049
- business_public_key: string;
3050
- business_public_key_signature_status: 'VALID' | 'MISMATCH';
3051
- }>;
3052
- //#endregion
3053
- //#region src/api/encryption/types/common.d.ts
3054
- interface EncryptionClass {
3055
- getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
3056
- setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
3057
- }
3058
- //#endregion
3059
- //#region src/utils/http/httpsClient.d.ts
3060
- declare class HttpsClient implements HttpsClientClass {
3061
- agent: Agent;
3062
- constructor();
3063
- clearSockets(): boolean;
3064
- sendRequest(hostname: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null): Promise<HttpsClientResponseClass>;
3065
- }
3066
- //#endregion
3067
- //#region src/utils/http/request.d.ts
3068
- declare class Requester implements RequesterClass {
3069
- client: Readonly<HttpsClient>;
3070
- accessToken: Readonly<string>;
3071
- phoneNumberId: Readonly<number>;
3072
- businessAcctId: Readonly<string>;
3073
- apiVersion: Readonly<string>;
3074
- userAgent: Readonly<string>;
3075
- host: Readonly<string>;
3076
- protocol: Readonly<string>;
3077
- constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
3078
- buildHeader(contentType: string, additionalHeaders?: Record<string, string>): HeadersInit;
3079
- buildCAPIPath(endpoint: string): string;
3080
- sendRequest(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, contentType?: string, additionalHeaders?: Record<string, string>): Promise<HttpsClientResponseClass>;
3081
- getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, additionalHeaders?: Record<string, string>): Promise<T>;
3082
- sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
3083
- sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
3084
- }
3085
- //#endregion
3086
- //#region src/api/encryption/EncryptionApi.d.ts
3087
- declare class EncryptionApi extends BaseAPI implements EncryptionClass {
3088
- private readonly endpoint;
3089
- constructor(config: WabaConfigType, client: RequesterClass);
3090
- getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
3091
- setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
3092
- }
3093
- //#endregion
3094
3198
  //#region src/api/flow/FlowApi.d.ts
3095
3199
  /**
3096
3200
  * API for managing WhatsApp Flows.
@@ -4567,5 +4671,5 @@ declare function nextjsAppWebhookHandler(config: NextJsAppWebhookConfig): {
4567
4671
  //#region src/core/webhook/utils/generateXHub256Sig.d.ts
4568
4672
  declare const generateXHub256Sig: (body: string, appSecret: string) => string;
4569
4673
  //#endregion
4570
- export { AccountMode, AudioMediaObject, AudioMessageBuilder, AuthenticationTemplateOptions, BodyOptions, BusinessProfileApi, BusinessProfileClass, BusinessProfileData, BusinessProfileField, BusinessProfileFieldsParam, BusinessProfileResponse, ButtonOptions, CarouselCard, CarouselOptions, CatalogButton, CatalogTemplateOptions, CodeVerificationStatus, ComponentTypes, ContactMessageBuilder, ContactMessageFactory, ContactObject, CopyCodeButton, CouponTemplateOptions, CreateFlowResponse, CreateQrCodeRequest, CreateUploadSessionParams, CurrencyParameter, CurrencyParameterHelper, Cursors, DateTimeParameter, DateTimeParameterHelper, DocumentMediaObject, DocumentMessageBuilder, EncryptionApi, EncryptionClass, EncryptionPublicKeyResponse, ExpressRequest, ExpressResponse, ExpressWebhookConfig, Flow, FlowActionEnum, FlowApi, FlowAssetsResponse, FlowButton, FlowCategoryEnum, FlowClass, FlowEndpointRequest, FlowEndpointResponse, FlowHandler, FlowMigrationResponse, FlowPreviewResponse, FlowStatusEnum, FlowType, FlowTypeEnum, FlowValidationError, FlowsListResponse, FooterOptions, GetUploadHandleParams, HeaderOptions, HealthStatus, HealthStatusEntity, ImageMediaObject, ImageMessageBuilder, InteractiveMessageBuilder, InteractiveMessageFactory, InteractiveObject, LimitedTimeOfferOptions, LimitedTimeOfferTemplateOptions, LocationMessageBuilder, LocationMessageFactory, LocationObject, LocationParameter, MPMButton, MPMTemplateOptions, MediaApi, MediaCardCarouselTemplateOptions, MediaCarouselCard, MediaClass, MediaMessageFactory, MediaParameter, MediaResponse, MediasResponse, MessagesApi as MessageApi, MessagesApi, MessageHandler, MessageRequestParams, MessageStatus, MessageTemplateObject, MessagesResponse, MessagingLimitTier, NextFunction, NextJsAppWebhookConfig, NextJsWebhookConfig, OTPButton, OTPTemplateOptions, ParameterObject, PhoneNumberApi, PhoneNumberButton, PhoneNumberClass, PhoneNumberResponse, PhoneNumbersResponse, PlatformType, ProductCardCarouselTemplateOptions, ProductCarouselCard, ProductParameter, ProductSection, QrCodeApi, QrCodeClass, QrCodeResponse, QrCodesResponse, QualityRating, QualityScore, QuickReplyButton, ReactionMessageBuilder, ReactionMessageFactory, ReactionParams, RegistrationApi, RegistrationClass, RegistrationRequest, RequestVerificationCodeRequest, SPMButton, SPMTemplateOptions, StatusParams, StickerMediaObject, StickerMessageBuilder, TemplateApi, TemplateBody, TemplateButton, TemplateButtons, TemplateCarousel, TemplateClass, TemplateDeleteParams, TemplateFooter, TemplateFormat, TemplateGetParams, TemplateHeader, TemplateHeaderExample, TemplateLimitedTimeOffer, TemplateMessageBuilder, TemplateMessageFactory, TemplateOptions, TemplateParameter, TemplateRequestBody, TemplateResponse, TextMessageBuilder, TextMessageFactory, TextMessageParams, TextObject, TextParameter, Throughput, ThroughputLevel, TwoStepVerificationApi, TwoStepVerificationClass, TwoStepVerificationParams, TwoStepVerificationRequest, URLButton, UpdateBusinessProfileRequest, UpdateFlowResponse, UpdateQrCodeRequest, UpdateWabaSubscription, UploadBusinessProfileResponse, UploadHandle, UploadMediaParams, UploadMediaResponse, UploadSession, UploadSessionResponse, ValidateFlowJsonResponse, VerifyCodeRequest, VideoMediaObject, VideoMessageBuilder, WABAClass, WabaAccount, WabaApi, WabaSubscriptions, WebhookContact, WebhookEvent, WebhookMessage, WebhookProcessor, WebhookResponse, WhatsApp, constructFullUrl, createAuthenticationTemplate, createCatalogTemplate, createCouponTemplate, createLimitedTimeOfferTemplate, createMPMTemplate, createMediaCardCarouselTemplate, createOTPTemplate, createProductCardCarouselTemplate, createSPMTemplate, createTemplate, expressWebhookHandler, generateXHub256Sig, nextjsAppWebhookHandler, nextjsWebhookHandler, processFlowRequest, processWebhookMessages };
4674
+ export { AccountMode, AudioMediaObject, AudioMediaTypesEnum, AudioMessageBuilder, AuthenticationTemplateOptions, BaseClass, BodyOptions, BusinessProfileApi, BusinessProfileClass, BusinessProfileData, BusinessProfileField, BusinessProfileFieldsParam, BusinessProfileResponse, BusinessVerticalEnum, ButtonOptions, ButtonPositionEnum, CarouselCard, CarouselOptions, CatalogButton, CatalogTemplateOptions, CategoryEnum, CodeVerificationStatus, ComponentTypes, ComponentTypesEnum, ContactMessageBuilder, ContactMessageFactory, ContactObject, ConversationTypesEnum, CopyCodeButton, CouponTemplateOptions, CreateFlowResponse, CreateQrCodeRequest, CreateUploadSessionParams, CurrencyCodesEnum, CurrencyParameter, CurrencyParameterHelper, Cursors, DataLocalizationRegionEnum, DateTimeParameter, DateTimeParameterHelper, DocumentMediaObject, DocumentMediaTypesEnum, DocumentMessageBuilder, EncryptionApi, EncryptionClass, EncryptionPublicKeyResponse, ExpressRequest, ExpressResponse, ExpressWebhookConfig, Flow, FlowActionEnum, FlowApi, FlowAsset, FlowAssetsResponse, FlowButton, FlowCategoryEnum, FlowClass, FlowDataExchangeRequest, FlowDataExchangeResponse, FlowDecryptedRequestResponse, FlowEncryptedRequestPayload, FlowEndpointRequest, FlowEndpointResponse, FlowErrorNotificationRequest, FlowErrorNotificationResponse, FlowHandler, FlowHealthCheckRequest, FlowHealthCheckResponse, FlowHttpRequest, FlowMigrationFailure, FlowMigrationResponse, FlowMigrationResult, FlowPreview, FlowPreviewResponse, FlowStatusEnum, FlowSuccessScreenResponse, FlowType, FlowTypeEnum, FlowValidationError, FlowValidationErrorPointer, FlowsListResponse, FooterOptions, GeneralHeaderInterface, GeneralMessageBody, GeneralRequestBody, GetUploadHandleParams, HeaderOptions, HealthStatus, HealthStatusEntity, HttpMethodsEnum, HttpsClientClass, HttpsClientResponseClass, ImageMediaObject, ImageMediaTypesEnum, ImageMessageBuilder, InteractiveMessageBuilder, InteractiveMessageFactory, InteractiveObject, InteractiveTypesEnum, LanguagesEnum, LimitedTimeOfferOptions, LimitedTimeOfferTemplateOptions, LocationMessageBuilder, LocationMessageFactory, LocationObject, LocationParameter, LoggerInterface, MPMButton, MPMTemplateOptions, MediaApi, MediaCardCarouselTemplateOptions, MediaCarouselCard, MediaClass, MediaMessageFactory, MediaParameter, MediaResponse, MediasResponse, MessagesApi as MessageApi, MessagesApi, MessageHandler, MessageRequestBody, MessageRequestParams, MessageStatus, MessageTemplateObject, MessageTypesEnum, MessagesClass, MessagesResponse, MessagingLimitTier, MetaError, NextFunction, NextJsAppWebhookConfig, NextJsWebhookConfig, OTPButton, OTPTemplateOptions, Pagination, PaginationCursors, Paging, ParameterObject, ParametersTypesEnum, PhoneNumberApi, PhoneNumberButton, PhoneNumberClass, PhoneNumberResponse, PhoneNumbersResponse, PlatformType, ProductCardCarouselTemplateOptions, ProductCarouselCard, ProductParameter, ProductSection, QrCodeApi, QrCodeClass, QrCodeResponse, QrCodesResponse, QualityRating, QualityScore, QuickReplyButton, ReactionMessageBuilder, ReactionMessageFactory, ReactionParams, ReferralSourceTypesEnum, RegistrationApi, RegistrationClass, RegistrationRequest, RequestCodeMethodsEnum, RequestVerificationCodeRequest, RequesterClass, RequesterResponseInterface, ResponseData, ResponseHeaderValue, ResponseHeaders, ResponseJSONBody, ResponsePagination, ResponseSuccess, SPMButton, SPMTemplateOptions, StatusEnum, StatusParams, StickerMediaObject, StickerMediaTypesEnum, StickerMessageBuilder, SubTypeEnum, SystemChangeTypesEnum, TemplateApi, TemplateBody, TemplateButton, TemplateButtons, TemplateCarousel, TemplateClass, TemplateDeleteParams, TemplateFooter, TemplateFormat, TemplateGetParams, TemplateHeader, TemplateHeaderExample, TemplateLimitedTimeOffer, TemplateMessageBuilder, TemplateMessageFactory, TemplateOptions, TemplateParameter, TemplateRequestBody, TemplateResponse, TemplateStatusEnum, TextMessageBuilder, TextMessageFactory, TextMessageParams, TextObject, TextParameter, Throughput, ThroughputLevel, TwoStepVerificationApi, TwoStepVerificationClass, TwoStepVerificationParams, TwoStepVerificationRequest, URLButton, UpdateBusinessProfileRequest, UpdateFlowResponse, UpdateQrCodeRequest, UpdateWabaSubscription, UploadBusinessProfileResponse, UploadHandle, UploadMediaParams, UploadMediaResponse, UploadSession, UploadSessionResponse, ValidateFlowJsonResponse, VerifyCodeRequest, VideoMediaObject, VideoMediaTypesEnum, VideoMessageBuilder, WABAClass, WabaAccount, WabaAccountFields, WabaAccountFieldsParam, WabaAccountReviewStatus, WabaAccountStatus, WabaApi, WabaBusinessVerificationStatus, WabaConfigEnum, WabaConfigType, WabaHealthStatus, WabaHealthStatusCanSendMessage, WabaHealthStatusEntity, WabaHealthStatusError, WabaSubscription, WabaSubscriptions, WebhookContact, WebhookEvent, WebhookMessage, WebhookProcessor, WebhookResponse, WebhookTypesEnum, WhatsApp, WhatsAppConfig, constructFullUrl, createAuthenticationTemplate, createCatalogTemplate, createCouponTemplate, createLimitedTimeOfferTemplate, createMPMTemplate, createMediaCardCarouselTemplate, createOTPTemplate, createProductCardCarouselTemplate, createSPMTemplate, createTemplate, expressWebhookHandler, generateXHub256Sig, nextjsAppWebhookHandler, nextjsWebhookHandler, processFlowRequest, processWebhookMessages };
4571
4675
  //# sourceMappingURL=index.d.ts.map