meta-cloud-api 1.4.0 → 1.4.1
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 +454 -302
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/types/{enums-Dx5yD3dt.d.ts → enums-DEu7hLmx.d.ts} +4 -1
- package/dist/types/enums-DEu7hLmx.d.ts.map +1 -0
- package/dist/types/{enums-DR1DVLAK.js → enums-U752Hos7.js} +1 -1
- package/dist/types/enums-U752Hos7.js.map +1 -0
- package/dist/types/enums.d.ts +1 -1
- package/dist/types/enums.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/index.d.ts +43 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/types/enums-DR1DVLAK.js.map +0 -1
- package/dist/types/enums-Dx5yD3dt.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,9 @@ declare enum MessageTypesEnum {
|
|
|
38
38
|
System = "system",
|
|
39
39
|
Unsupported = "unsupported",
|
|
40
40
|
Unknown = "unknown",
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Use WebhookProcessor.onStatus() instead of onMessage(MessageTypesEnum.Statuses)
|
|
43
|
+
*/
|
|
41
44
|
Statuses = "statuses",
|
|
42
45
|
'*' = "*",
|
|
43
46
|
}
|
|
@@ -806,50 +809,6 @@ declare class RequesterClass {
|
|
|
806
809
|
sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
807
810
|
}
|
|
808
811
|
//#endregion
|
|
809
|
-
//#region src/types/httpsClient.d.ts
|
|
810
|
-
type ResponseHeaderValue = string | string[] | undefined;
|
|
811
|
-
type ResponseHeaders = Record<string, ResponseHeaderValue>;
|
|
812
|
-
type ResponseJSONBody = Record<string, unknown>;
|
|
813
|
-
declare class HttpsClientResponseClass {
|
|
814
|
-
constructor(resp: Response);
|
|
815
|
-
statusCode: () => number;
|
|
816
|
-
headers: () => ResponseHeaders;
|
|
817
|
-
rawResponse: () => Response;
|
|
818
|
-
json: () => Promise<ResponseJSONBody>;
|
|
819
|
-
}
|
|
820
|
-
declare class HttpsClientClass {
|
|
821
|
-
constructor();
|
|
822
|
-
clearSockets: () => boolean;
|
|
823
|
-
sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
|
|
824
|
-
}
|
|
825
|
-
//#endregion
|
|
826
|
-
//#region src/utils/http/httpsClient.d.ts
|
|
827
|
-
declare class HttpsClient implements HttpsClientClass {
|
|
828
|
-
agent: Agent;
|
|
829
|
-
constructor();
|
|
830
|
-
clearSockets(): boolean;
|
|
831
|
-
sendRequest(hostname: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null): Promise<HttpsClientResponseClass>;
|
|
832
|
-
}
|
|
833
|
-
//#endregion
|
|
834
|
-
//#region src/utils/http/request.d.ts
|
|
835
|
-
declare class Requester implements RequesterClass {
|
|
836
|
-
client: Readonly<HttpsClient>;
|
|
837
|
-
accessToken: Readonly<string>;
|
|
838
|
-
phoneNumberId: Readonly<number>;
|
|
839
|
-
businessAcctId: Readonly<string>;
|
|
840
|
-
apiVersion: Readonly<string>;
|
|
841
|
-
userAgent: Readonly<string>;
|
|
842
|
-
host: Readonly<string>;
|
|
843
|
-
protocol: Readonly<string>;
|
|
844
|
-
constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
|
|
845
|
-
buildHeader(contentType: string, additionalHeaders?: Record<string, string>): HeadersInit;
|
|
846
|
-
buildCAPIPath(endpoint: string): string;
|
|
847
|
-
sendRequest(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, contentType?: string, additionalHeaders?: Record<string, string>): Promise<HttpsClientResponseClass>;
|
|
848
|
-
getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
849
|
-
sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
850
|
-
sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
851
|
-
}
|
|
852
|
-
//#endregion
|
|
853
812
|
//#region src/types/base.d.ts
|
|
854
813
|
declare class BaseClass {
|
|
855
814
|
constructor(config: WabaConfigType);
|
|
@@ -863,216 +822,6 @@ declare class BaseAPI implements BaseClass {
|
|
|
863
822
|
protected sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
|
|
864
823
|
}
|
|
865
824
|
//#endregion
|
|
866
|
-
//#region src/api/blockUsers/types/blockUsers.d.ts
|
|
867
|
-
/**
|
|
868
|
-
* Block Users API Types
|
|
869
|
-
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users
|
|
870
|
-
*/
|
|
871
|
-
/**
|
|
872
|
-
* User object for blocking/unblocking operations
|
|
873
|
-
*/
|
|
874
|
-
type BlockUserObject = {
|
|
875
|
-
user: string;
|
|
876
|
-
};
|
|
877
|
-
/**
|
|
878
|
-
* Blocked user information in response
|
|
879
|
-
*/
|
|
880
|
-
type BlockedUserInfo = {
|
|
881
|
-
input: string;
|
|
882
|
-
wa_id: string;
|
|
883
|
-
};
|
|
884
|
-
/**
|
|
885
|
-
* Failed user information with error details
|
|
886
|
-
* Uses common MetaErrorDetail type for consistency across APIs
|
|
887
|
-
*/
|
|
888
|
-
type FailedUserInfo = BlockedUserInfo & {
|
|
889
|
-
errors?: MetaErrorDetail[];
|
|
890
|
-
};
|
|
891
|
-
/**
|
|
892
|
-
* Request body for blocking users
|
|
893
|
-
*/
|
|
894
|
-
type BlockUsersRequest = {
|
|
895
|
-
messaging_product: 'whatsapp';
|
|
896
|
-
block_users: BlockUserObject[];
|
|
897
|
-
};
|
|
898
|
-
/**
|
|
899
|
-
* Request body for unblocking users
|
|
900
|
-
*/
|
|
901
|
-
type UnblockUsersRequest = {
|
|
902
|
-
messaging_product: 'whatsapp';
|
|
903
|
-
block_users: BlockUserObject[];
|
|
904
|
-
};
|
|
905
|
-
/**
|
|
906
|
-
* Response for block/unblock operations
|
|
907
|
-
*/
|
|
908
|
-
type BlockUsersResponse = {
|
|
909
|
-
messaging_product: 'whatsapp';
|
|
910
|
-
block_users: {
|
|
911
|
-
added_users?: BlockedUserInfo[];
|
|
912
|
-
failed_users?: FailedUserInfo[];
|
|
913
|
-
};
|
|
914
|
-
};
|
|
915
|
-
/**
|
|
916
|
-
* Pagination cursors for list operations
|
|
917
|
-
*/
|
|
918
|
-
type PagingCursors = {
|
|
919
|
-
after?: string;
|
|
920
|
-
before?: string;
|
|
921
|
-
};
|
|
922
|
-
/**
|
|
923
|
-
* Pagination information
|
|
924
|
-
*/
|
|
925
|
-
type PagingInfo = {
|
|
926
|
-
cursors?: PagingCursors;
|
|
927
|
-
previous?: string;
|
|
928
|
-
next?: string;
|
|
929
|
-
};
|
|
930
|
-
/**
|
|
931
|
-
* List blocked users response
|
|
932
|
-
*/
|
|
933
|
-
type ListBlockedUsersResponse = {
|
|
934
|
-
data: Array<{
|
|
935
|
-
block_users: BlockedUserInfo[];
|
|
936
|
-
}>;
|
|
937
|
-
paging?: PagingInfo;
|
|
938
|
-
};
|
|
939
|
-
/**
|
|
940
|
-
* Query parameters for listing blocked users
|
|
941
|
-
*/
|
|
942
|
-
type ListBlockedUsersParams = {
|
|
943
|
-
limit?: number;
|
|
944
|
-
after?: string;
|
|
945
|
-
before?: string;
|
|
946
|
-
};
|
|
947
|
-
/**
|
|
948
|
-
* Block Users API Interface
|
|
949
|
-
*/
|
|
950
|
-
interface BlockUsersClass {
|
|
951
|
-
/**
|
|
952
|
-
* Block one or more WhatsApp users
|
|
953
|
-
* @param users - Array of phone numbers or WhatsApp IDs to block
|
|
954
|
-
* @returns Response with successfully blocked and failed users
|
|
955
|
-
* @throws Error if users have not messaged in last 24 hours
|
|
956
|
-
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#block-users
|
|
957
|
-
*/
|
|
958
|
-
block(users: string[]): Promise<BlockUsersResponse>;
|
|
959
|
-
/**
|
|
960
|
-
* Unblock one or more WhatsApp users
|
|
961
|
-
* @param users - Array of phone numbers or WhatsApp IDs to unblock
|
|
962
|
-
* @returns Response with successfully unblocked and failed users
|
|
963
|
-
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#unblock-users
|
|
964
|
-
*/
|
|
965
|
-
unblock(users: string[]): Promise<BlockUsersResponse>;
|
|
966
|
-
/**
|
|
967
|
-
* Get list of blocked WhatsApp users with pagination
|
|
968
|
-
* @param params - Optional pagination parameters
|
|
969
|
-
* @returns List of blocked users with pagination info
|
|
970
|
-
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#get-list-of-blocked-numbers
|
|
971
|
-
*/
|
|
972
|
-
listBlockedUsers(params?: ListBlockedUsersParams): Promise<ListBlockedUsersResponse>;
|
|
973
|
-
}
|
|
974
|
-
//#endregion
|
|
975
|
-
//#region src/api/blockUsers/BlockUsersApi.d.ts
|
|
976
|
-
/**
|
|
977
|
-
* Block Users API
|
|
978
|
-
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users
|
|
979
|
-
*
|
|
980
|
-
* Limitations:
|
|
981
|
-
* - Can only block users that have messaged your business in the last 24 hours
|
|
982
|
-
* - 64k blocklist limit
|
|
983
|
-
*/
|
|
984
|
-
declare class BlockUsersApi extends BaseAPI implements BlockUsersClass {
|
|
985
|
-
private readonly endpoint;
|
|
986
|
-
constructor(config: WabaConfigType, client: RequesterClass);
|
|
987
|
-
/**
|
|
988
|
-
* Build request body for block/unblock operations
|
|
989
|
-
*/
|
|
990
|
-
private buildBlockUsersBody;
|
|
991
|
-
/**
|
|
992
|
-
* Block one or more WhatsApp users
|
|
993
|
-
* @param users - Array of phone numbers or WhatsApp IDs to block
|
|
994
|
-
* @returns Response with successfully blocked and failed users
|
|
995
|
-
* @throws Error if users have not messaged in last 24 hours
|
|
996
|
-
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#block-users
|
|
997
|
-
*
|
|
998
|
-
* @example
|
|
999
|
-
* ```typescript
|
|
1000
|
-
* // Block single user
|
|
1001
|
-
* const result = await client.blockUsers.block(['1234567890']);
|
|
1002
|
-
*
|
|
1003
|
-
* // Block multiple users
|
|
1004
|
-
* const result = await client.blockUsers.block(['1234567890', '0987654321']);
|
|
1005
|
-
*
|
|
1006
|
-
* // Check results
|
|
1007
|
-
* console.log('Blocked:', result.block_users.added_users);
|
|
1008
|
-
* console.log('Failed:', result.block_users.failed_users);
|
|
1009
|
-
* ```
|
|
1010
|
-
*/
|
|
1011
|
-
block(users: string[]): Promise<BlockUsersResponse>;
|
|
1012
|
-
/**
|
|
1013
|
-
* Unblock one or more WhatsApp users
|
|
1014
|
-
* @param users - Array of phone numbers or WhatsApp IDs to unblock
|
|
1015
|
-
* @returns Response with successfully unblocked and failed users
|
|
1016
|
-
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#unblock-users
|
|
1017
|
-
*
|
|
1018
|
-
* @example
|
|
1019
|
-
* ```typescript
|
|
1020
|
-
* // Unblock single user
|
|
1021
|
-
* const result = await client.blockUsers.unblock(['1234567890']);
|
|
1022
|
-
*
|
|
1023
|
-
* // Unblock multiple users
|
|
1024
|
-
* const result = await client.blockUsers.unblock(['1234567890', '0987654321']);
|
|
1025
|
-
*
|
|
1026
|
-
* // Check results
|
|
1027
|
-
* console.log('Unblocked:', result.block_users.added_users);
|
|
1028
|
-
* console.log('Failed:', result.block_users.failed_users);
|
|
1029
|
-
* ```
|
|
1030
|
-
*/
|
|
1031
|
-
unblock(users: string[]): Promise<BlockUsersResponse>;
|
|
1032
|
-
/**
|
|
1033
|
-
* Get list of blocked WhatsApp users with pagination
|
|
1034
|
-
* @param params - Optional pagination parameters
|
|
1035
|
-
* @returns List of blocked users with pagination info
|
|
1036
|
-
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#get-list-of-blocked-numbers
|
|
1037
|
-
*
|
|
1038
|
-
* @example
|
|
1039
|
-
* ```typescript
|
|
1040
|
-
* // Get first 10 blocked users
|
|
1041
|
-
* const result = await client.blockUsers.listBlockedUsers({ limit: 10 });
|
|
1042
|
-
*
|
|
1043
|
-
* // Pagination with cursor
|
|
1044
|
-
* const nextPage = await client.blockUsers.listBlockedUsers({
|
|
1045
|
-
* limit: 10,
|
|
1046
|
-
* after: result.paging?.cursors?.after
|
|
1047
|
-
* });
|
|
1048
|
-
*
|
|
1049
|
-
* // Get all blocked users
|
|
1050
|
-
* const allBlocked = await client.blockUsers.listBlockedUsers();
|
|
1051
|
-
* ```
|
|
1052
|
-
*/
|
|
1053
|
-
listBlockedUsers(params?: ListBlockedUsersParams): Promise<ListBlockedUsersResponse>;
|
|
1054
|
-
}
|
|
1055
|
-
//#endregion
|
|
1056
|
-
//#region src/api/encryption/types/publicKey.d.ts
|
|
1057
|
-
type EncryptionPublicKeyResponse = ResponseData<{
|
|
1058
|
-
business_public_key: string;
|
|
1059
|
-
business_public_key_signature_status: 'VALID' | 'MISMATCH';
|
|
1060
|
-
}>;
|
|
1061
|
-
//#endregion
|
|
1062
|
-
//#region src/api/encryption/types/common.d.ts
|
|
1063
|
-
interface EncryptionClass {
|
|
1064
|
-
getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
|
|
1065
|
-
setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
|
|
1066
|
-
}
|
|
1067
|
-
//#endregion
|
|
1068
|
-
//#region src/api/encryption/EncryptionApi.d.ts
|
|
1069
|
-
declare class EncryptionApi extends BaseAPI implements EncryptionClass {
|
|
1070
|
-
private readonly endpoint;
|
|
1071
|
-
constructor(config: WabaConfigType, client: RequesterClass);
|
|
1072
|
-
getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
|
|
1073
|
-
setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
|
|
1074
|
-
}
|
|
1075
|
-
//#endregion
|
|
1076
825
|
//#region src/core/webhook/types.d.ts
|
|
1077
826
|
/**
|
|
1078
827
|
* WhatsApp contact information
|
|
@@ -1460,6 +1209,23 @@ interface LoggerInterface {
|
|
|
1460
1209
|
debug(...data: any[]): void;
|
|
1461
1210
|
}
|
|
1462
1211
|
//#endregion
|
|
1212
|
+
//#region src/types/httpsClient.d.ts
|
|
1213
|
+
type ResponseHeaderValue = string | string[] | undefined;
|
|
1214
|
+
type ResponseHeaders = Record<string, ResponseHeaderValue>;
|
|
1215
|
+
type ResponseJSONBody = Record<string, unknown>;
|
|
1216
|
+
declare class HttpsClientResponseClass {
|
|
1217
|
+
constructor(resp: Response);
|
|
1218
|
+
statusCode: () => number;
|
|
1219
|
+
headers: () => ResponseHeaders;
|
|
1220
|
+
rawResponse: () => Response;
|
|
1221
|
+
json: () => Promise<ResponseJSONBody>;
|
|
1222
|
+
}
|
|
1223
|
+
declare class HttpsClientClass {
|
|
1224
|
+
constructor();
|
|
1225
|
+
clearSockets: () => boolean;
|
|
1226
|
+
sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
|
|
1227
|
+
}
|
|
1228
|
+
//#endregion
|
|
1463
1229
|
//#region src/api/profile/types/upload.d.ts
|
|
1464
1230
|
/**
|
|
1465
1231
|
* Upload session information for creating upload sessions.
|
|
@@ -2710,36 +2476,157 @@ interface WabaAccount {
|
|
|
2710
2476
|
*/
|
|
2711
2477
|
type WabaAccountFields = 'id' | 'name' | 'account_review_status' | 'auth_international_rate_eligibility' | 'business_verification_status' | 'country' | 'currency' | 'health_status' | 'status' | 'ownership_type' | 'message_template_namespace';
|
|
2712
2478
|
/**
|
|
2713
|
-
* Parameter type for specifying which WABA account fields to retrieve
|
|
2479
|
+
* Parameter type for specifying which WABA account fields to retrieve
|
|
2480
|
+
*/
|
|
2481
|
+
type WabaAccountFieldsParam = WabaAccountFields[];
|
|
2482
|
+
/**
|
|
2483
|
+
* Interface defining all WABA API methods
|
|
2484
|
+
*/
|
|
2485
|
+
interface WABAClass {
|
|
2486
|
+
getWabaAccount(fields?: WabaAccountFieldsParam): Promise<WabaAccount>;
|
|
2487
|
+
getAllWabaSubscriptions(): Promise<WabaSubscriptions>;
|
|
2488
|
+
updateWabaSubscription(params: UpdateWabaSubscription): Promise<ResponseSuccess>;
|
|
2489
|
+
unsubscribeFromWaba(): Promise<ResponseSuccess>;
|
|
2490
|
+
}
|
|
2491
|
+
//#endregion
|
|
2492
|
+
//#region src/api/registration/types/common.d.ts
|
|
2493
|
+
type RegistrationRequest = {
|
|
2494
|
+
messaging_product: 'whatsapp';
|
|
2495
|
+
pin: string;
|
|
2496
|
+
data_localization_region?: DataLocalizationRegionEnum;
|
|
2497
|
+
};
|
|
2498
|
+
interface RegistrationClass {
|
|
2499
|
+
register(pin: string, dataLocalizationRegion?: DataLocalizationRegionEnum): Promise<ResponseSuccess>;
|
|
2500
|
+
deregister(): Promise<ResponseSuccess>;
|
|
2501
|
+
}
|
|
2502
|
+
//#endregion
|
|
2503
|
+
//#region src/api/twoStepVerification/types/common.d.ts
|
|
2504
|
+
type TwoStepVerificationRequest = {
|
|
2505
|
+
pin: string;
|
|
2506
|
+
};
|
|
2507
|
+
interface TwoStepVerificationClass {
|
|
2508
|
+
setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
|
|
2509
|
+
}
|
|
2510
|
+
//#endregion
|
|
2511
|
+
//#region src/api/encryption/types/publicKey.d.ts
|
|
2512
|
+
type EncryptionPublicKeyResponse = ResponseData<{
|
|
2513
|
+
business_public_key: string;
|
|
2514
|
+
business_public_key_signature_status: 'VALID' | 'MISMATCH';
|
|
2515
|
+
}>;
|
|
2516
|
+
//#endregion
|
|
2517
|
+
//#region src/api/encryption/types/common.d.ts
|
|
2518
|
+
interface EncryptionClass {
|
|
2519
|
+
getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
|
|
2520
|
+
setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
|
|
2521
|
+
}
|
|
2522
|
+
//#endregion
|
|
2523
|
+
//#region src/api/blockUsers/types/blockUsers.d.ts
|
|
2524
|
+
/**
|
|
2525
|
+
* Block Users API Types
|
|
2526
|
+
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users
|
|
2527
|
+
*/
|
|
2528
|
+
/**
|
|
2529
|
+
* User object for blocking/unblocking operations
|
|
2530
|
+
*/
|
|
2531
|
+
type BlockUserObject = {
|
|
2532
|
+
user: string;
|
|
2533
|
+
};
|
|
2534
|
+
/**
|
|
2535
|
+
* Blocked user information in response
|
|
2536
|
+
*/
|
|
2537
|
+
type BlockedUserInfo = {
|
|
2538
|
+
input: string;
|
|
2539
|
+
wa_id: string;
|
|
2540
|
+
};
|
|
2541
|
+
/**
|
|
2542
|
+
* Failed user information with error details
|
|
2543
|
+
* Uses common MetaErrorDetail type for consistency across APIs
|
|
2544
|
+
*/
|
|
2545
|
+
type FailedUserInfo = BlockedUserInfo & {
|
|
2546
|
+
errors?: MetaErrorDetail[];
|
|
2547
|
+
};
|
|
2548
|
+
/**
|
|
2549
|
+
* Request body for blocking users
|
|
2550
|
+
*/
|
|
2551
|
+
type BlockUsersRequest = {
|
|
2552
|
+
messaging_product: 'whatsapp';
|
|
2553
|
+
block_users: BlockUserObject[];
|
|
2554
|
+
};
|
|
2555
|
+
/**
|
|
2556
|
+
* Request body for unblocking users
|
|
2557
|
+
*/
|
|
2558
|
+
type UnblockUsersRequest = {
|
|
2559
|
+
messaging_product: 'whatsapp';
|
|
2560
|
+
block_users: BlockUserObject[];
|
|
2561
|
+
};
|
|
2562
|
+
/**
|
|
2563
|
+
* Response for block/unblock operations
|
|
2564
|
+
*/
|
|
2565
|
+
type BlockUsersResponse = {
|
|
2566
|
+
messaging_product: 'whatsapp';
|
|
2567
|
+
block_users: {
|
|
2568
|
+
added_users?: BlockedUserInfo[];
|
|
2569
|
+
failed_users?: FailedUserInfo[];
|
|
2570
|
+
};
|
|
2571
|
+
};
|
|
2572
|
+
/**
|
|
2573
|
+
* Pagination cursors for list operations
|
|
2574
|
+
*/
|
|
2575
|
+
type PagingCursors = {
|
|
2576
|
+
after?: string;
|
|
2577
|
+
before?: string;
|
|
2578
|
+
};
|
|
2579
|
+
/**
|
|
2580
|
+
* Pagination information
|
|
2581
|
+
*/
|
|
2582
|
+
type PagingInfo = {
|
|
2583
|
+
cursors?: PagingCursors;
|
|
2584
|
+
previous?: string;
|
|
2585
|
+
next?: string;
|
|
2586
|
+
};
|
|
2587
|
+
/**
|
|
2588
|
+
* List blocked users response
|
|
2589
|
+
*/
|
|
2590
|
+
type ListBlockedUsersResponse = {
|
|
2591
|
+
data: Array<{
|
|
2592
|
+
block_users: BlockedUserInfo[];
|
|
2593
|
+
}>;
|
|
2594
|
+
paging?: PagingInfo;
|
|
2595
|
+
};
|
|
2596
|
+
/**
|
|
2597
|
+
* Query parameters for listing blocked users
|
|
2714
2598
|
*/
|
|
2715
|
-
type
|
|
2599
|
+
type ListBlockedUsersParams = {
|
|
2600
|
+
limit?: number;
|
|
2601
|
+
after?: string;
|
|
2602
|
+
before?: string;
|
|
2603
|
+
};
|
|
2716
2604
|
/**
|
|
2717
|
-
*
|
|
2605
|
+
* Block Users API Interface
|
|
2718
2606
|
*/
|
|
2719
|
-
interface
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
|
|
2607
|
+
interface BlockUsersClass {
|
|
2608
|
+
/**
|
|
2609
|
+
* Block one or more WhatsApp users
|
|
2610
|
+
* @param users - Array of phone numbers or WhatsApp IDs to block
|
|
2611
|
+
* @returns Response with successfully blocked and failed users
|
|
2612
|
+
* @throws Error if users have not messaged in last 24 hours
|
|
2613
|
+
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#block-users
|
|
2614
|
+
*/
|
|
2615
|
+
block(users: string[]): Promise<BlockUsersResponse>;
|
|
2616
|
+
/**
|
|
2617
|
+
* Unblock one or more WhatsApp users
|
|
2618
|
+
* @param users - Array of phone numbers or WhatsApp IDs to unblock
|
|
2619
|
+
* @returns Response with successfully unblocked and failed users
|
|
2620
|
+
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#unblock-users
|
|
2621
|
+
*/
|
|
2622
|
+
unblock(users: string[]): Promise<BlockUsersResponse>;
|
|
2623
|
+
/**
|
|
2624
|
+
* Get list of blocked WhatsApp users with pagination
|
|
2625
|
+
* @param params - Optional pagination parameters
|
|
2626
|
+
* @returns List of blocked users with pagination info
|
|
2627
|
+
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#get-list-of-blocked-numbers
|
|
2628
|
+
*/
|
|
2629
|
+
listBlockedUsers(params?: ListBlockedUsersParams): Promise<ListBlockedUsersResponse>;
|
|
2743
2630
|
}
|
|
2744
2631
|
//#endregion
|
|
2745
2632
|
//#region src/utils/isMetaError.d.ts
|
|
@@ -2756,6 +2643,12 @@ interface MetaError extends Error {
|
|
|
2756
2643
|
fbtrace_id: string;
|
|
2757
2644
|
};
|
|
2758
2645
|
}
|
|
2646
|
+
/**
|
|
2647
|
+
* Determines if the error is a Meta API error response
|
|
2648
|
+
* @param error Any error object to check
|
|
2649
|
+
* @returns Type guard indicating if error is a Meta API error
|
|
2650
|
+
*/
|
|
2651
|
+
declare function isMetaError(error: any): error is MetaError;
|
|
2759
2652
|
//#endregion
|
|
2760
2653
|
//#region src/api/flow/types/common.d.ts
|
|
2761
2654
|
/**
|
|
@@ -3288,6 +3181,164 @@ declare class FlowApi extends BaseAPI implements FlowClass {
|
|
|
3288
3181
|
}): Promise<FlowMigrationResponse>;
|
|
3289
3182
|
}
|
|
3290
3183
|
//#endregion
|
|
3184
|
+
//#region src/utils/flowEncryptionUtils.d.ts
|
|
3185
|
+
/**
|
|
3186
|
+
* Environment model for encryption keys
|
|
3187
|
+
*/
|
|
3188
|
+
type EncryptionKeyPair = {
|
|
3189
|
+
passphrase: string;
|
|
3190
|
+
privateKey: string;
|
|
3191
|
+
publicKey: string;
|
|
3192
|
+
};
|
|
3193
|
+
/**
|
|
3194
|
+
* Generates RSA key pair for WhatsApp Business Flow API encryption
|
|
3195
|
+
*
|
|
3196
|
+
* This function generates a 2048-bit RSA key pair with:
|
|
3197
|
+
* - Public key in SPKI format (PEM)
|
|
3198
|
+
* - Private key in PKCS#8 format (PEM) encrypted with AES-256-CBC
|
|
3199
|
+
*
|
|
3200
|
+
* @param passphrase - Passphrase to encrypt the private key. If not provided, uses FLOW_API_PASSPHRASE from environment
|
|
3201
|
+
* @returns Object containing passphrase, privateKey, and publicKey
|
|
3202
|
+
* @throws {Error} If passphrase is empty or key generation fails
|
|
3203
|
+
* @throws {Error} If not running in Node.js environment
|
|
3204
|
+
*
|
|
3205
|
+
* @example
|
|
3206
|
+
* ```typescript
|
|
3207
|
+
* import { WhatsApp } from 'meta-cloud-api';
|
|
3208
|
+
*
|
|
3209
|
+
* const wa = new WhatsApp();
|
|
3210
|
+
*
|
|
3211
|
+
* try {
|
|
3212
|
+
* // Uses FLOW_API_PASSPHRASE from environment
|
|
3213
|
+
* const keys = wa.generateEncryption();
|
|
3214
|
+
* console.log('Public Key:', keys.publicKey);
|
|
3215
|
+
* console.log('Private Key:', keys.privateKey);
|
|
3216
|
+
*
|
|
3217
|
+
* // Or provide custom passphrase
|
|
3218
|
+
* const customKeys = wa.generateEncryption('my-secret-passphrase');
|
|
3219
|
+
* } catch (error) {
|
|
3220
|
+
* console.error('Failed to generate keys:', error.message);
|
|
3221
|
+
* }
|
|
3222
|
+
* ```
|
|
3223
|
+
*/
|
|
3224
|
+
declare function generateEncryption(passphrase?: string): EncryptionKeyPair;
|
|
3225
|
+
//#endregion
|
|
3226
|
+
//#region src/utils/http/httpsClient.d.ts
|
|
3227
|
+
declare class HttpsClient implements HttpsClientClass {
|
|
3228
|
+
agent: Agent;
|
|
3229
|
+
constructor();
|
|
3230
|
+
clearSockets(): boolean;
|
|
3231
|
+
sendRequest(hostname: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null): Promise<HttpsClientResponseClass>;
|
|
3232
|
+
}
|
|
3233
|
+
//#endregion
|
|
3234
|
+
//#region src/utils/http/request.d.ts
|
|
3235
|
+
declare class Requester implements RequesterClass {
|
|
3236
|
+
client: Readonly<HttpsClient>;
|
|
3237
|
+
accessToken: Readonly<string>;
|
|
3238
|
+
phoneNumberId: Readonly<number>;
|
|
3239
|
+
businessAcctId: Readonly<string>;
|
|
3240
|
+
apiVersion: Readonly<string>;
|
|
3241
|
+
userAgent: Readonly<string>;
|
|
3242
|
+
host: Readonly<string>;
|
|
3243
|
+
protocol: Readonly<string>;
|
|
3244
|
+
constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
|
|
3245
|
+
buildHeader(contentType: string, additionalHeaders?: Record<string, string>): HeadersInit;
|
|
3246
|
+
buildCAPIPath(endpoint: string): string;
|
|
3247
|
+
sendRequest(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, contentType?: string, additionalHeaders?: Record<string, string>): Promise<HttpsClientResponseClass>;
|
|
3248
|
+
getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
3249
|
+
sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
3250
|
+
sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
3251
|
+
}
|
|
3252
|
+
//#endregion
|
|
3253
|
+
//#region src/api/blockUsers/BlockUsersApi.d.ts
|
|
3254
|
+
/**
|
|
3255
|
+
* Block Users API
|
|
3256
|
+
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users
|
|
3257
|
+
*
|
|
3258
|
+
* Limitations:
|
|
3259
|
+
* - Can only block users that have messaged your business in the last 24 hours
|
|
3260
|
+
* - 64k blocklist limit
|
|
3261
|
+
*/
|
|
3262
|
+
declare class BlockUsersApi extends BaseAPI implements BlockUsersClass {
|
|
3263
|
+
private readonly endpoint;
|
|
3264
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
3265
|
+
/**
|
|
3266
|
+
* Build request body for block/unblock operations
|
|
3267
|
+
*/
|
|
3268
|
+
private buildBlockUsersBody;
|
|
3269
|
+
/**
|
|
3270
|
+
* Block one or more WhatsApp users
|
|
3271
|
+
* @param users - Array of phone numbers or WhatsApp IDs to block
|
|
3272
|
+
* @returns Response with successfully blocked and failed users
|
|
3273
|
+
* @throws Error if users have not messaged in last 24 hours
|
|
3274
|
+
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#block-users
|
|
3275
|
+
*
|
|
3276
|
+
* @example
|
|
3277
|
+
* ```typescript
|
|
3278
|
+
* // Block single user
|
|
3279
|
+
* const result = await client.blockUsers.block(['1234567890']);
|
|
3280
|
+
*
|
|
3281
|
+
* // Block multiple users
|
|
3282
|
+
* const result = await client.blockUsers.block(['1234567890', '0987654321']);
|
|
3283
|
+
*
|
|
3284
|
+
* // Check results
|
|
3285
|
+
* console.log('Blocked:', result.block_users.added_users);
|
|
3286
|
+
* console.log('Failed:', result.block_users.failed_users);
|
|
3287
|
+
* ```
|
|
3288
|
+
*/
|
|
3289
|
+
block(users: string[]): Promise<BlockUsersResponse>;
|
|
3290
|
+
/**
|
|
3291
|
+
* Unblock one or more WhatsApp users
|
|
3292
|
+
* @param users - Array of phone numbers or WhatsApp IDs to unblock
|
|
3293
|
+
* @returns Response with successfully unblocked and failed users
|
|
3294
|
+
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#unblock-users
|
|
3295
|
+
*
|
|
3296
|
+
* @example
|
|
3297
|
+
* ```typescript
|
|
3298
|
+
* // Unblock single user
|
|
3299
|
+
* const result = await client.blockUsers.unblock(['1234567890']);
|
|
3300
|
+
*
|
|
3301
|
+
* // Unblock multiple users
|
|
3302
|
+
* const result = await client.blockUsers.unblock(['1234567890', '0987654321']);
|
|
3303
|
+
*
|
|
3304
|
+
* // Check results
|
|
3305
|
+
* console.log('Unblocked:', result.block_users.added_users);
|
|
3306
|
+
* console.log('Failed:', result.block_users.failed_users);
|
|
3307
|
+
* ```
|
|
3308
|
+
*/
|
|
3309
|
+
unblock(users: string[]): Promise<BlockUsersResponse>;
|
|
3310
|
+
/**
|
|
3311
|
+
* Get list of blocked WhatsApp users with pagination
|
|
3312
|
+
* @param params - Optional pagination parameters
|
|
3313
|
+
* @returns List of blocked users with pagination info
|
|
3314
|
+
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#get-list-of-blocked-numbers
|
|
3315
|
+
*
|
|
3316
|
+
* @example
|
|
3317
|
+
* ```typescript
|
|
3318
|
+
* // Get first 10 blocked users
|
|
3319
|
+
* const result = await client.blockUsers.listBlockedUsers({ limit: 10 });
|
|
3320
|
+
*
|
|
3321
|
+
* // Pagination with cursor
|
|
3322
|
+
* const nextPage = await client.blockUsers.listBlockedUsers({
|
|
3323
|
+
* limit: 10,
|
|
3324
|
+
* after: result.paging?.cursors?.after
|
|
3325
|
+
* });
|
|
3326
|
+
*
|
|
3327
|
+
* // Get all blocked users
|
|
3328
|
+
* const allBlocked = await client.blockUsers.listBlockedUsers();
|
|
3329
|
+
* ```
|
|
3330
|
+
*/
|
|
3331
|
+
listBlockedUsers(params?: ListBlockedUsersParams): Promise<ListBlockedUsersResponse>;
|
|
3332
|
+
}
|
|
3333
|
+
//#endregion
|
|
3334
|
+
//#region src/api/encryption/EncryptionApi.d.ts
|
|
3335
|
+
declare class EncryptionApi extends BaseAPI implements EncryptionClass {
|
|
3336
|
+
private readonly endpoint;
|
|
3337
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
3338
|
+
getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
|
|
3339
|
+
setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
|
|
3340
|
+
}
|
|
3341
|
+
//#endregion
|
|
3291
3342
|
//#region src/api/media/MediaApi.d.ts
|
|
3292
3343
|
/**
|
|
3293
3344
|
* API for managing WhatsApp Media.
|
|
@@ -4020,38 +4071,69 @@ declare class WhatsApp {
|
|
|
4020
4071
|
* Get User-Agent string
|
|
4021
4072
|
*/
|
|
4022
4073
|
getUserAgent(): string;
|
|
4074
|
+
/**
|
|
4075
|
+
* Generate RSA encryption key pair for WhatsApp Business Flow API
|
|
4076
|
+
*
|
|
4077
|
+
* This method generates a 2048-bit RSA key pair with:
|
|
4078
|
+
* - Public key in SPKI format (PEM)
|
|
4079
|
+
* - Private key in PKCS#8 format (PEM) encrypted with AES-256-CBC
|
|
4080
|
+
*
|
|
4081
|
+
* @param passphrase - Optional passphrase to encrypt the private key. If not provided, uses FLOW_API_PASSPHRASE from config
|
|
4082
|
+
* @returns Object containing passphrase, privateKey, and publicKey
|
|
4083
|
+
* @throws {Error} If passphrase is empty or key generation fails
|
|
4084
|
+
* @throws {Error} If not running in Node.js environment
|
|
4085
|
+
*
|
|
4086
|
+
* @see https://developers.facebook.com/docs/whatsapp/cloud-api/reference/whatsapp-business-encryption/
|
|
4087
|
+
*
|
|
4088
|
+
* @example
|
|
4089
|
+
* ```typescript
|
|
4090
|
+
* const wa = new WhatsApp();
|
|
4091
|
+
*
|
|
4092
|
+
* // Uses FLOW_API_PASSPHRASE from environment/config
|
|
4093
|
+
* const keys = wa.generateEncryption();
|
|
4094
|
+
*
|
|
4095
|
+
* // Or provide custom passphrase
|
|
4096
|
+
* const customKeys = wa.generateEncryption('my-secret-passphrase');
|
|
4097
|
+
*
|
|
4098
|
+
* console.log('Public Key:', keys.publicKey);
|
|
4099
|
+
* console.log('Private Key:', keys.privateKey);
|
|
4100
|
+
* ```
|
|
4101
|
+
*/
|
|
4102
|
+
generateEncryption(passphrase?: string): EncryptionKeyPair;
|
|
4023
4103
|
}
|
|
4024
4104
|
//#endregion
|
|
4025
4105
|
//#region src/core/webhook/utils/webhookUtils.d.ts
|
|
4026
|
-
|
|
4106
|
+
/**
|
|
4107
|
+
* Processed message with metadata for handlers
|
|
4108
|
+
*/
|
|
4109
|
+
type ProcessedMessage = {
|
|
4110
|
+
wabaId: string;
|
|
4111
|
+
phoneNumberId: string;
|
|
4112
|
+
displayPhoneNumber: string;
|
|
4113
|
+
profileName: string;
|
|
4114
|
+
message: WhatsAppMessage;
|
|
4115
|
+
};
|
|
4116
|
+
/**
|
|
4117
|
+
* Processed status with metadata for handlers
|
|
4118
|
+
*/
|
|
4119
|
+
type ProcessedStatus = {
|
|
4120
|
+
wabaId: string;
|
|
4121
|
+
phoneNumberId: string;
|
|
4122
|
+
displayPhoneNumber: string;
|
|
4123
|
+
status: StatusWebhook;
|
|
4124
|
+
};
|
|
4125
|
+
type MessageHandler = (whatsapp: WhatsApp, processed: ProcessedMessage) => void | Promise<void>;
|
|
4126
|
+
type StatusHandler = (whatsapp: WhatsApp, processed: ProcessedStatus) => void | Promise<void>;
|
|
4027
4127
|
type FlowHandler = (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>;
|
|
4028
4128
|
/**
|
|
4029
4129
|
* Process webhook messages
|
|
4030
4130
|
*/
|
|
4031
4131
|
declare function processWebhookMessages(request: Request, whatsapp: WhatsApp, handlers: {
|
|
4032
4132
|
messageHandlers: Map<MessageTypesEnum, MessageHandler>;
|
|
4133
|
+
statusHandler?: StatusHandler;
|
|
4033
4134
|
preProcessHandler?: MessageHandler;
|
|
4034
4135
|
postProcessHandler?: MessageHandler;
|
|
4035
4136
|
}): Promise<Response>;
|
|
4036
|
-
/**
|
|
4037
|
-
* Create a standard ping response for WhatsApp Flow health checks
|
|
4038
|
-
* @returns Flow ping response object
|
|
4039
|
-
*/
|
|
4040
|
-
declare function createFlowPingResponse(): {
|
|
4041
|
-
version: string;
|
|
4042
|
-
data: {
|
|
4043
|
-
status: string;
|
|
4044
|
-
};
|
|
4045
|
-
};
|
|
4046
|
-
/**
|
|
4047
|
-
* Create a standard error response for WhatsApp Flow error notifications
|
|
4048
|
-
* @returns Acknowledgement response for error notification
|
|
4049
|
-
*/
|
|
4050
|
-
declare function createFlowErrorResponse(): {
|
|
4051
|
-
data: {
|
|
4052
|
-
acknowledged: boolean;
|
|
4053
|
-
};
|
|
4054
|
-
};
|
|
4055
4137
|
/**
|
|
4056
4138
|
* Handle flow requests
|
|
4057
4139
|
*/
|
|
@@ -4074,6 +4156,7 @@ declare class WebhookProcessor {
|
|
|
4074
4156
|
private config;
|
|
4075
4157
|
private client;
|
|
4076
4158
|
private messageHandlers;
|
|
4159
|
+
private statusHandler;
|
|
4077
4160
|
private preProcessHandler;
|
|
4078
4161
|
private postProcessHandler;
|
|
4079
4162
|
private flowHandlers;
|
|
@@ -4082,6 +4165,7 @@ declare class WebhookProcessor {
|
|
|
4082
4165
|
processWebhook(request: Request): Promise<WebhookResponse>;
|
|
4083
4166
|
processFlow(request: Request): Promise<WebhookResponse>;
|
|
4084
4167
|
onMessage(type: MessageTypesEnum, handler: MessageHandler): void;
|
|
4168
|
+
onStatus(handler: StatusHandler): void;
|
|
4085
4169
|
onMessagePreProcess(handler: MessageHandler): void;
|
|
4086
4170
|
onMessagePostProcess(handler: MessageHandler): void;
|
|
4087
4171
|
onFlow(type: FlowTypeEnum, handler: FlowHandler): void;
|
|
@@ -4183,5 +4267,73 @@ declare function nextjsAppWebhookHandler(config: NextJsAppWebhookConfig): {
|
|
|
4183
4267
|
//#region src/core/webhook/utils/generateXHub256Sig.d.ts
|
|
4184
4268
|
declare const generateXHub256Sig: (body: string, appSecret: string) => string;
|
|
4185
4269
|
//#endregion
|
|
4186
|
-
|
|
4270
|
+
//#region src/utils/buildFieldsQueryString.d.ts
|
|
4271
|
+
declare function buildFieldsQueryString(fields?: string[] | string): string;
|
|
4272
|
+
//#endregion
|
|
4273
|
+
//#region src/utils/configTable.d.ts
|
|
4274
|
+
/**
|
|
4275
|
+
* Formats configuration as a terminal table
|
|
4276
|
+
* @param config - The WABA configuration object
|
|
4277
|
+
* @param apiName - The name of the API being initialized
|
|
4278
|
+
* @returns Formatted table string
|
|
4279
|
+
*/
|
|
4280
|
+
declare function formatConfigTable(config: WabaConfigType): string;
|
|
4281
|
+
//#endregion
|
|
4282
|
+
//#region src/utils/logger.d.ts
|
|
4283
|
+
declare class Logger implements LoggerInterface {
|
|
4284
|
+
private name;
|
|
4285
|
+
private debug;
|
|
4286
|
+
constructor(name: string, debug?: boolean);
|
|
4287
|
+
private formatData;
|
|
4288
|
+
log(...data: any[]): void;
|
|
4289
|
+
error(...data: any[]): void;
|
|
4290
|
+
warn(...data: any[]): void;
|
|
4291
|
+
info(...data: any[]): void;
|
|
4292
|
+
}
|
|
4293
|
+
//#endregion
|
|
4294
|
+
//#region src/utils/objectToQueryString.d.ts
|
|
4295
|
+
declare const objectToQueryString: (params: Record<string, any>) => string;
|
|
4296
|
+
//#endregion
|
|
4297
|
+
//#region src/utils/flowTypeGuards.d.ts
|
|
4298
|
+
declare const DATA_EXCHANGE_ACTIONS: readonly [FlowActionEnum.DATA_EXCHANGE, FlowActionEnum.INIT, FlowActionEnum.BACK];
|
|
4299
|
+
declare const ERROR_ACTIONS: readonly [FlowActionEnum.DATA_EXCHANGE, FlowActionEnum.INIT];
|
|
4300
|
+
/**
|
|
4301
|
+
* Type guard to check if a request is a Data Exchange request
|
|
4302
|
+
* Validates the request structure according to the Flow API specifications
|
|
4303
|
+
*
|
|
4304
|
+
* @param request The Flow endpoint request to check
|
|
4305
|
+
* @returns True if the request is a valid Data Exchange request, false otherwise
|
|
4306
|
+
*/
|
|
4307
|
+
declare function isFlowDataExchangeRequest(request: FlowEndpointRequest): request is FlowDataExchangeRequest & {
|
|
4308
|
+
action: (typeof DATA_EXCHANGE_ACTIONS)[number];
|
|
4309
|
+
screen?: string;
|
|
4310
|
+
flow_token: string;
|
|
4311
|
+
data?: Record<string, any>;
|
|
4312
|
+
};
|
|
4313
|
+
/**
|
|
4314
|
+
* Type guard to check if a request is an Error Notification request
|
|
4315
|
+
* Validates the request structure according to the Flow API error specifications
|
|
4316
|
+
*
|
|
4317
|
+
* @param request The Flow endpoint request to check
|
|
4318
|
+
* @returns True if the request is a valid Error Notification request, false otherwise
|
|
4319
|
+
*/
|
|
4320
|
+
declare function isFlowErrorRequest(request: FlowEndpointRequest): request is FlowErrorNotificationRequest & {
|
|
4321
|
+
action: (typeof ERROR_ACTIONS)[number];
|
|
4322
|
+
screen: string;
|
|
4323
|
+
flow_token: string;
|
|
4324
|
+
data: {
|
|
4325
|
+
error: string;
|
|
4326
|
+
error_message: string;
|
|
4327
|
+
};
|
|
4328
|
+
};
|
|
4329
|
+
/**
|
|
4330
|
+
* Type guard to check if a request is a Ping (health check) request
|
|
4331
|
+
* Simple validation for health check endpoints in the Flow API
|
|
4332
|
+
*
|
|
4333
|
+
* @param request The Flow endpoint request to check
|
|
4334
|
+
* @returns True if the request is a Ping request, false otherwise
|
|
4335
|
+
*/
|
|
4336
|
+
declare function isFlowPingRequest(request: FlowEndpointRequest): request is FlowHealthCheckRequest;
|
|
4337
|
+
//#endregion
|
|
4338
|
+
export { AccountMode, AudioMediaObject, AudioMediaTypesEnum, AudioMessage, AuthenticationTemplateOptions, BaseClass, BlockUserObject, BlockUsersApi, BlockUsersClass, BlockUsersRequest, BlockUsersResponse, BlockedUserInfo, BodyOptions, BusinessProfileApi, BusinessProfileClass, BusinessProfileData, BusinessProfileField, BusinessProfileFieldsParam, BusinessProfileResponse, BusinessVerticalEnum, ButtonMessage, ButtonOptions, ButtonPositionEnum, CarouselCard, CarouselOptions, CatalogButton, CatalogTemplateOptions, CategoryEnum, CodeVerificationStatus, ComponentTypes, ComponentTypesEnum, ContactObject, ContactsMessage, ConversationTypesEnum, CopyCodeButton, CouponTemplateOptions, CreateFlowResponse, CreateQrCodeRequest, CreateUploadSessionParams, CurrencyCodesEnum, CurrencyParameter, Cursors, DataLocalizationRegionEnum, DateTimeParameter, DocumentMediaObject, DocumentMediaTypesEnum, DocumentMessage, EncryptionApi, EncryptionClass, EncryptionKeyPair, EncryptionPublicKeyResponse, ErrorWebhookValue, ExpressRequest, ExpressResponse, ExpressWebhookConfig, FailedUserInfo, 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, GroupMessage, HeaderOptions, HealthStatus, HealthStatusEntity, HttpMethodsEnum, HttpsClientClass, HttpsClientResponseClass, ImageMediaObject, ImageMediaTypesEnum, ImageMessage, InteractiveButtonReplyMessage, InteractiveListReplyMessage, InteractiveMessage, InteractiveObject, InteractiveTypesEnum, LanguagesEnum, LimitedTimeOfferOptions, LimitedTimeOfferTemplateOptions, ListBlockedUsersParams, ListBlockedUsersResponse, LocationMessage, LocationObject, LocationParameter, Logger, LoggerInterface, MPMButton, MPMTemplateOptions, MediaApi, MediaCardCarouselTemplateOptions, MediaCarouselCard, MediaClass, MediaParameter, MediaResponse, MediasResponse, MessagesApi as MessageApi, MessagesApi, MessageHandler, MessageRequestBody, MessageRequestParams, MessageStatus, MessageTemplateObject, MessageTypesEnum, MessageWebhookValue, MessagesClass, MessagesResponse, MessagingLimitTier, MetaError, MetaErrorDetail, NextFunction, NextJsAppWebhookConfig, NextJsWebhookConfig, OTPButton, OTPTemplateOptions, OrderMessage, Pagination, PaginationCursors, Paging, PagingCursors, PagingInfo, ParametersTypesEnum, PhoneNumberApi, PhoneNumberButton, PhoneNumberClass, PhoneNumberResponse, PhoneNumbersResponse, PlatformType, ProcessedMessage, ProcessedStatus, ProductCardCarouselTemplateOptions, ProductCarouselCard, ProductParameter, ProductSection, QrCodeApi, QrCodeClass, QrCodeResponse, QrCodesResponse, QualityRating, QualityScore, QuickReplyButton, ReactionMessage, ReactionParams, ReferralSourceTypesEnum, RegistrationApi, RegistrationClass, RegistrationRequest, RequestCodeMethodsEnum, RequestVerificationCodeRequest, RequesterClass, RequesterResponseInterface, ResponseData, ResponseHeaderValue, ResponseHeaders, ResponseJSONBody, ResponsePagination, ResponseSuccess, SPMButton, SPMTemplateOptions, StatusEnum, StatusHandler, StatusParams, StatusWebhook, StatusWebhookValue, StickerMediaObject, StickerMediaTypesEnum, StickerMessage, SubTypeEnum, SystemChangeTypesEnum, SystemMessage, TemplateApi, TemplateBody, TemplateButton, TemplateButtons, TemplateCarousel, TemplateClass, TemplateDeleteParams, TemplateFooter, TemplateFormat, TemplateGetParams, TemplateHeader, TemplateHeaderExample, TemplateLimitedTimeOffer, TemplateOptions, TemplateParameter, TemplateRequestBody, TemplateResponse, TemplateStatusEnum, TextMessage, TextMessageParams, TextObject, TextParameter, Throughput, ThroughputLevel, TwoStepVerificationApi, TwoStepVerificationClass, TwoStepVerificationParams, TwoStepVerificationRequest, URLButton, UnblockUsersRequest, UnsupportedMessage, UpdateBusinessProfileRequest, UpdateFlowResponse, UpdateQrCodeRequest, UpdateWabaSubscription, UploadBusinessProfileResponse, UploadHandle, UploadMediaParams, UploadMediaResponse, UploadSession, UploadSessionResponse, ValidateFlowJsonResponse, VerifyCodeRequest, VideoMediaObject, VideoMediaTypesEnum, VideoMessage, WABAClass, WabaAccount, WabaAccountFields, WabaAccountFieldsParam, WabaAccountReviewStatus, WabaAccountStatus, WabaApi, WabaBusinessVerificationStatus, WabaConfigEnum, WabaConfigType, WabaHealthStatus, WabaHealthStatusCanSendMessage, WabaHealthStatusEntity, WabaHealthStatusError, WabaSubscription, WabaSubscriptions, WebhookContact, WebhookEvent, WebhookMessage, WebhookPayload, WebhookProcessor, WebhookResponse, WebhookTypesEnum, WebhookValue, WhatsApp, WhatsAppConfig, WhatsAppMessage, buildFieldsQueryString, constructFullUrl, createAuthenticationTemplate, createCatalogTemplate, createCouponTemplate, createLimitedTimeOfferTemplate, createMPMTemplate, createMediaCardCarouselTemplate, createOTPTemplate, createProductCardCarouselTemplate, createSPMTemplate, createTemplate, expressWebhookHandler, formatConfigTable, generateEncryption, generateXHub256Sig, isFlowDataExchangeRequest, isFlowErrorRequest, isFlowPingRequest, isMetaError, nextjsAppWebhookHandler, nextjsPagesWebhookHandler, objectToQueryString, processFlowRequest, processWebhookMessages };
|
|
4187
4339
|
//# sourceMappingURL=index.d.ts.map
|