meta-cloud-api 1.1.9 → 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 +2144 -2059
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/types/{enums-C_tIIGBV.d.ts → enums-mxRGX-JN.d.ts} +1 -1
- package/dist/types/{enums-C_tIIGBV.d.ts.map → enums-mxRGX-JN.d.ts.map} +1 -1
- package/dist/types/enums-r-Amysog.js +2 -0
- package/dist/types/enums-r-Amysog.js.map +1 -0
- package/dist/types/enums.d.ts +1 -1
- package/dist/types/enums.js +1 -2
- package/dist/types/index.d.ts +739 -755
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +237 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +14 -1
- package/dist/types/enums.js.map +0 -1
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 {
|
|
@@ -747,6 +748,24 @@ type WabaConfigType = {
|
|
|
747
748
|
//#endregion
|
|
748
749
|
//#region src/types/request.d.ts
|
|
749
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
|
+
}
|
|
750
769
|
interface RequesterResponseInterface<T> {
|
|
751
770
|
json: () => Promise<T>;
|
|
752
771
|
}
|
|
@@ -792,6 +811,33 @@ declare class HttpsClientClass {
|
|
|
792
811
|
sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
|
|
793
812
|
}
|
|
794
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
|
|
795
841
|
//#region src/types/base.d.ts
|
|
796
842
|
declare class BaseClass {
|
|
797
843
|
constructor(config: WabaConfigType);
|
|
@@ -805,2102 +851,1773 @@ declare class BaseAPI implements BaseClass {
|
|
|
805
851
|
protected sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
|
|
806
852
|
}
|
|
807
853
|
//#endregion
|
|
808
|
-
//#region src/api/
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
*/
|
|
819
|
-
interface UploadSessionResponse {
|
|
820
|
-
id: string;
|
|
821
|
-
}
|
|
822
|
-
/**
|
|
823
|
-
* Response from uploading business profile media.
|
|
824
|
-
*/
|
|
825
|
-
interface UploadBusinessProfileResponse {
|
|
826
|
-
h: string;
|
|
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>;
|
|
827
864
|
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
handle_type: string;
|
|
836
|
-
name: string;
|
|
837
|
-
};
|
|
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>;
|
|
838
872
|
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
interface CreateUploadSessionParams {
|
|
873
|
+
//#endregion
|
|
874
|
+
//#region src/core/webhook/types.d.ts
|
|
875
|
+
interface WebhookContact {
|
|
843
876
|
/**
|
|
844
|
-
*
|
|
877
|
+
* WhatsApp ID of the contact. Business can respond to this contact using this ID.
|
|
845
878
|
*/
|
|
846
|
-
|
|
879
|
+
wa_id: string;
|
|
847
880
|
/**
|
|
848
|
-
*
|
|
881
|
+
* Additional unique, alphanumeric identifier for a WhatsApp user
|
|
849
882
|
*/
|
|
850
|
-
|
|
883
|
+
user_id?: string;
|
|
851
884
|
/**
|
|
852
|
-
*
|
|
885
|
+
* Profile of Whatsapp user
|
|
853
886
|
*/
|
|
854
|
-
|
|
887
|
+
profile: {
|
|
888
|
+
/**
|
|
889
|
+
* The display name of the contact
|
|
890
|
+
*/
|
|
891
|
+
name: string;
|
|
892
|
+
};
|
|
855
893
|
}
|
|
856
894
|
/**
|
|
857
|
-
*
|
|
895
|
+
* Base message interface with common properties
|
|
858
896
|
*/
|
|
859
|
-
interface
|
|
897
|
+
interface BaseMessage {
|
|
898
|
+
id: string;
|
|
899
|
+
from: string;
|
|
900
|
+
timestamp: string;
|
|
901
|
+
type: MessageTypesEnum;
|
|
860
902
|
/**
|
|
861
|
-
*
|
|
903
|
+
* Context object, included when a user replies or interacts
|
|
862
904
|
*/
|
|
863
|
-
|
|
905
|
+
context?: {
|
|
906
|
+
/**
|
|
907
|
+
* ID of the message
|
|
908
|
+
*/
|
|
909
|
+
id?: string;
|
|
910
|
+
/**
|
|
911
|
+
* ID of the sender
|
|
912
|
+
*/
|
|
913
|
+
from?: string;
|
|
914
|
+
/**
|
|
915
|
+
* ID of the message being replied to or interacted with
|
|
916
|
+
*/
|
|
917
|
+
message_id: string;
|
|
918
|
+
/**
|
|
919
|
+
* ID of the forwarded message, if applicable
|
|
920
|
+
*/
|
|
921
|
+
forwarded?: boolean;
|
|
922
|
+
/**
|
|
923
|
+
* Frequently forwarded status
|
|
924
|
+
*/
|
|
925
|
+
frequently_forwarded?: boolean;
|
|
926
|
+
/**
|
|
927
|
+
* Original message information if the message was referred
|
|
928
|
+
*/
|
|
929
|
+
referred_product?: {
|
|
930
|
+
/**
|
|
931
|
+
* Catalog ID
|
|
932
|
+
*/
|
|
933
|
+
catalog_id: string;
|
|
934
|
+
/**
|
|
935
|
+
* Product ID
|
|
936
|
+
*/
|
|
937
|
+
product_retailer_id: string;
|
|
938
|
+
};
|
|
939
|
+
};
|
|
864
940
|
/**
|
|
865
|
-
*
|
|
941
|
+
* Errors array, if the message had errors
|
|
866
942
|
*/
|
|
867
|
-
|
|
943
|
+
errors?: Array<{
|
|
944
|
+
/**
|
|
945
|
+
* Error code
|
|
946
|
+
*/
|
|
947
|
+
code: number;
|
|
948
|
+
/**
|
|
949
|
+
* Error title
|
|
950
|
+
*/
|
|
951
|
+
title: string;
|
|
952
|
+
/**
|
|
953
|
+
* Error message
|
|
954
|
+
*/
|
|
955
|
+
message: string;
|
|
956
|
+
/**
|
|
957
|
+
* Error details object
|
|
958
|
+
*/
|
|
959
|
+
error_data?: {
|
|
960
|
+
/**
|
|
961
|
+
* Describes the error details
|
|
962
|
+
*/
|
|
963
|
+
details: string;
|
|
964
|
+
};
|
|
965
|
+
}>;
|
|
868
966
|
}
|
|
869
967
|
/**
|
|
870
|
-
*
|
|
968
|
+
* Text message interface
|
|
871
969
|
*/
|
|
872
|
-
interface
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
970
|
+
interface TextMessage extends BaseMessage {
|
|
971
|
+
type: MessageTypesEnum.Text;
|
|
972
|
+
text: {
|
|
973
|
+
/**
|
|
974
|
+
* The text content of the message
|
|
975
|
+
*/
|
|
976
|
+
body: string;
|
|
977
|
+
preview_url?: boolean;
|
|
978
|
+
};
|
|
877
979
|
}
|
|
878
|
-
//#endregion
|
|
879
|
-
//#region src/api/profile/types/common.d.ts
|
|
880
980
|
/**
|
|
881
|
-
*
|
|
981
|
+
* Image message interface
|
|
882
982
|
*/
|
|
883
|
-
|
|
884
|
-
type
|
|
983
|
+
interface ImageMessage extends BaseMessage {
|
|
984
|
+
type: MessageTypesEnum.Image;
|
|
985
|
+
image: {
|
|
986
|
+
/**
|
|
987
|
+
* The image caption (if provided)
|
|
988
|
+
*/
|
|
989
|
+
caption?: string;
|
|
990
|
+
/**
|
|
991
|
+
* The SHA256 hash of the image
|
|
992
|
+
*/
|
|
993
|
+
sha256?: string;
|
|
994
|
+
/**
|
|
995
|
+
* The ID for the image
|
|
996
|
+
*/
|
|
997
|
+
id: string;
|
|
998
|
+
/**
|
|
999
|
+
* The MIME type of the image
|
|
1000
|
+
*/
|
|
1001
|
+
mime_type: string;
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
885
1004
|
/**
|
|
886
|
-
*
|
|
1005
|
+
* Video message interface
|
|
887
1006
|
*/
|
|
888
|
-
interface
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
/**
|
|
909
|
-
* The contact email address (in valid email format) of the business. Character limit 128.
|
|
910
|
-
*/
|
|
911
|
-
email?: string;
|
|
912
|
-
/**
|
|
913
|
-
* The messaging service used for the request. Always set it to "whatsapp" if you are using
|
|
914
|
-
* the WhatsApp Business API.
|
|
915
|
-
*/
|
|
916
|
-
messaging_product: string;
|
|
917
|
-
/**
|
|
918
|
-
* Profile picture URL.
|
|
919
|
-
*/
|
|
920
|
-
profile_picture_url?: string;
|
|
921
|
-
/**
|
|
922
|
-
* The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
|
|
923
|
-
* - You must include the http:// or https:// portion of the URL
|
|
924
|
-
* - There is a maximum of 2 websites with a maximum of 256 characters each
|
|
925
|
-
*/
|
|
926
|
-
websites?: string[];
|
|
927
|
-
/**
|
|
928
|
-
* Business category. This can be either an empty string or one of the predefined business categories.
|
|
929
|
-
* @see BusinessVerticalEnum for all available options
|
|
930
|
-
*/
|
|
931
|
-
vertical?: BusinessVerticalEnum | string;
|
|
1007
|
+
interface VideoMessage extends BaseMessage {
|
|
1008
|
+
type: MessageTypesEnum.Video;
|
|
1009
|
+
video: {
|
|
1010
|
+
/**
|
|
1011
|
+
* The video caption (if provided)
|
|
1012
|
+
*/
|
|
1013
|
+
caption?: string;
|
|
1014
|
+
/**
|
|
1015
|
+
* The SHA256 hash of the video
|
|
1016
|
+
*/
|
|
1017
|
+
sha256?: string;
|
|
1018
|
+
/**
|
|
1019
|
+
* The ID for the video
|
|
1020
|
+
*/
|
|
1021
|
+
id: string;
|
|
1022
|
+
/**
|
|
1023
|
+
* The MIME type of the video
|
|
1024
|
+
*/
|
|
1025
|
+
mime_type: string;
|
|
1026
|
+
};
|
|
932
1027
|
}
|
|
933
1028
|
/**
|
|
934
|
-
*
|
|
1029
|
+
* Audio message interface
|
|
935
1030
|
*/
|
|
936
|
-
interface
|
|
937
|
-
|
|
1031
|
+
interface AudioMessage extends BaseMessage {
|
|
1032
|
+
type: MessageTypesEnum.Audio;
|
|
1033
|
+
audio: {
|
|
1034
|
+
/**
|
|
1035
|
+
* The ID for the audio file
|
|
1036
|
+
*/
|
|
1037
|
+
id: string;
|
|
1038
|
+
/**
|
|
1039
|
+
* The MIME type of the audio file
|
|
1040
|
+
*/
|
|
1041
|
+
mime_type: string;
|
|
1042
|
+
/**
|
|
1043
|
+
* Whether the audio is a voice message
|
|
1044
|
+
*/
|
|
1045
|
+
voice?: boolean;
|
|
1046
|
+
};
|
|
938
1047
|
}
|
|
939
1048
|
/**
|
|
940
|
-
*
|
|
1049
|
+
* Document message interface
|
|
941
1050
|
*/
|
|
942
|
-
interface
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
*/
|
|
967
|
-
description?: string;
|
|
968
|
-
/**
|
|
969
|
-
* Business category. This can be either an empty string or one of the predefined business categories.
|
|
970
|
-
* @see BusinessVerticalEnum for all available options
|
|
971
|
-
*/
|
|
972
|
-
vertical?: BusinessVerticalEnum | string;
|
|
973
|
-
/**
|
|
974
|
-
* The contact email address (in valid email format) of the business. Character limit 128.
|
|
975
|
-
*/
|
|
976
|
-
email?: string;
|
|
977
|
-
/**
|
|
978
|
-
* The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
|
|
979
|
-
* - You must include the http:// or https:// portion of the URL
|
|
980
|
-
* - There is a maximum of 2 websites with a maximum of 256 characters each
|
|
981
|
-
*/
|
|
982
|
-
websites?: string[];
|
|
983
|
-
/**
|
|
984
|
-
* Handle of the profile picture. This handle is generated when you upload the binary file
|
|
985
|
-
* for the profile picture to Meta using the Resumable Upload API.
|
|
986
|
-
*/
|
|
987
|
-
profile_picture_handle?: string;
|
|
988
|
-
}
|
|
989
|
-
declare class BusinessProfileClass extends BaseClass {
|
|
990
|
-
/**
|
|
991
|
-
* Get your business profile.
|
|
992
|
-
* @param fields Specific fields to be returned in the response. If not specified, all fields will be returned.
|
|
993
|
-
*/
|
|
994
|
-
getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
|
|
995
|
-
/**
|
|
996
|
-
* Update your business profile.
|
|
997
|
-
* @param updateRequest The request object containing the fields to update.
|
|
998
|
-
*/
|
|
999
|
-
updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
|
|
1000
|
-
/**
|
|
1001
|
-
* Create an upload session for profile picture.
|
|
1002
|
-
* @param fileLength Length of the file to be uploaded in bytes.
|
|
1003
|
-
* @param fileType MIME type of the file (e.g., 'image/jpeg').
|
|
1004
|
-
* @param fileName Name of the file.
|
|
1005
|
-
*/
|
|
1006
|
-
createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
|
|
1007
|
-
/**
|
|
1008
|
-
* Upload media file to the upload session.
|
|
1009
|
-
* @param uploadId The ID of the upload session.
|
|
1010
|
-
* @param file The binary data of the file.
|
|
1011
|
-
*/
|
|
1012
|
-
uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
|
|
1013
|
-
/**
|
|
1014
|
-
* Get the upload handle information.
|
|
1015
|
-
* @param uploadId The ID of the upload session.
|
|
1016
|
-
*/
|
|
1017
|
-
getUploadHandle(uploadId: string): Promise<UploadHandle>;
|
|
1051
|
+
interface DocumentMessage extends BaseMessage {
|
|
1052
|
+
type: MessageTypesEnum.Document;
|
|
1053
|
+
document: {
|
|
1054
|
+
/**
|
|
1055
|
+
* The document caption (if provided)
|
|
1056
|
+
*/
|
|
1057
|
+
caption?: string;
|
|
1058
|
+
/**
|
|
1059
|
+
* The document filename
|
|
1060
|
+
*/
|
|
1061
|
+
filename: string;
|
|
1062
|
+
/**
|
|
1063
|
+
* The SHA256 hash of the document
|
|
1064
|
+
*/
|
|
1065
|
+
sha256?: string;
|
|
1066
|
+
/**
|
|
1067
|
+
* The ID for the document
|
|
1068
|
+
*/
|
|
1069
|
+
id: string;
|
|
1070
|
+
/**
|
|
1071
|
+
* The MIME type of the document
|
|
1072
|
+
*/
|
|
1073
|
+
mime_type: string;
|
|
1074
|
+
};
|
|
1018
1075
|
}
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
type
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
};
|
|
1038
|
-
type HealthStatus = {
|
|
1039
|
-
can_send_message: string;
|
|
1040
|
-
entities: HealthStatusEntity[];
|
|
1041
|
-
};
|
|
1042
|
-
type QualityScore = {
|
|
1043
|
-
score: QualityRating;
|
|
1044
|
-
};
|
|
1045
|
-
type Throughput = {
|
|
1046
|
-
level: ThroughputLevel;
|
|
1047
|
-
};
|
|
1048
|
-
type PhoneNumberResponse = {
|
|
1049
|
-
display_phone_number: string;
|
|
1050
|
-
id: string;
|
|
1051
|
-
quality_rating: QualityRating;
|
|
1052
|
-
verified_name: string;
|
|
1053
|
-
account_mode?: AccountMode;
|
|
1054
|
-
certificate?: string;
|
|
1055
|
-
code_verification_status?: CodeVerificationStatus;
|
|
1056
|
-
conversational_automation?: Record<string, unknown>;
|
|
1057
|
-
eligibility_for_api_business_global_search?: string;
|
|
1058
|
-
health_status?: HealthStatus;
|
|
1059
|
-
is_official_business_account?: boolean;
|
|
1060
|
-
is_on_biz_app?: boolean;
|
|
1061
|
-
is_pin_enabled?: boolean;
|
|
1062
|
-
is_preverified_number?: boolean;
|
|
1063
|
-
last_onboarded_time?: string;
|
|
1064
|
-
messaging_limit_tier?: MessagingLimitTier;
|
|
1065
|
-
name_status?: string;
|
|
1066
|
-
new_certificate?: string;
|
|
1067
|
-
new_name_status?: string;
|
|
1068
|
-
platform_type?: PlatformType;
|
|
1069
|
-
quality_score?: QualityScore;
|
|
1070
|
-
search_visibility?: string;
|
|
1071
|
-
status?: CodeVerificationStatus;
|
|
1072
|
-
throughput?: Throughput;
|
|
1073
|
-
};
|
|
1074
|
-
type Cursors = {
|
|
1075
|
-
before: string;
|
|
1076
|
-
after: string;
|
|
1077
|
-
};
|
|
1078
|
-
type PhoneNumbersResponse = {
|
|
1079
|
-
data: PhoneNumberResponse[];
|
|
1080
|
-
paging: Paging;
|
|
1081
|
-
};
|
|
1082
|
-
type RequestVerificationCodeRequest = {
|
|
1083
|
-
code_method: 'SMS' | 'VOICE';
|
|
1084
|
-
language: string;
|
|
1085
|
-
};
|
|
1086
|
-
type VerifyCodeRequest = {
|
|
1087
|
-
code: string;
|
|
1088
|
-
};
|
|
1089
|
-
type TwoStepVerificationParams = {
|
|
1090
|
-
pin: string;
|
|
1091
|
-
};
|
|
1092
|
-
interface PhoneNumberClass {
|
|
1093
|
-
getPhoneNumberById(fields?: string): Promise<PhoneNumberResponse>;
|
|
1094
|
-
getPhoneNumbers(): Promise<PhoneNumbersResponse>;
|
|
1095
|
-
requestVerificationCode(params: RequestVerificationCodeRequest): Promise<ResponseSuccess>;
|
|
1096
|
-
verifyCode(params: VerifyCodeRequest): Promise<ResponseSuccess>;
|
|
1076
|
+
/**
|
|
1077
|
+
* Sticker message interface
|
|
1078
|
+
*/
|
|
1079
|
+
interface StickerMessage extends BaseMessage {
|
|
1080
|
+
type: MessageTypesEnum.Sticker;
|
|
1081
|
+
sticker: {
|
|
1082
|
+
/**
|
|
1083
|
+
* The ID for the sticker
|
|
1084
|
+
*/
|
|
1085
|
+
id: string;
|
|
1086
|
+
/**
|
|
1087
|
+
* Whether this is an animated sticker
|
|
1088
|
+
*/
|
|
1089
|
+
animated: boolean;
|
|
1090
|
+
/**
|
|
1091
|
+
* The MIME type of the sticker
|
|
1092
|
+
*/
|
|
1093
|
+
mime_type: string;
|
|
1094
|
+
};
|
|
1097
1095
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
type:
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1096
|
+
/**
|
|
1097
|
+
* Reaction message interface
|
|
1098
|
+
*/
|
|
1099
|
+
interface ReactionMessage extends BaseMessage {
|
|
1100
|
+
type: MessageTypesEnum.Reaction;
|
|
1101
|
+
reaction: {
|
|
1102
|
+
/**
|
|
1103
|
+
* The ID of the message being reacted to
|
|
1104
|
+
*/
|
|
1105
|
+
message_id: string;
|
|
1106
|
+
/**
|
|
1107
|
+
* Emoji used for the reaction
|
|
1108
|
+
*/
|
|
1109
|
+
emoji: string;
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* Contacts message interface
|
|
1114
|
+
*/
|
|
1115
|
+
interface ContactsMessage extends BaseMessage {
|
|
1116
|
+
type: MessageTypesEnum.Contacts;
|
|
1117
|
+
contacts: Array<{
|
|
1118
|
+
/**
|
|
1119
|
+
* The contact's name
|
|
1120
|
+
*/
|
|
1121
|
+
name: {
|
|
1122
|
+
/**
|
|
1123
|
+
* The formatted name
|
|
1124
|
+
*/
|
|
1125
|
+
formatted_name: string;
|
|
1126
|
+
/**
|
|
1127
|
+
* The first name
|
|
1128
|
+
*/
|
|
1129
|
+
first_name?: string;
|
|
1130
|
+
/**
|
|
1131
|
+
* The last name
|
|
1132
|
+
*/
|
|
1133
|
+
last_name?: string;
|
|
1134
|
+
/**
|
|
1135
|
+
* The middle name
|
|
1136
|
+
*/
|
|
1137
|
+
middle_name?: string;
|
|
1138
|
+
/**
|
|
1139
|
+
* The suffix
|
|
1140
|
+
*/
|
|
1141
|
+
suffix?: string;
|
|
1142
|
+
/**
|
|
1143
|
+
* The prefix
|
|
1144
|
+
*/
|
|
1145
|
+
prefix?: string;
|
|
1146
|
+
};
|
|
1147
|
+
/**
|
|
1148
|
+
* The contact's phone numbers
|
|
1149
|
+
*/
|
|
1150
|
+
phones?: Array<{
|
|
1151
|
+
phone: string;
|
|
1152
|
+
type?: string;
|
|
1153
|
+
wa_id?: string;
|
|
1154
|
+
}>;
|
|
1155
|
+
/**
|
|
1156
|
+
* The contact's emails
|
|
1157
|
+
*/
|
|
1158
|
+
emails?: Array<{
|
|
1159
|
+
email: string;
|
|
1160
|
+
type?: string;
|
|
1161
|
+
}>;
|
|
1162
|
+
/**
|
|
1163
|
+
* The contact's addresses
|
|
1164
|
+
*/
|
|
1165
|
+
addresses?: Array<{
|
|
1166
|
+
street?: string;
|
|
1167
|
+
city?: string;
|
|
1168
|
+
state?: string;
|
|
1169
|
+
zip?: string;
|
|
1170
|
+
country?: string;
|
|
1171
|
+
country_code?: string;
|
|
1172
|
+
type?: string;
|
|
1173
|
+
}>;
|
|
1174
|
+
/**
|
|
1175
|
+
* The contact's organizations
|
|
1176
|
+
*/
|
|
1177
|
+
org?: {
|
|
1178
|
+
company?: string;
|
|
1179
|
+
department?: string;
|
|
1134
1180
|
title?: string;
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1181
|
+
};
|
|
1182
|
+
/**
|
|
1183
|
+
* The contact's URLs
|
|
1184
|
+
*/
|
|
1185
|
+
urls?: Array<{
|
|
1186
|
+
url: string;
|
|
1187
|
+
type?: string;
|
|
1138
1188
|
}>;
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
};
|
|
1144
|
-
type SPMButton = {
|
|
1145
|
-
type: 'SPM';
|
|
1146
|
-
action?: {
|
|
1147
|
-
product_retailer_id: string;
|
|
1148
|
-
};
|
|
1149
|
-
};
|
|
1150
|
-
type CatalogButton = {
|
|
1151
|
-
type: 'CATALOG';
|
|
1152
|
-
action?: {
|
|
1153
|
-
thumbnail_product_retailer_id: string;
|
|
1154
|
-
};
|
|
1155
|
-
};
|
|
1156
|
-
type TemplateButton = PhoneNumberButton | URLButton | QuickReplyButton | CopyCodeButton | FlowButton | MPMButton | OTPButton | SPMButton | CatalogButton;
|
|
1157
|
-
type TemplateHeaderExample = {
|
|
1158
|
-
header_text?: string[];
|
|
1159
|
-
header_text_named_params?: Array<{
|
|
1160
|
-
param_name: string;
|
|
1161
|
-
example: string;
|
|
1189
|
+
/**
|
|
1190
|
+
* The contact's birthday (YYYY-MM-DD format)
|
|
1191
|
+
*/
|
|
1192
|
+
birthday?: string;
|
|
1162
1193
|
}>;
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
type TemplateButtons = {
|
|
1187
|
-
type: 'BUTTONS';
|
|
1188
|
-
buttons: TemplateButton[];
|
|
1189
|
-
};
|
|
1190
|
-
type TemplateLimitedTimeOffer = {
|
|
1191
|
-
type: 'LIMITED_TIME_OFFER';
|
|
1192
|
-
limited_time_offer: {
|
|
1193
|
-
expiration_time_ms: number;
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Location message interface
|
|
1197
|
+
*/
|
|
1198
|
+
interface LocationMessage extends BaseMessage {
|
|
1199
|
+
type: MessageTypesEnum.Location;
|
|
1200
|
+
location: {
|
|
1201
|
+
/**
|
|
1202
|
+
* Latitude of the location
|
|
1203
|
+
*/
|
|
1204
|
+
latitude: number;
|
|
1205
|
+
/**
|
|
1206
|
+
* Longitude of the location
|
|
1207
|
+
*/
|
|
1208
|
+
longitude: number;
|
|
1209
|
+
/**
|
|
1210
|
+
* Name of the location
|
|
1211
|
+
*/
|
|
1212
|
+
name?: string;
|
|
1213
|
+
/**
|
|
1214
|
+
* Address of the location
|
|
1215
|
+
*/
|
|
1216
|
+
address?: string;
|
|
1194
1217
|
};
|
|
1195
|
-
};
|
|
1196
|
-
type TemplateCarousel = {
|
|
1197
|
-
type: 'CAROUSEL';
|
|
1198
|
-
cards: Array<{
|
|
1199
|
-
card_index: number;
|
|
1200
|
-
components: ComponentTypes[];
|
|
1201
|
-
}>;
|
|
1202
|
-
};
|
|
1203
|
-
type MediaCarouselCard = {
|
|
1204
|
-
card_index: number;
|
|
1205
|
-
components: (TemplateHeader | TemplateBody | TemplateButtons)[];
|
|
1206
|
-
};
|
|
1207
|
-
type ProductCarouselCard = {
|
|
1208
|
-
card_index: number;
|
|
1209
|
-
components: TemplateHeader[];
|
|
1210
|
-
};
|
|
1211
|
-
type ComponentTypes = TemplateHeader | TemplateBody | TemplateFooter | TemplateButtons | TemplateLimitedTimeOffer | TemplateCarousel;
|
|
1212
|
-
type TemplateRequestBody = GeneralRequestBody & {
|
|
1213
|
-
name: string;
|
|
1214
|
-
language: LanguagesEnum;
|
|
1215
|
-
category?: CategoryEnum;
|
|
1216
|
-
components?: ComponentTypes[];
|
|
1217
|
-
};
|
|
1218
|
-
type TemplateResponse = {
|
|
1219
|
-
id: string;
|
|
1220
|
-
status: string;
|
|
1221
|
-
language: LanguagesEnum;
|
|
1222
|
-
category: CategoryEnum;
|
|
1223
|
-
name: string;
|
|
1224
|
-
components: ComponentTypes[];
|
|
1225
|
-
};
|
|
1226
|
-
type TemplateGetParams = {
|
|
1227
|
-
limit?: number;
|
|
1228
|
-
name?: string;
|
|
1229
|
-
language?: LanguagesEnum;
|
|
1230
|
-
category?: CategoryEnum;
|
|
1231
|
-
status?: TemplateStatusEnum;
|
|
1232
|
-
};
|
|
1233
|
-
type TemplateDeleteParams = {
|
|
1234
|
-
hsm_id: string;
|
|
1235
|
-
name: string;
|
|
1236
|
-
};
|
|
1237
|
-
declare class TemplateClass {
|
|
1238
|
-
getTemplate(templateId: string): Promise<TemplateResponse>;
|
|
1239
|
-
updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>;
|
|
1240
|
-
getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>;
|
|
1241
|
-
createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>;
|
|
1242
|
-
deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
|
|
1243
1218
|
}
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1219
|
+
/**
|
|
1220
|
+
* Interactive message interface
|
|
1221
|
+
*/
|
|
1222
|
+
interface InteractiveMessage extends BaseMessage {
|
|
1223
|
+
type: MessageTypesEnum.Interactive;
|
|
1224
|
+
interactive: {
|
|
1225
|
+
/**
|
|
1226
|
+
* Type of the interactive message
|
|
1227
|
+
* Can be: button_reply, list_reply, flow, nfm_reply, etc.
|
|
1228
|
+
*/
|
|
1229
|
+
type: string;
|
|
1230
|
+
/**
|
|
1231
|
+
* ID for the button that was clicked
|
|
1232
|
+
*/
|
|
1233
|
+
button_reply?: {
|
|
1234
|
+
id: string;
|
|
1235
|
+
title: string;
|
|
1236
|
+
};
|
|
1237
|
+
/**
|
|
1238
|
+
* ID for the list item that was selected
|
|
1239
|
+
*/
|
|
1240
|
+
list_reply?: {
|
|
1241
|
+
id: string;
|
|
1242
|
+
title: string;
|
|
1243
|
+
description?: string;
|
|
1244
|
+
};
|
|
1245
|
+
/**
|
|
1246
|
+
* NFM (No-Code Flow Message) reply data
|
|
1247
|
+
*/
|
|
1248
|
+
nfm_reply?: {
|
|
1249
|
+
/**
|
|
1250
|
+
* Response data in JSON format
|
|
1251
|
+
*/
|
|
1252
|
+
response_json: string;
|
|
1253
|
+
/**
|
|
1254
|
+
* Body text of the reply
|
|
1255
|
+
*/
|
|
1256
|
+
body: string;
|
|
1257
|
+
/**
|
|
1258
|
+
* Name of the flow
|
|
1259
|
+
*/
|
|
1260
|
+
name: string;
|
|
1261
|
+
};
|
|
1262
|
+
};
|
|
1275
1263
|
}
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1264
|
+
/**
|
|
1265
|
+
* System message interface
|
|
1266
|
+
*/
|
|
1267
|
+
interface SystemMessage extends BaseMessage {
|
|
1268
|
+
type: MessageTypesEnum.System;
|
|
1269
|
+
system: {
|
|
1270
|
+
/**
|
|
1271
|
+
* The type of system update
|
|
1272
|
+
*/
|
|
1273
|
+
type: string;
|
|
1274
|
+
/**
|
|
1275
|
+
* User's identity if the update is a customer identity change
|
|
1276
|
+
*/
|
|
1277
|
+
identity?: string;
|
|
1278
|
+
/**
|
|
1279
|
+
* Old and new phone numbers if the update is a phone number change
|
|
1280
|
+
*/
|
|
1281
|
+
customer?: {
|
|
1282
|
+
/**
|
|
1283
|
+
* The previous phone number
|
|
1284
|
+
*/
|
|
1285
|
+
previous_wa_id: string;
|
|
1286
|
+
/**
|
|
1287
|
+
* The new phone number
|
|
1288
|
+
*/
|
|
1289
|
+
wa_id: string;
|
|
1290
|
+
};
|
|
1288
1291
|
};
|
|
1289
1292
|
}
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1293
|
+
/**
|
|
1294
|
+
* Order message interface
|
|
1295
|
+
*/
|
|
1296
|
+
interface OrderMessage extends BaseMessage {
|
|
1297
|
+
type: MessageTypesEnum.Order;
|
|
1298
|
+
order: {
|
|
1299
|
+
/**
|
|
1300
|
+
* Catalog ID
|
|
1301
|
+
*/
|
|
1302
|
+
catalog_id: string;
|
|
1303
|
+
/**
|
|
1304
|
+
* Product items in the order
|
|
1305
|
+
*/
|
|
1306
|
+
product_items: Array<{
|
|
1307
|
+
/**
|
|
1308
|
+
* Product ID
|
|
1309
|
+
*/
|
|
1310
|
+
product_retailer_id: string;
|
|
1311
|
+
/**
|
|
1312
|
+
* Quantity of the product
|
|
1313
|
+
*/
|
|
1314
|
+
quantity: number;
|
|
1315
|
+
/**
|
|
1316
|
+
* Item price
|
|
1317
|
+
*/
|
|
1318
|
+
item_price: number;
|
|
1319
|
+
/**
|
|
1320
|
+
* Currency code
|
|
1321
|
+
*/
|
|
1322
|
+
currency: string;
|
|
1298
1323
|
}>;
|
|
1324
|
+
/**
|
|
1325
|
+
* Text message included with the order
|
|
1326
|
+
*/
|
|
1327
|
+
text?: string;
|
|
1299
1328
|
};
|
|
1300
1329
|
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
interface
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
quick_reply?: {
|
|
1315
|
-
text: string;
|
|
1316
|
-
}[];
|
|
1317
|
-
copy_code?: {
|
|
1318
|
-
example: string;
|
|
1319
|
-
};
|
|
1320
|
-
flow?: {
|
|
1330
|
+
/**
|
|
1331
|
+
* Button message interface
|
|
1332
|
+
*/
|
|
1333
|
+
interface ButtonMessage extends BaseMessage {
|
|
1334
|
+
type: MessageTypesEnum.Button;
|
|
1335
|
+
button: {
|
|
1336
|
+
/**
|
|
1337
|
+
* The payload for the button
|
|
1338
|
+
*/
|
|
1339
|
+
payload: string;
|
|
1340
|
+
/**
|
|
1341
|
+
* Button text
|
|
1342
|
+
*/
|
|
1321
1343
|
text: string;
|
|
1322
|
-
flow_id?: string;
|
|
1323
|
-
flow_name?: string;
|
|
1324
|
-
flow_json?: string;
|
|
1325
|
-
flow_action?: 'navigate' | 'data_exchange';
|
|
1326
|
-
navigate_screen?: string;
|
|
1327
1344
|
};
|
|
1328
|
-
mpm?: boolean;
|
|
1329
|
-
otp?: boolean;
|
|
1330
|
-
spm?: boolean;
|
|
1331
1345
|
}
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1346
|
+
/**
|
|
1347
|
+
* Represents a message received through the webhook
|
|
1348
|
+
* Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
|
|
1349
|
+
*/
|
|
1350
|
+
interface WebhookMessage {
|
|
1351
|
+
/**
|
|
1352
|
+
* The WhatsApp Business Account ID
|
|
1353
|
+
*/
|
|
1354
|
+
wabaId: string;
|
|
1355
|
+
/**
|
|
1356
|
+
* The message ID
|
|
1357
|
+
*/
|
|
1358
|
+
id: string;
|
|
1359
|
+
/**
|
|
1360
|
+
* The sender's phone number
|
|
1361
|
+
*/
|
|
1362
|
+
from: string;
|
|
1363
|
+
/**
|
|
1364
|
+
* The timestamp of the message
|
|
1365
|
+
*/
|
|
1366
|
+
timestamp: string;
|
|
1367
|
+
/**
|
|
1368
|
+
* The type of message (text, image, etc.)
|
|
1369
|
+
*/
|
|
1370
|
+
type: MessageTypesEnum;
|
|
1371
|
+
/**
|
|
1372
|
+
* The phone number ID that received the message
|
|
1373
|
+
*/
|
|
1374
|
+
phoneNumberId: string;
|
|
1375
|
+
/**
|
|
1376
|
+
* The display phone number that received the message
|
|
1377
|
+
*/
|
|
1378
|
+
displayPhoneNumber: string;
|
|
1379
|
+
/**
|
|
1380
|
+
* The profile name of the sender
|
|
1381
|
+
*/
|
|
1382
|
+
profileName: string;
|
|
1383
|
+
text?: TextMessage['text'];
|
|
1384
|
+
image?: ImageMessage['image'];
|
|
1385
|
+
video?: VideoMessage['video'];
|
|
1386
|
+
audio?: AudioMessage['audio'];
|
|
1387
|
+
document?: DocumentMessage['document'];
|
|
1388
|
+
sticker?: StickerMessage['sticker'];
|
|
1389
|
+
location?: LocationMessage['location'];
|
|
1390
|
+
contacts?: ContactsMessage['contacts'];
|
|
1391
|
+
interactive?: InteractiveMessage['interactive'];
|
|
1392
|
+
button?: ButtonMessage['button'];
|
|
1393
|
+
order?: OrderMessage['order'];
|
|
1394
|
+
system?: SystemMessage['system'];
|
|
1395
|
+
reaction?: ReactionMessage['reaction'];
|
|
1396
|
+
statuses?: {
|
|
1397
|
+
/**
|
|
1398
|
+
* Arbitrary string included in sent message
|
|
1399
|
+
*/
|
|
1400
|
+
biz_opaque_callback_data?: string;
|
|
1401
|
+
/**
|
|
1402
|
+
* Information about the conversation
|
|
1403
|
+
*/
|
|
1404
|
+
conversation?: {
|
|
1405
|
+
/**
|
|
1406
|
+
* Represents the ID of the conversation the given status notification belongs to
|
|
1407
|
+
*/
|
|
1408
|
+
id: string;
|
|
1409
|
+
/**
|
|
1410
|
+
* Describes conversation category
|
|
1411
|
+
*/
|
|
1412
|
+
origin: {
|
|
1413
|
+
/**
|
|
1414
|
+
* Indicates conversation category. This can also be referred to as a conversation entry point
|
|
1415
|
+
* - authentication: Conversation opened by business sending template categorized as AUTHENTICATION
|
|
1416
|
+
* - marketing: Conversation opened by business sending template categorized as MARKETING
|
|
1417
|
+
* - utility: Conversation opened by business sending template categorized as UTILITY
|
|
1418
|
+
* - service: Conversation opened by business replying to customer within service window
|
|
1419
|
+
* - referral_conversion: Free entry point conversation
|
|
1420
|
+
*/
|
|
1421
|
+
type: 'authentication' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
|
|
1408
1422
|
};
|
|
1423
|
+
/**
|
|
1424
|
+
* Date when the conversation expires. Only present for messages with status 'sent'
|
|
1425
|
+
*/
|
|
1426
|
+
expiration_timestamp?: string;
|
|
1409
1427
|
};
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1428
|
+
/**
|
|
1429
|
+
* Array of error objects describing the error
|
|
1430
|
+
*/
|
|
1431
|
+
errors?: Array<{
|
|
1432
|
+
/**
|
|
1433
|
+
* Error code
|
|
1434
|
+
*/
|
|
1435
|
+
code: number;
|
|
1436
|
+
/**
|
|
1437
|
+
* Error code title
|
|
1438
|
+
*/
|
|
1439
|
+
title: string;
|
|
1440
|
+
/**
|
|
1441
|
+
* Error code message
|
|
1442
|
+
*/
|
|
1443
|
+
message: string;
|
|
1444
|
+
/**
|
|
1445
|
+
* Error details object
|
|
1446
|
+
*/
|
|
1447
|
+
error_data?: {
|
|
1448
|
+
/**
|
|
1449
|
+
* Describes the error details
|
|
1450
|
+
*/
|
|
1451
|
+
details: string;
|
|
1452
|
+
};
|
|
1453
|
+
}>;
|
|
1454
|
+
/**
|
|
1455
|
+
* The ID for the message that the business sent to a customer
|
|
1456
|
+
*/
|
|
1457
|
+
id: string;
|
|
1458
|
+
/**
|
|
1459
|
+
* Pricing information for the message/conversation
|
|
1460
|
+
*/
|
|
1461
|
+
pricing?: {
|
|
1462
|
+
/**
|
|
1463
|
+
* Indicates if the given message or conversation is billable
|
|
1464
|
+
* @deprecated This field is deprecated. Visit the WhatsApp Changelog for more information.
|
|
1465
|
+
*/
|
|
1466
|
+
billable?: boolean;
|
|
1467
|
+
/**
|
|
1468
|
+
* Indicates the conversation category:
|
|
1469
|
+
* - authentication: Authentication conversation
|
|
1470
|
+
* - authentication_international: Authentication-international conversation
|
|
1471
|
+
* - marketing: Marketing conversation
|
|
1472
|
+
* - utility: Utility conversation
|
|
1473
|
+
* - service: Service conversation
|
|
1474
|
+
* - referral_conversion: Free entry point conversation
|
|
1475
|
+
*/
|
|
1476
|
+
category: 'authentication' | 'authentication_international' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
|
|
1477
|
+
/**
|
|
1478
|
+
* Type of pricing model used by the business. Current supported value is CBP
|
|
1479
|
+
*/
|
|
1480
|
+
pricing_model: 'CBP';
|
|
1481
|
+
};
|
|
1482
|
+
/**
|
|
1483
|
+
* The customer's WhatsApp ID. Business can respond to customer using this ID.
|
|
1484
|
+
* This ID may not match the customer's phone number.
|
|
1485
|
+
*/
|
|
1486
|
+
recipient_id: string;
|
|
1487
|
+
/**
|
|
1488
|
+
* Status of the message:
|
|
1489
|
+
* - delivered: Message has been delivered
|
|
1490
|
+
* - read: Message has been read by the customer
|
|
1491
|
+
* - sent: Message has been sent to the customer
|
|
1492
|
+
*/
|
|
1493
|
+
status: 'delivered' | 'read' | 'sent';
|
|
1494
|
+
/**
|
|
1495
|
+
* Unix timestamp for the status message
|
|
1496
|
+
*/
|
|
1497
|
+
timestamp: string;
|
|
1498
|
+
};
|
|
1499
|
+
/**
|
|
1500
|
+
* The original message data as received from the webhook
|
|
1501
|
+
*/
|
|
1502
|
+
originalData: any;
|
|
1422
1503
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1504
|
+
/**
|
|
1505
|
+
* Webhook event received from WhatsApp
|
|
1506
|
+
*/
|
|
1507
|
+
interface WebhookEvent {
|
|
1508
|
+
/**
|
|
1509
|
+
* The field type of the event
|
|
1510
|
+
*/
|
|
1511
|
+
field: string;
|
|
1512
|
+
/**
|
|
1513
|
+
* The event data
|
|
1514
|
+
*/
|
|
1515
|
+
value: any;
|
|
1516
|
+
/**
|
|
1517
|
+
* The timestamp when the event was received
|
|
1518
|
+
*/
|
|
1519
|
+
timestamp: number;
|
|
1432
1520
|
}
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1521
|
+
/**
|
|
1522
|
+
* Message status enum
|
|
1523
|
+
*/
|
|
1524
|
+
declare enum MessageStatus {
|
|
1525
|
+
DELIVERED = "delivered",
|
|
1526
|
+
READ = "read",
|
|
1527
|
+
SENT = "sent",
|
|
1440
1528
|
}
|
|
1441
1529
|
//#endregion
|
|
1442
|
-
//#region src/
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
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;
|
|
1449
1537
|
}
|
|
1450
1538
|
//#endregion
|
|
1451
|
-
//#region src/api/
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
type ParametersObject<T extends ParametersTypesEnum> = {
|
|
1457
|
-
type: T;
|
|
1458
|
-
};
|
|
1459
|
-
type SimpleTextObject$1 = {
|
|
1460
|
-
text: string;
|
|
1461
|
-
};
|
|
1462
|
-
type TextParametersObject = ParametersObject<ParametersTypesEnum.Text> & SimpleTextObject$1;
|
|
1463
|
-
type CouponCodeParametersObject = ParametersObject<ParametersTypesEnum.CouponCode> & {
|
|
1464
|
-
coupon_code: string;
|
|
1465
|
-
};
|
|
1466
|
-
type CurrencyObject = {
|
|
1467
|
-
fallback_value: string;
|
|
1468
|
-
code: CurrencyCodesEnum;
|
|
1469
|
-
amount_1000: number;
|
|
1470
|
-
};
|
|
1471
|
-
type CurrencyParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
|
|
1472
|
-
currency: CurrencyObject;
|
|
1473
|
-
};
|
|
1474
|
-
type DateTimeObject = {
|
|
1475
|
-
fallback_value: string;
|
|
1476
|
-
};
|
|
1477
|
-
type DateTimeParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
|
|
1478
|
-
date_time: DateTimeObject;
|
|
1479
|
-
};
|
|
1480
|
-
type DocumentMediaObject$2 = {
|
|
1481
|
-
id?: string;
|
|
1482
|
-
link?: string;
|
|
1483
|
-
caption?: string;
|
|
1484
|
-
filename?: string;
|
|
1485
|
-
};
|
|
1486
|
-
type ImageMediaObject$2 = {
|
|
1487
|
-
id?: string;
|
|
1488
|
-
link?: string;
|
|
1489
|
-
caption?: string;
|
|
1490
|
-
};
|
|
1491
|
-
type VideoMediaObject$2 = {
|
|
1492
|
-
id?: string;
|
|
1493
|
-
link?: string;
|
|
1494
|
-
caption?: string;
|
|
1495
|
-
};
|
|
1496
|
-
type DocumentParametersObject = ParametersObject<ParametersTypesEnum.Document> & DocumentMediaObject$2;
|
|
1497
|
-
type ImageParametersObject = ParametersObject<ParametersTypesEnum.Image> & ImageMediaObject$2;
|
|
1498
|
-
type VideoParametersObject = ParametersObject<ParametersTypesEnum.Video> & VideoMediaObject$2;
|
|
1499
|
-
type ComponentObject<T extends ComponentTypesEnum> = {
|
|
1500
|
-
type: T;
|
|
1501
|
-
parameters: (CurrencyParametersObject | DateTimeParametersObject | DocumentParametersObject | ImageParametersObject | TextParametersObject | VideoParametersObject | CouponCodeParametersObject)[];
|
|
1502
|
-
};
|
|
1503
|
-
type ButtonComponentObject = ComponentObject<ComponentTypesEnum.Button> & {
|
|
1504
|
-
parameters?: (TextParametersObject | PayloadParametersObject)[];
|
|
1505
|
-
sub_type: SubTypeEnum;
|
|
1506
|
-
index: ButtonPositionEnum;
|
|
1507
|
-
};
|
|
1508
|
-
type PayloadParametersObject = ParametersObject<ParametersTypesEnum.Payload> & {
|
|
1509
|
-
payload: string;
|
|
1510
|
-
};
|
|
1511
|
-
type MessageTemplateObject<T extends ComponentTypesEnum> = {
|
|
1512
|
-
name: string;
|
|
1513
|
-
language: LanguageObject;
|
|
1514
|
-
components?: (ComponentObject<T> | ButtonComponentObject)[];
|
|
1515
|
-
};
|
|
1516
|
-
//#endregion
|
|
1517
|
-
//#region src/api/messages/types/media.d.ts
|
|
1518
|
-
type MetaMediaObject = {
|
|
1539
|
+
//#region src/api/profile/types/upload.d.ts
|
|
1540
|
+
/**
|
|
1541
|
+
* Upload session information for creating upload sessions.
|
|
1542
|
+
*/
|
|
1543
|
+
interface UploadSession {
|
|
1519
1544
|
id: string;
|
|
1520
|
-
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
}
|
|
1584
|
-
type URLObject = {
|
|
1585
|
-
url?: string;
|
|
1586
|
-
type?: 'HOME' | 'WORK' | string;
|
|
1587
|
-
};
|
|
1588
|
-
type ContactObject = {
|
|
1589
|
-
addresses?: AddressesObject[];
|
|
1590
|
-
birthday?: `${number}${number}${number}${number}-${number}${number}-${number}${number}`;
|
|
1591
|
-
emails?: EmailObject[];
|
|
1592
|
-
name: NameObject;
|
|
1593
|
-
org?: OrgObject;
|
|
1594
|
-
phones?: PhoneObject[];
|
|
1595
|
-
urls?: URLObject[];
|
|
1596
|
-
};
|
|
1545
|
+
video?: boolean;
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* Response from creating an upload session.
|
|
1549
|
+
*/
|
|
1550
|
+
interface UploadSessionResponse {
|
|
1551
|
+
id: string;
|
|
1552
|
+
}
|
|
1553
|
+
/**
|
|
1554
|
+
* Response from uploading business profile media.
|
|
1555
|
+
*/
|
|
1556
|
+
interface UploadBusinessProfileResponse {
|
|
1557
|
+
h: string;
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* Upload handle information containing file details and handle.
|
|
1561
|
+
*/
|
|
1562
|
+
interface UploadHandle {
|
|
1563
|
+
handle: string;
|
|
1564
|
+
file_size: number;
|
|
1565
|
+
upload_result: {
|
|
1566
|
+
handle_type: string;
|
|
1567
|
+
name: string;
|
|
1568
|
+
};
|
|
1569
|
+
}
|
|
1570
|
+
/**
|
|
1571
|
+
* Request parameters for creating upload session.
|
|
1572
|
+
*/
|
|
1573
|
+
interface CreateUploadSessionParams {
|
|
1574
|
+
/**
|
|
1575
|
+
* Length of the file to be uploaded in bytes.
|
|
1576
|
+
*/
|
|
1577
|
+
fileLength: number;
|
|
1578
|
+
/**
|
|
1579
|
+
* MIME type of the file (e.g., 'image/jpeg').
|
|
1580
|
+
*/
|
|
1581
|
+
fileType: string;
|
|
1582
|
+
/**
|
|
1583
|
+
* Name of the file with extension.
|
|
1584
|
+
*/
|
|
1585
|
+
fileName: string;
|
|
1586
|
+
}
|
|
1587
|
+
/**
|
|
1588
|
+
* Request parameters for uploading media.
|
|
1589
|
+
*/
|
|
1590
|
+
interface UploadMediaParams {
|
|
1591
|
+
/**
|
|
1592
|
+
* The upload session ID from createUploadSession response.
|
|
1593
|
+
*/
|
|
1594
|
+
uploadId: string;
|
|
1595
|
+
/**
|
|
1596
|
+
* The binary data of the file (Buffer).
|
|
1597
|
+
*/
|
|
1598
|
+
file: Buffer;
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Request parameters for getting upload handle.
|
|
1602
|
+
*/
|
|
1603
|
+
interface GetUploadHandleParams {
|
|
1604
|
+
/**
|
|
1605
|
+
* The upload session ID from createUploadSession response.
|
|
1606
|
+
*/
|
|
1607
|
+
uploadId: string;
|
|
1608
|
+
}
|
|
1597
1609
|
//#endregion
|
|
1598
|
-
//#region src/api/
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1610
|
+
//#region src/api/profile/types/common.d.ts
|
|
1611
|
+
/**
|
|
1612
|
+
* Available fields that can be requested when retrieving a business profile.
|
|
1613
|
+
*/
|
|
1614
|
+
type BusinessProfileField = 'about' | 'address' | 'description' | 'email' | 'profile_picture_url' | 'websites' | 'vertical';
|
|
1615
|
+
type BusinessProfileFieldsParam = BusinessProfileField[] | string;
|
|
1616
|
+
/**
|
|
1617
|
+
* Business profile data structure containing all profile information.
|
|
1618
|
+
*/
|
|
1619
|
+
interface BusinessProfileData {
|
|
1620
|
+
/**
|
|
1621
|
+
* The business's About text. This text appears in the business's profile, beneath its profile image,
|
|
1622
|
+
* phone number, and contact buttons.
|
|
1623
|
+
* - String cannot be empty
|
|
1624
|
+
* - Strings must be between 1 and 139 characters
|
|
1625
|
+
* - Rendered emojis are supported however their unicode values are not.
|
|
1626
|
+
* Emoji unicode values must be Java- or JavaScript-escape encoded
|
|
1627
|
+
* - Hyperlinks can be included but will not render as clickable links
|
|
1628
|
+
* - Markdown is not supported
|
|
1629
|
+
*/
|
|
1630
|
+
about?: string;
|
|
1631
|
+
/**
|
|
1632
|
+
* Address of the business. Character limit 256.
|
|
1633
|
+
*/
|
|
1603
1634
|
address?: string;
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
type DocumentMediaObject$1 = {
|
|
1608
|
-
id?: string;
|
|
1609
|
-
link?: string;
|
|
1610
|
-
caption?: string;
|
|
1611
|
-
filename?: string;
|
|
1612
|
-
};
|
|
1613
|
-
type ImageMediaObject$1 = {
|
|
1614
|
-
id?: string;
|
|
1615
|
-
link?: string;
|
|
1616
|
-
caption?: string;
|
|
1617
|
-
};
|
|
1618
|
-
type VideoMediaObject$1 = {
|
|
1619
|
-
id?: string;
|
|
1620
|
-
link?: string;
|
|
1621
|
-
caption?: string;
|
|
1622
|
-
};
|
|
1623
|
-
type ProductObject = {
|
|
1624
|
-
product_retailer_id: string;
|
|
1625
|
-
};
|
|
1626
|
-
type SimpleTextObject = {
|
|
1627
|
-
text: string;
|
|
1628
|
-
};
|
|
1629
|
-
type RowObject = {
|
|
1630
|
-
id: string;
|
|
1631
|
-
title: string;
|
|
1635
|
+
/**
|
|
1636
|
+
* Description of the business. Character limit 512.
|
|
1637
|
+
*/
|
|
1632
1638
|
description?: string;
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1639
|
+
/**
|
|
1640
|
+
* The contact email address (in valid email format) of the business. Character limit 128.
|
|
1641
|
+
*/
|
|
1642
|
+
email?: string;
|
|
1643
|
+
/**
|
|
1644
|
+
* The messaging service used for the request. Always set it to "whatsapp" if you are using
|
|
1645
|
+
* the WhatsApp Business API.
|
|
1646
|
+
*/
|
|
1647
|
+
messaging_product: string;
|
|
1648
|
+
/**
|
|
1649
|
+
* Profile picture URL.
|
|
1650
|
+
*/
|
|
1651
|
+
profile_picture_url?: string;
|
|
1652
|
+
/**
|
|
1653
|
+
* The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
|
|
1654
|
+
* - You must include the http:// or https:// portion of the URL
|
|
1655
|
+
* - There is a maximum of 2 websites with a maximum of 256 characters each
|
|
1656
|
+
*/
|
|
1657
|
+
websites?: string[];
|
|
1658
|
+
/**
|
|
1659
|
+
* Business category. This can be either an empty string or one of the predefined business categories.
|
|
1660
|
+
* @see BusinessVerticalEnum for all available options
|
|
1661
|
+
*/
|
|
1662
|
+
vertical?: BusinessVerticalEnum | string;
|
|
1663
|
+
}
|
|
1664
|
+
/**
|
|
1665
|
+
* Response structure for business profile GET requests.
|
|
1666
|
+
*/
|
|
1667
|
+
interface BusinessProfileResponse {
|
|
1668
|
+
data: BusinessProfileData[];
|
|
1669
|
+
}
|
|
1670
|
+
/**
|
|
1671
|
+
* Request structure for updating business profile.
|
|
1672
|
+
*/
|
|
1673
|
+
interface UpdateBusinessProfileRequest {
|
|
1674
|
+
/**
|
|
1675
|
+
* The messaging service used for the request. Always set it to "whatsapp" if you are using
|
|
1676
|
+
* the WhatsApp Business API.
|
|
1677
|
+
* @required
|
|
1678
|
+
*/
|
|
1679
|
+
messaging_product: string;
|
|
1680
|
+
/**
|
|
1681
|
+
* The business's About text. This text appears in the business's profile, beneath its profile image,
|
|
1682
|
+
* phone number, and contact buttons.
|
|
1683
|
+
* - String cannot be empty
|
|
1684
|
+
* - Strings must be between 1 and 139 characters
|
|
1685
|
+
* - Rendered emojis are supported however their unicode values are not.
|
|
1686
|
+
* Emoji unicode values must be Java- or JavaScript-escape encoded
|
|
1687
|
+
* - Hyperlinks can be included but will not render as clickable links
|
|
1688
|
+
* - Markdown is not supported
|
|
1689
|
+
*/
|
|
1690
|
+
about?: string;
|
|
1691
|
+
/**
|
|
1692
|
+
* Address of the business. Character limit 256.
|
|
1693
|
+
*/
|
|
1694
|
+
address?: string;
|
|
1695
|
+
/**
|
|
1696
|
+
* Description of the business. Character limit 512.
|
|
1697
|
+
*/
|
|
1698
|
+
description?: string;
|
|
1699
|
+
/**
|
|
1700
|
+
* Business category. This can be either an empty string or one of the predefined business categories.
|
|
1701
|
+
* @see BusinessVerticalEnum for all available options
|
|
1702
|
+
*/
|
|
1703
|
+
vertical?: BusinessVerticalEnum | string;
|
|
1704
|
+
/**
|
|
1705
|
+
* The contact email address (in valid email format) of the business. Character limit 128.
|
|
1706
|
+
*/
|
|
1707
|
+
email?: string;
|
|
1708
|
+
/**
|
|
1709
|
+
* The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
|
|
1710
|
+
* - You must include the http:// or https:// portion of the URL
|
|
1711
|
+
* - There is a maximum of 2 websites with a maximum of 256 characters each
|
|
1712
|
+
*/
|
|
1713
|
+
websites?: string[];
|
|
1714
|
+
/**
|
|
1715
|
+
* Handle of the profile picture. This handle is generated when you upload the binary file
|
|
1716
|
+
* for the profile picture to Meta using the Resumable Upload API.
|
|
1717
|
+
*/
|
|
1718
|
+
profile_picture_handle?: string;
|
|
1719
|
+
}
|
|
1720
|
+
declare class BusinessProfileClass extends BaseClass {
|
|
1721
|
+
/**
|
|
1722
|
+
* Get your business profile.
|
|
1723
|
+
* @param fields Specific fields to be returned in the response. If not specified, all fields will be returned.
|
|
1724
|
+
*/
|
|
1725
|
+
getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
|
|
1726
|
+
/**
|
|
1727
|
+
* Update your business profile.
|
|
1728
|
+
* @param updateRequest The request object containing the fields to update.
|
|
1729
|
+
*/
|
|
1730
|
+
updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
|
|
1731
|
+
/**
|
|
1732
|
+
* Create an upload session for profile picture.
|
|
1733
|
+
* @param fileLength Length of the file to be uploaded in bytes.
|
|
1734
|
+
* @param fileType MIME type of the file (e.g., 'image/jpeg').
|
|
1735
|
+
* @param fileName Name of the file.
|
|
1736
|
+
*/
|
|
1737
|
+
createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
|
|
1738
|
+
/**
|
|
1739
|
+
* Upload media file to the upload session.
|
|
1740
|
+
* @param uploadId The ID of the upload session.
|
|
1741
|
+
* @param file The binary data of the file.
|
|
1742
|
+
*/
|
|
1743
|
+
uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
|
|
1744
|
+
/**
|
|
1745
|
+
* Get the upload handle information.
|
|
1746
|
+
* @param uploadId The ID of the upload session.
|
|
1747
|
+
*/
|
|
1748
|
+
getUploadHandle(uploadId: string): Promise<UploadHandle>;
|
|
1749
|
+
}
|
|
1750
|
+
//#endregion
|
|
1751
|
+
//#region src/api/phone/types/common.d.ts
|
|
1752
|
+
type QualityRating = 'GREEN' | 'YELLOW' | 'RED' | 'NA';
|
|
1753
|
+
type AccountMode = 'LIVE' | 'SANDBOX';
|
|
1754
|
+
type CodeVerificationStatus = 'NOT_VERIFIED' | 'VERIFIED' | 'EXPIRED' | 'PENDING' | 'DELETED' | 'MIGRATED' | 'BANNED' | 'RESTRICTED' | 'RATE_LIMITED' | 'FLAGGED' | 'CONNECTED' | 'DISCONNECTED' | 'UNKNOWN' | 'UNVERIFIED';
|
|
1755
|
+
type MessagingLimitTier = 'TIER_50' | 'TIER_250' | 'TIER_1K' | 'TIER_10K' | 'TIER_100K' | 'TIER_UNLIMITED';
|
|
1756
|
+
type PlatformType = 'CLOUD_API' | 'ON_PREMISE' | 'NOT_APPLICABLE';
|
|
1757
|
+
type ThroughputLevel = 'STANDARD' | 'HIGH' | 'NOT_APPLICABLE';
|
|
1758
|
+
type HealthStatusEntity = {
|
|
1759
|
+
entity_type: string;
|
|
1647
1760
|
id: string;
|
|
1761
|
+
can_send_message: string;
|
|
1762
|
+
additional_info?: string[];
|
|
1763
|
+
errors?: Array<{
|
|
1764
|
+
error_code: number;
|
|
1765
|
+
error_description: string;
|
|
1766
|
+
possible_solution: string;
|
|
1767
|
+
}>;
|
|
1648
1768
|
};
|
|
1649
|
-
type
|
|
1650
|
-
|
|
1651
|
-
|
|
1769
|
+
type HealthStatus = {
|
|
1770
|
+
can_send_message: string;
|
|
1771
|
+
entities: HealthStatusEntity[];
|
|
1652
1772
|
};
|
|
1653
|
-
type
|
|
1654
|
-
|
|
1655
|
-
catalog_id?: string;
|
|
1656
|
-
product_retailer_id?: string;
|
|
1657
|
-
sections?: SectionObject[];
|
|
1773
|
+
type QualityScore = {
|
|
1774
|
+
score: QualityRating;
|
|
1658
1775
|
};
|
|
1659
|
-
type
|
|
1660
|
-
|
|
1661
|
-
document?: DocumentMediaObject$1;
|
|
1662
|
-
image?: ImageMediaObject$1;
|
|
1663
|
-
text?: string;
|
|
1664
|
-
video?: VideoMediaObject$1;
|
|
1776
|
+
type Throughput = {
|
|
1777
|
+
level: ThroughputLevel;
|
|
1665
1778
|
};
|
|
1666
|
-
type
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1779
|
+
type PhoneNumberResponse = {
|
|
1780
|
+
display_phone_number: string;
|
|
1781
|
+
id: string;
|
|
1782
|
+
quality_rating: QualityRating;
|
|
1783
|
+
verified_name: string;
|
|
1784
|
+
account_mode?: AccountMode;
|
|
1785
|
+
certificate?: string;
|
|
1786
|
+
code_verification_status?: CodeVerificationStatus;
|
|
1787
|
+
conversational_automation?: Record<string, unknown>;
|
|
1788
|
+
eligibility_for_api_business_global_search?: string;
|
|
1789
|
+
health_status?: HealthStatus;
|
|
1790
|
+
is_official_business_account?: boolean;
|
|
1791
|
+
is_on_biz_app?: boolean;
|
|
1792
|
+
is_pin_enabled?: boolean;
|
|
1793
|
+
is_preverified_number?: boolean;
|
|
1794
|
+
last_onboarded_time?: string;
|
|
1795
|
+
messaging_limit_tier?: MessagingLimitTier;
|
|
1796
|
+
name_status?: string;
|
|
1797
|
+
new_certificate?: string;
|
|
1798
|
+
new_name_status?: string;
|
|
1799
|
+
platform_type?: PlatformType;
|
|
1800
|
+
quality_score?: QualityScore;
|
|
1801
|
+
search_visibility?: string;
|
|
1802
|
+
status?: CodeVerificationStatus;
|
|
1803
|
+
throughput?: Throughput;
|
|
1672
1804
|
};
|
|
1673
|
-
type
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
footer?: SimpleTextObject;
|
|
1677
|
-
header?: HeaderObject;
|
|
1678
|
-
action: ActionObject;
|
|
1805
|
+
type Cursors = {
|
|
1806
|
+
before: string;
|
|
1807
|
+
after: string;
|
|
1679
1808
|
};
|
|
1680
|
-
type
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
footer?: SimpleTextObject;
|
|
1684
|
-
header?: HeaderObject;
|
|
1685
|
-
action: ActionObject;
|
|
1809
|
+
type PhoneNumbersResponse = {
|
|
1810
|
+
data: PhoneNumberResponse[];
|
|
1811
|
+
paging: Paging;
|
|
1686
1812
|
};
|
|
1687
|
-
type
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
footer?: SimpleTextObject;
|
|
1691
|
-
header: HeaderObject;
|
|
1692
|
-
action: ActionObject;
|
|
1813
|
+
type RequestVerificationCodeRequest = {
|
|
1814
|
+
code_method: 'SMS' | 'VOICE';
|
|
1815
|
+
language: string;
|
|
1693
1816
|
};
|
|
1694
|
-
type
|
|
1695
|
-
|
|
1696
|
-
url: string;
|
|
1817
|
+
type VerifyCodeRequest = {
|
|
1818
|
+
code: string;
|
|
1697
1819
|
};
|
|
1698
|
-
type
|
|
1699
|
-
|
|
1700
|
-
parameters: CtaUrlParameters;
|
|
1820
|
+
type TwoStepVerificationParams = {
|
|
1821
|
+
pin: string;
|
|
1701
1822
|
};
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1823
|
+
interface PhoneNumberClass {
|
|
1824
|
+
getPhoneNumberById(fields?: string): Promise<PhoneNumberResponse>;
|
|
1825
|
+
getPhoneNumbers(): Promise<PhoneNumbersResponse>;
|
|
1826
|
+
requestVerificationCode(params: RequestVerificationCodeRequest): Promise<ResponseSuccess>;
|
|
1827
|
+
verifyCode(params: VerifyCodeRequest): Promise<ResponseSuccess>;
|
|
1828
|
+
}
|
|
1829
|
+
//#endregion
|
|
1830
|
+
//#region src/api/template/types/common.d.ts
|
|
1831
|
+
type TemplateFormat = 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT' | 'LOCATION' | 'PRODUCT';
|
|
1832
|
+
type PhoneNumberButton = {
|
|
1833
|
+
type: 'PHONE_NUMBER';
|
|
1834
|
+
text: string;
|
|
1835
|
+
phone_number: string;
|
|
1708
1836
|
};
|
|
1709
|
-
type
|
|
1710
|
-
|
|
1837
|
+
type URLButton = {
|
|
1838
|
+
type: 'URL';
|
|
1839
|
+
text: string;
|
|
1840
|
+
url: string;
|
|
1841
|
+
example?: string[];
|
|
1711
1842
|
};
|
|
1712
|
-
type
|
|
1713
|
-
type:
|
|
1714
|
-
|
|
1715
|
-
footer?: SimpleTextObject;
|
|
1716
|
-
header?: HeaderObject;
|
|
1717
|
-
action: LocationRequestActionObject;
|
|
1843
|
+
type QuickReplyButton = {
|
|
1844
|
+
type: 'QUICK_REPLY';
|
|
1845
|
+
text: string;
|
|
1718
1846
|
};
|
|
1719
|
-
type
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
in_pin_code?: string;
|
|
1723
|
-
house_number?: string;
|
|
1724
|
-
floor_number?: string;
|
|
1725
|
-
tower_number?: string;
|
|
1726
|
-
building_name?: string;
|
|
1727
|
-
address?: string;
|
|
1728
|
-
landmark_area?: string;
|
|
1729
|
-
city?: string;
|
|
1730
|
-
state?: string;
|
|
1847
|
+
type CopyCodeButton = {
|
|
1848
|
+
type: 'COPY_CODE';
|
|
1849
|
+
example: string;
|
|
1731
1850
|
};
|
|
1732
|
-
type
|
|
1733
|
-
|
|
1734
|
-
|
|
1851
|
+
type FlowButton = {
|
|
1852
|
+
type: 'FLOW';
|
|
1853
|
+
text: string;
|
|
1854
|
+
flow_id?: string;
|
|
1855
|
+
flow_name?: string;
|
|
1856
|
+
flow_json?: string;
|
|
1857
|
+
flow_action?: 'navigate' | 'data_exchange';
|
|
1858
|
+
navigate_screen?: string;
|
|
1735
1859
|
};
|
|
1736
|
-
type
|
|
1737
|
-
type
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1860
|
+
type MPMButton = {
|
|
1861
|
+
type: 'MPM';
|
|
1862
|
+
action?: {
|
|
1863
|
+
thumbnail_product_retailer_id: string;
|
|
1864
|
+
sections: Array<{
|
|
1865
|
+
title?: string;
|
|
1866
|
+
product_items: Array<{
|
|
1867
|
+
product_retailer_id: string;
|
|
1868
|
+
}>;
|
|
1869
|
+
}>;
|
|
1870
|
+
};
|
|
1742
1871
|
};
|
|
1743
|
-
type
|
|
1744
|
-
|
|
1745
|
-
parameters: AddressMessageParameters;
|
|
1872
|
+
type OTPButton = {
|
|
1873
|
+
type: 'OTP';
|
|
1746
1874
|
};
|
|
1747
|
-
type
|
|
1748
|
-
type:
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
action: AddressMessageActionObject;
|
|
1875
|
+
type SPMButton = {
|
|
1876
|
+
type: 'SPM';
|
|
1877
|
+
action?: {
|
|
1878
|
+
product_retailer_id: string;
|
|
1879
|
+
};
|
|
1753
1880
|
};
|
|
1754
|
-
type
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
flow_cta: string;
|
|
1759
|
-
mode?: 'draft' | 'published';
|
|
1760
|
-
flow_token: string;
|
|
1761
|
-
flow_action: 'navigate' | 'data_exchange';
|
|
1762
|
-
flow_action_payload?: {
|
|
1763
|
-
screen?: string;
|
|
1764
|
-
data?: Record<string, string>;
|
|
1881
|
+
type CatalogButton = {
|
|
1882
|
+
type: 'CATALOG';
|
|
1883
|
+
action?: {
|
|
1884
|
+
thumbnail_product_retailer_id: string;
|
|
1765
1885
|
};
|
|
1766
1886
|
};
|
|
1767
|
-
type
|
|
1768
|
-
|
|
1769
|
-
|
|
1887
|
+
type TemplateButton = PhoneNumberButton | URLButton | QuickReplyButton | CopyCodeButton | FlowButton | MPMButton | OTPButton | SPMButton | CatalogButton;
|
|
1888
|
+
type TemplateHeaderExample = {
|
|
1889
|
+
header_text?: string[];
|
|
1890
|
+
header_text_named_params?: Array<{
|
|
1891
|
+
param_name: string;
|
|
1892
|
+
example: string;
|
|
1893
|
+
}>;
|
|
1894
|
+
header_handle?: string[];
|
|
1770
1895
|
};
|
|
1771
|
-
type
|
|
1772
|
-
type:
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
action: FlowActionObject;
|
|
1896
|
+
type TemplateHeader = {
|
|
1897
|
+
type: 'HEADER';
|
|
1898
|
+
format: TemplateFormat;
|
|
1899
|
+
text?: string;
|
|
1900
|
+
example?: TemplateHeaderExample;
|
|
1777
1901
|
};
|
|
1778
|
-
type
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
type GeneralMessageBody = GeneralRequestBody & {
|
|
1789
|
-
/**
|
|
1790
|
-
* The Meta messaging product name.
|
|
1791
|
-
* @default 'whatsapp'
|
|
1792
|
-
*/
|
|
1793
|
-
messaging_product: 'whatsapp';
|
|
1902
|
+
type TemplateBody = {
|
|
1903
|
+
type: 'BODY';
|
|
1904
|
+
text: string;
|
|
1905
|
+
example?: {
|
|
1906
|
+
body_text?: Array<Array<string>>;
|
|
1907
|
+
body_text_named_params?: Array<{
|
|
1908
|
+
param_name: string;
|
|
1909
|
+
example: string;
|
|
1910
|
+
}>;
|
|
1911
|
+
};
|
|
1794
1912
|
};
|
|
1795
|
-
type
|
|
1796
|
-
|
|
1913
|
+
type TemplateFooter = {
|
|
1914
|
+
type: 'FOOTER';
|
|
1915
|
+
text: string;
|
|
1797
1916
|
};
|
|
1798
|
-
type
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
context?: ConTextObject;
|
|
1802
|
-
type?: T;
|
|
1917
|
+
type TemplateButtons = {
|
|
1918
|
+
type: 'BUTTONS';
|
|
1919
|
+
buttons: TemplateButton[];
|
|
1803
1920
|
};
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
}
|
|
1809
|
-
interface StatusParams {
|
|
1810
|
-
status: string;
|
|
1811
|
-
messageId: string;
|
|
1812
|
-
typingIndicator?: {
|
|
1813
|
-
type: string;
|
|
1921
|
+
type TemplateLimitedTimeOffer = {
|
|
1922
|
+
type: 'LIMITED_TIME_OFFER';
|
|
1923
|
+
limited_time_offer: {
|
|
1924
|
+
expiration_time_ms: number;
|
|
1814
1925
|
};
|
|
1815
|
-
}
|
|
1816
|
-
type MessagesResponse = GeneralMessageBody & {
|
|
1817
|
-
contacts: [{
|
|
1818
|
-
input: string;
|
|
1819
|
-
wa_id: string;
|
|
1820
|
-
}];
|
|
1821
|
-
messages: [{
|
|
1822
|
-
id: string;
|
|
1823
|
-
}];
|
|
1824
1926
|
};
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
|
|
1832
|
-
sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
|
|
1833
|
-
contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
|
|
1834
|
-
location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
|
|
1835
|
-
interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
|
|
1836
|
-
interactiveList(params: MessageRequestParams<InteractiveObject & {
|
|
1837
|
-
type: InteractiveTypesEnum.List;
|
|
1838
|
-
}>): Promise<MessagesResponse>;
|
|
1839
|
-
interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
|
|
1840
|
-
type: InteractiveTypesEnum.CtaUrl;
|
|
1841
|
-
}>): Promise<MessagesResponse>;
|
|
1842
|
-
interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
|
|
1843
|
-
type: InteractiveTypesEnum.LocationRequest;
|
|
1844
|
-
}>): Promise<MessagesResponse>;
|
|
1845
|
-
interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
|
|
1846
|
-
type: InteractiveTypesEnum.AddressMessage;
|
|
1847
|
-
}>): Promise<MessagesResponse>;
|
|
1848
|
-
interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
|
|
1849
|
-
type: InteractiveTypesEnum.Button;
|
|
1850
|
-
}>): Promise<MessagesResponse>;
|
|
1851
|
-
interactiveFlow(params: MessageRequestParams<InteractiveObject & {
|
|
1852
|
-
type: InteractiveTypesEnum.Flow;
|
|
1853
|
-
}>): Promise<MessagesResponse>;
|
|
1854
|
-
reaction(params: ReactionParams): Promise<MessagesResponse>;
|
|
1855
|
-
markAsRead(params: {
|
|
1856
|
-
messageId: string;
|
|
1857
|
-
}): Promise<MessagesResponse>;
|
|
1858
|
-
showTypingIndicator(params: {
|
|
1859
|
-
messageId: string;
|
|
1860
|
-
}): Promise<MessagesResponse>;
|
|
1861
|
-
status(params: StatusParams): Promise<MessagesResponse>;
|
|
1862
|
-
}
|
|
1863
|
-
//#endregion
|
|
1864
|
-
//#region src/api/media/types/common.d.ts
|
|
1865
|
-
type MediaResponse = {
|
|
1866
|
-
id: string;
|
|
1867
|
-
url: string;
|
|
1868
|
-
mime_type: string;
|
|
1869
|
-
sha256: string;
|
|
1870
|
-
file_size: number;
|
|
1871
|
-
messaging_product: 'whatsapp';
|
|
1927
|
+
type TemplateCarousel = {
|
|
1928
|
+
type: 'CAROUSEL';
|
|
1929
|
+
cards: Array<{
|
|
1930
|
+
card_index: number;
|
|
1931
|
+
components: ComponentTypes[];
|
|
1932
|
+
}>;
|
|
1872
1933
|
};
|
|
1873
|
-
type
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
cursors: {
|
|
1877
|
-
before: string;
|
|
1878
|
-
after: string;
|
|
1879
|
-
};
|
|
1880
|
-
};
|
|
1934
|
+
type MediaCarouselCard = {
|
|
1935
|
+
card_index: number;
|
|
1936
|
+
components: (TemplateHeader | TemplateBody | TemplateButtons)[];
|
|
1881
1937
|
};
|
|
1882
|
-
type
|
|
1938
|
+
type ProductCarouselCard = {
|
|
1939
|
+
card_index: number;
|
|
1940
|
+
components: TemplateHeader[];
|
|
1941
|
+
};
|
|
1942
|
+
type ComponentTypes = TemplateHeader | TemplateBody | TemplateFooter | TemplateButtons | TemplateLimitedTimeOffer | TemplateCarousel;
|
|
1943
|
+
type TemplateRequestBody = GeneralRequestBody & {
|
|
1944
|
+
name: string;
|
|
1945
|
+
language: LanguagesEnum;
|
|
1946
|
+
category?: CategoryEnum;
|
|
1947
|
+
components?: ComponentTypes[];
|
|
1948
|
+
};
|
|
1949
|
+
type TemplateResponse = {
|
|
1883
1950
|
id: string;
|
|
1951
|
+
status: string;
|
|
1952
|
+
language: LanguagesEnum;
|
|
1953
|
+
category: CategoryEnum;
|
|
1954
|
+
name: string;
|
|
1955
|
+
components: ComponentTypes[];
|
|
1884
1956
|
};
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
declare
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
}
|
|
1903
|
-
/**
|
|
1904
|
-
* Enum for Flow Categories
|
|
1905
|
-
*/
|
|
1906
|
-
declare enum FlowCategoryEnum {
|
|
1907
|
-
SignUp = "SIGN_UP",
|
|
1908
|
-
SignIn = "SIGN_IN",
|
|
1909
|
-
AppointmentBooking = "APPOINTMENT_BOOKING",
|
|
1910
|
-
LeadGeneration = "LEAD_GENERATION",
|
|
1911
|
-
ContactUs = "CONTACT_US",
|
|
1912
|
-
CustomerSupport = "CUSTOMER_SUPPORT",
|
|
1913
|
-
Survey = "SURVEY",
|
|
1914
|
-
Other = "OTHER",
|
|
1957
|
+
type TemplateGetParams = {
|
|
1958
|
+
limit?: number;
|
|
1959
|
+
name?: string;
|
|
1960
|
+
language?: LanguagesEnum;
|
|
1961
|
+
category?: CategoryEnum;
|
|
1962
|
+
status?: TemplateStatusEnum;
|
|
1963
|
+
};
|
|
1964
|
+
type TemplateDeleteParams = {
|
|
1965
|
+
hsm_id: string;
|
|
1966
|
+
name: string;
|
|
1967
|
+
};
|
|
1968
|
+
declare class TemplateClass {
|
|
1969
|
+
getTemplate(templateId: string): Promise<TemplateResponse>;
|
|
1970
|
+
updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>;
|
|
1971
|
+
getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>;
|
|
1972
|
+
createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>;
|
|
1973
|
+
deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
|
|
1915
1974
|
}
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1975
|
+
//#endregion
|
|
1976
|
+
//#region src/api/template/types/factory.d.ts
|
|
1977
|
+
interface TextParameter {
|
|
1978
|
+
type: 'text';
|
|
1979
|
+
value: string;
|
|
1920
1980
|
}
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
/** Health check/ping requests */
|
|
1927
|
-
Ping = "ping",
|
|
1928
|
-
/** Data exchange requests */
|
|
1929
|
-
Change = "data_exchange",
|
|
1930
|
-
/** Error notification requests */
|
|
1931
|
-
Error = "error",
|
|
1932
|
-
/** Match all flow action types */
|
|
1933
|
-
All = "*",
|
|
1981
|
+
interface CurrencyParameter {
|
|
1982
|
+
type: 'currency';
|
|
1983
|
+
amount_1000: number;
|
|
1984
|
+
code: CurrencyCodesEnum;
|
|
1985
|
+
fallback_value: string;
|
|
1934
1986
|
}
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
*/
|
|
1939
|
-
interface FlowValidationErrorPointer {
|
|
1940
|
-
line_start: number;
|
|
1941
|
-
line_end: number;
|
|
1942
|
-
column_start: number;
|
|
1943
|
-
column_end: number;
|
|
1944
|
-
path: string;
|
|
1987
|
+
interface DateTimeParameter {
|
|
1988
|
+
type: 'date_time';
|
|
1989
|
+
fallback_value: string;
|
|
1945
1990
|
}
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
error: string;
|
|
1951
|
-
error_type: string;
|
|
1952
|
-
message: string;
|
|
1953
|
-
line_start: number;
|
|
1954
|
-
line_end: number;
|
|
1955
|
-
column_start: number;
|
|
1956
|
-
column_end: number;
|
|
1957
|
-
pointers: FlowValidationErrorPointer[];
|
|
1991
|
+
interface MediaParameter {
|
|
1992
|
+
type: 'image' | 'video' | 'document';
|
|
1993
|
+
handle?: string;
|
|
1994
|
+
link?: string;
|
|
1958
1995
|
}
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
status: FlowStatusEnum;
|
|
1966
|
-
categories: FlowCategoryEnum[];
|
|
1967
|
-
validation_errors: FlowValidationError[];
|
|
1996
|
+
interface LocationParameter {
|
|
1997
|
+
type: 'location';
|
|
1998
|
+
latitude?: number;
|
|
1999
|
+
longitude?: number;
|
|
2000
|
+
name?: string;
|
|
2001
|
+
address?: string;
|
|
1968
2002
|
}
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
interface PaginationCursors {
|
|
1973
|
-
before: string;
|
|
1974
|
-
after: string;
|
|
2003
|
+
interface ProductParameter {
|
|
2004
|
+
type: 'product';
|
|
2005
|
+
product_retailer_id: string;
|
|
1975
2006
|
}
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
2007
|
+
type TemplateParameter = TextParameter | CurrencyParameter | DateTimeParameter | MediaParameter | LocationParameter | ProductParameter;
|
|
2008
|
+
interface HeaderOptions {
|
|
2009
|
+
format: TemplateFormat;
|
|
2010
|
+
text?: string;
|
|
2011
|
+
parameters?: TemplateParameter[];
|
|
2012
|
+
example?: {
|
|
2013
|
+
header_text?: string[];
|
|
2014
|
+
header_text_named_params?: Array<{
|
|
2015
|
+
param_name: string;
|
|
2016
|
+
example: string;
|
|
2017
|
+
}>;
|
|
2018
|
+
header_handle?: string[];
|
|
2019
|
+
};
|
|
1981
2020
|
}
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
2021
|
+
interface BodyOptions {
|
|
2022
|
+
text: string;
|
|
2023
|
+
parameters?: TemplateParameter[];
|
|
2024
|
+
example?: {
|
|
2025
|
+
body_text?: string[][];
|
|
2026
|
+
body_text_named_params?: Array<{
|
|
2027
|
+
param_name: string;
|
|
2028
|
+
example: string;
|
|
2029
|
+
}>;
|
|
2030
|
+
};
|
|
1988
2031
|
}
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
*/
|
|
1992
|
-
interface FlowAsset {
|
|
1993
|
-
name: string;
|
|
1994
|
-
asset_type: string;
|
|
1995
|
-
download_url: string;
|
|
2032
|
+
interface FooterOptions {
|
|
2033
|
+
text: string;
|
|
1996
2034
|
}
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2035
|
+
interface ButtonOptions {
|
|
2036
|
+
phone_number?: {
|
|
2037
|
+
text: string;
|
|
2038
|
+
phone_number: string;
|
|
2039
|
+
};
|
|
2040
|
+
url?: {
|
|
2041
|
+
text: string;
|
|
2042
|
+
url: string;
|
|
2043
|
+
example?: string;
|
|
2044
|
+
};
|
|
2045
|
+
quick_reply?: {
|
|
2046
|
+
text: string;
|
|
2047
|
+
}[];
|
|
2048
|
+
copy_code?: {
|
|
2049
|
+
example: string;
|
|
2050
|
+
};
|
|
2051
|
+
flow?: {
|
|
2052
|
+
text: string;
|
|
2053
|
+
flow_id?: string;
|
|
2054
|
+
flow_name?: string;
|
|
2055
|
+
flow_json?: string;
|
|
2056
|
+
flow_action?: 'navigate' | 'data_exchange';
|
|
2057
|
+
navigate_screen?: string;
|
|
2058
|
+
};
|
|
2059
|
+
mpm?: boolean;
|
|
2060
|
+
otp?: boolean;
|
|
2061
|
+
spm?: boolean;
|
|
2003
2062
|
}
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2063
|
+
interface CarouselCard {
|
|
2064
|
+
image?: string;
|
|
2065
|
+
video?: string;
|
|
2066
|
+
product?: string;
|
|
2067
|
+
body?: string;
|
|
2068
|
+
bodyParameters?: TemplateParameter[];
|
|
2069
|
+
buttons?: ButtonOptions;
|
|
2010
2070
|
}
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
*/
|
|
2014
|
-
interface FlowPreviewResponse {
|
|
2015
|
-
preview: FlowPreview;
|
|
2016
|
-
id: string;
|
|
2071
|
+
interface CarouselOptions {
|
|
2072
|
+
cards: CarouselCard[];
|
|
2017
2073
|
}
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
*/
|
|
2021
|
-
interface FlowMigrationResult {
|
|
2022
|
-
source_name: string;
|
|
2023
|
-
source_id: string;
|
|
2024
|
-
migrated_id: string;
|
|
2074
|
+
interface LimitedTimeOfferOptions {
|
|
2075
|
+
expiration_time_ms: number;
|
|
2025
2076
|
}
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
error_code: string;
|
|
2032
|
-
error_message: string;
|
|
2077
|
+
interface ProductSection {
|
|
2078
|
+
title?: string;
|
|
2079
|
+
product_items: Array<{
|
|
2080
|
+
product_retailer_id: string;
|
|
2081
|
+
}>;
|
|
2033
2082
|
}
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2083
|
+
interface TemplateOptions {
|
|
2084
|
+
name: string;
|
|
2085
|
+
language: LanguagesEnum;
|
|
2086
|
+
category: CategoryEnum;
|
|
2087
|
+
header?: HeaderOptions;
|
|
2088
|
+
body?: BodyOptions;
|
|
2089
|
+
footer?: FooterOptions;
|
|
2090
|
+
buttons?: ButtonOptions;
|
|
2091
|
+
carousel?: CarouselOptions;
|
|
2092
|
+
limitedTimeOffer?: LimitedTimeOfferOptions;
|
|
2041
2093
|
}
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
validation_errors?: FlowValidationError[];
|
|
2094
|
+
interface OTPTemplateOptions {
|
|
2095
|
+
name: string;
|
|
2096
|
+
language: LanguagesEnum;
|
|
2097
|
+
code_expiration_minutes?: number;
|
|
2098
|
+
add_security_recommendation?: boolean;
|
|
2048
2099
|
}
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2100
|
+
interface AuthenticationTemplateOptions {
|
|
2101
|
+
name: string;
|
|
2102
|
+
language: LanguagesEnum;
|
|
2103
|
+
code_expiration_minutes?: number;
|
|
2104
|
+
add_security_recommendation?: boolean;
|
|
2105
|
+
copy_code_button?: boolean;
|
|
2055
2106
|
}
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2107
|
+
interface CatalogTemplateOptions {
|
|
2108
|
+
name: string;
|
|
2109
|
+
language: LanguagesEnum;
|
|
2110
|
+
header?: Omit<HeaderOptions, 'format'>;
|
|
2111
|
+
body: BodyOptions;
|
|
2112
|
+
footer?: FooterOptions;
|
|
2113
|
+
thumbnail_product_retailer_id: string;
|
|
2063
2114
|
}
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
* The expected response structure for health check requests
|
|
2072
|
-
*/
|
|
2073
|
-
interface FlowHealthCheckResponse {
|
|
2074
|
-
data: {
|
|
2075
|
-
status: 'active';
|
|
2076
|
-
};
|
|
2115
|
+
interface CouponTemplateOptions {
|
|
2116
|
+
name: string;
|
|
2117
|
+
language: LanguagesEnum;
|
|
2118
|
+
header?: Omit<HeaderOptions, 'format'>;
|
|
2119
|
+
body: BodyOptions;
|
|
2120
|
+
footer?: FooterOptions;
|
|
2121
|
+
coupon_code: string;
|
|
2077
2122
|
}
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
* The expected response structure for data exchange requests
|
|
2086
|
-
*/
|
|
2087
|
-
interface FlowDataExchangeResponse {
|
|
2088
|
-
screen?: string;
|
|
2089
|
-
data?: Record<string, any | {
|
|
2090
|
-
error_message?: string;
|
|
2091
|
-
}>;
|
|
2123
|
+
interface LimitedTimeOfferTemplateOptions {
|
|
2124
|
+
name: string;
|
|
2125
|
+
language: LanguagesEnum;
|
|
2126
|
+
header?: Omit<HeaderOptions, 'format'>;
|
|
2127
|
+
body: BodyOptions;
|
|
2128
|
+
footer?: FooterOptions;
|
|
2129
|
+
expiration_time_ms: number;
|
|
2092
2130
|
}
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
params?: {
|
|
2102
|
-
flow_token: string;
|
|
2103
|
-
[key: string]: string;
|
|
2131
|
+
interface MediaCardCarouselTemplateOptions {
|
|
2132
|
+
name: string;
|
|
2133
|
+
language: LanguagesEnum;
|
|
2134
|
+
cards: Array<{
|
|
2135
|
+
header: {
|
|
2136
|
+
format: 'IMAGE' | 'VIDEO';
|
|
2137
|
+
example: {
|
|
2138
|
+
header_handle: string[];
|
|
2104
2139
|
};
|
|
2105
2140
|
};
|
|
2106
|
-
|
|
2141
|
+
body: BodyOptions;
|
|
2142
|
+
buttons?: ButtonOptions;
|
|
2143
|
+
}>;
|
|
2107
2144
|
}
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
*/
|
|
2117
|
-
interface FlowErrorNotificationResponse {
|
|
2118
|
-
acknowledged: boolean;
|
|
2145
|
+
interface MPMTemplateOptions {
|
|
2146
|
+
name: string;
|
|
2147
|
+
language: LanguagesEnum;
|
|
2148
|
+
header?: Omit<HeaderOptions, 'format'>;
|
|
2149
|
+
body: BodyOptions;
|
|
2150
|
+
footer?: FooterOptions;
|
|
2151
|
+
thumbnail_product_retailer_id: string;
|
|
2152
|
+
sections: ProductSection[];
|
|
2119
2153
|
}
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
flow_token?: string;
|
|
2130
|
-
data?: Record<string, any> & {
|
|
2131
|
-
error_key?: string;
|
|
2132
|
-
error_message?: string;
|
|
2133
|
-
};
|
|
2154
|
+
interface ProductCardCarouselTemplateOptions {
|
|
2155
|
+
name: string;
|
|
2156
|
+
language: LanguagesEnum;
|
|
2157
|
+
header?: Omit<HeaderOptions, 'format'>;
|
|
2158
|
+
body: BodyOptions;
|
|
2159
|
+
footer?: FooterOptions;
|
|
2160
|
+
cards: Array<{
|
|
2161
|
+
product_retailer_id: string;
|
|
2162
|
+
}>;
|
|
2134
2163
|
}
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
* List Flows
|
|
2143
|
-
*
|
|
2144
|
-
* @param wabaId - The WABA ID
|
|
2145
|
-
* @returns Promise with the list of flows
|
|
2146
|
-
*/
|
|
2147
|
-
listFlows(wabaId: string): Promise<FlowsListResponse>;
|
|
2148
|
-
/**
|
|
2149
|
-
* Create Flow
|
|
2150
|
-
*
|
|
2151
|
-
* @param wabaId - The WABA ID
|
|
2152
|
-
* @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
|
|
2153
|
-
* @returns Promise with the created flow ID
|
|
2154
|
-
*/
|
|
2155
|
-
createFlow(wabaId: string, data: {
|
|
2156
|
-
name: string;
|
|
2157
|
-
categories?: FlowCategoryEnum[];
|
|
2158
|
-
endpoint_uri?: string;
|
|
2159
|
-
clone_flow_id?: string;
|
|
2160
|
-
flow_json?: string;
|
|
2161
|
-
publish?: boolean;
|
|
2162
|
-
}): Promise<CreateFlowResponse>;
|
|
2163
|
-
/**
|
|
2164
|
-
* Get Flow
|
|
2165
|
-
*
|
|
2166
|
-
* @param flowId - The flow ID
|
|
2167
|
-
* @param fields - Optional fields to return
|
|
2168
|
-
* @param dateFormat - Optional date format
|
|
2169
|
-
* @returns Promise with the flow details
|
|
2170
|
-
*/
|
|
2171
|
-
getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
|
|
2172
|
-
/**
|
|
2173
|
-
* Update Flow Metadata
|
|
2174
|
-
*
|
|
2175
|
-
* @param flowId - The flow ID
|
|
2176
|
-
* @param data - The flow metadata to update
|
|
2177
|
-
* @returns Promise with the success status
|
|
2178
|
-
*/
|
|
2179
|
-
updateFlowMetadata(flowId: string, data: {
|
|
2180
|
-
name?: string;
|
|
2181
|
-
categories?: FlowCategoryEnum[];
|
|
2182
|
-
endpoint_uri?: string;
|
|
2183
|
-
application_id?: string;
|
|
2184
|
-
}): Promise<ResponseSuccess>;
|
|
2185
|
-
/**
|
|
2186
|
-
* Delete Flow
|
|
2187
|
-
*
|
|
2188
|
-
* @param flowId - The flow ID
|
|
2189
|
-
* @returns Promise with the success status
|
|
2190
|
-
*/
|
|
2191
|
-
deleteFlow(flowId: string): Promise<ResponseSuccess>;
|
|
2192
|
-
/**
|
|
2193
|
-
* List Assets (Get Flow JSON URL)
|
|
2194
|
-
*
|
|
2195
|
-
* @param flowId - The flow ID
|
|
2196
|
-
* @returns Promise with the list of assets
|
|
2197
|
-
*/
|
|
2198
|
-
listAssets(flowId: string): Promise<FlowAssetsResponse>;
|
|
2199
|
-
/**
|
|
2200
|
-
* Update Flow JSON
|
|
2201
|
-
*
|
|
2202
|
-
* @param flowId - The flow ID
|
|
2203
|
-
* @param data - The asset data including asset_type, file, and name
|
|
2204
|
-
* @returns Promise with the success status and validation errors
|
|
2205
|
-
*/
|
|
2206
|
-
updateFlowJson(flowId: string, data: {
|
|
2207
|
-
file: Blob | Buffer | object;
|
|
2208
|
-
name?: string;
|
|
2209
|
-
}): Promise<UpdateFlowResponse>;
|
|
2210
|
-
/**
|
|
2211
|
-
* Validate Flow JSON by attempting an update without publishing.
|
|
2212
|
-
* This is a convenience method; the API doesn't have a dedicated validation endpoint.
|
|
2213
|
-
*
|
|
2214
|
-
* @param flowId - The ID of the Flow (must exist, can be in DRAFT status).
|
|
2215
|
-
* @param flowJsonData - The Flow JSON content as a Buffer, JSON object, or Blob.
|
|
2216
|
-
* @returns Promise indicating if the JSON is valid and includes validation errors if any.
|
|
2217
|
-
*/
|
|
2218
|
-
validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
|
|
2219
|
-
/**
|
|
2220
|
-
* Publish Flow
|
|
2221
|
-
*
|
|
2222
|
-
* @param flowId - The flow ID
|
|
2223
|
-
* @returns Promise with the success status
|
|
2224
|
-
*/
|
|
2225
|
-
publishFlow(flowId: string): Promise<ResponseSuccess>;
|
|
2226
|
-
/**
|
|
2227
|
-
* Deprecate Flow
|
|
2228
|
-
*
|
|
2229
|
-
* @param flowId - The flow ID
|
|
2230
|
-
* @returns Promise with the success status
|
|
2231
|
-
*/
|
|
2232
|
-
deprecateFlow(flowId: string): Promise<ResponseSuccess>;
|
|
2233
|
-
/**
|
|
2234
|
-
* Migrate Flows
|
|
2235
|
-
*
|
|
2236
|
-
* @param wabaId - The destination WABA ID
|
|
2237
|
-
* @param data - The migration data including source_waba_id and optional source_flow_names
|
|
2238
|
-
* @returns Promise with migration results
|
|
2239
|
-
*/
|
|
2240
|
-
migrateFlows(wabaId: string, data: {
|
|
2241
|
-
source_waba_id: string;
|
|
2242
|
-
source_flow_names?: string[];
|
|
2243
|
-
}): Promise<FlowMigrationResponse>;
|
|
2164
|
+
interface SPMTemplateOptions {
|
|
2165
|
+
name: string;
|
|
2166
|
+
language: LanguagesEnum;
|
|
2167
|
+
header?: Omit<HeaderOptions, 'format'>;
|
|
2168
|
+
body: BodyOptions;
|
|
2169
|
+
footer?: FooterOptions;
|
|
2170
|
+
product_retailer_id: string;
|
|
2244
2171
|
}
|
|
2245
2172
|
//#endregion
|
|
2246
|
-
//#region src/
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
* Additional unique, alphanumeric identifier for a WhatsApp user
|
|
2254
|
-
*/
|
|
2255
|
-
user_id?: string;
|
|
2256
|
-
/**
|
|
2257
|
-
* Profile of Whatsapp user
|
|
2258
|
-
*/
|
|
2259
|
-
profile: {
|
|
2260
|
-
/**
|
|
2261
|
-
* The display name of the contact
|
|
2262
|
-
*/
|
|
2263
|
-
name: string;
|
|
2264
|
-
};
|
|
2173
|
+
//#region src/api/messages/types/text.d.ts
|
|
2174
|
+
type TextObject = {
|
|
2175
|
+
body: string;
|
|
2176
|
+
preview_url?: boolean;
|
|
2177
|
+
};
|
|
2178
|
+
interface TextMessageParams extends MessageRequestParams<TextObject | string> {
|
|
2179
|
+
previewUrl?: boolean;
|
|
2265
2180
|
}
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2181
|
+
//#endregion
|
|
2182
|
+
//#region src/api/messages/types/template.d.ts
|
|
2183
|
+
type LanguageObject = {
|
|
2184
|
+
policy: 'deterministic';
|
|
2185
|
+
code: LanguagesEnum;
|
|
2186
|
+
};
|
|
2187
|
+
type ParametersObject<T extends ParametersTypesEnum> = {
|
|
2188
|
+
type: T;
|
|
2189
|
+
};
|
|
2190
|
+
type SimpleTextObject$1 = {
|
|
2191
|
+
text: string;
|
|
2192
|
+
};
|
|
2193
|
+
type TextParametersObject = ParametersObject<ParametersTypesEnum.Text> & SimpleTextObject$1;
|
|
2194
|
+
type CouponCodeParametersObject = ParametersObject<ParametersTypesEnum.CouponCode> & {
|
|
2195
|
+
coupon_code: string;
|
|
2196
|
+
};
|
|
2197
|
+
type CurrencyObject = {
|
|
2198
|
+
fallback_value: string;
|
|
2199
|
+
code: CurrencyCodesEnum;
|
|
2200
|
+
amount_1000: number;
|
|
2201
|
+
};
|
|
2202
|
+
type CurrencyParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
|
|
2203
|
+
currency: CurrencyObject;
|
|
2204
|
+
};
|
|
2205
|
+
type DateTimeObject = {
|
|
2206
|
+
fallback_value: string;
|
|
2207
|
+
};
|
|
2208
|
+
type DateTimeParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
|
|
2209
|
+
date_time: DateTimeObject;
|
|
2210
|
+
};
|
|
2211
|
+
type DocumentMediaObject$2 = {
|
|
2212
|
+
id?: string;
|
|
2213
|
+
link?: string;
|
|
2214
|
+
caption?: string;
|
|
2215
|
+
filename?: string;
|
|
2216
|
+
};
|
|
2217
|
+
type ImageMediaObject$2 = {
|
|
2218
|
+
id?: string;
|
|
2219
|
+
link?: string;
|
|
2220
|
+
caption?: string;
|
|
2221
|
+
};
|
|
2222
|
+
type VideoMediaObject$2 = {
|
|
2223
|
+
id?: string;
|
|
2224
|
+
link?: string;
|
|
2225
|
+
caption?: string;
|
|
2226
|
+
};
|
|
2227
|
+
type DocumentParametersObject = ParametersObject<ParametersTypesEnum.Document> & DocumentMediaObject$2;
|
|
2228
|
+
type ImageParametersObject = ParametersObject<ParametersTypesEnum.Image> & ImageMediaObject$2;
|
|
2229
|
+
type VideoParametersObject = ParametersObject<ParametersTypesEnum.Video> & VideoMediaObject$2;
|
|
2230
|
+
type ComponentObject<T extends ComponentTypesEnum> = {
|
|
2231
|
+
type: T;
|
|
2232
|
+
parameters: (CurrencyParametersObject | DateTimeParametersObject | DocumentParametersObject | ImageParametersObject | TextParametersObject | VideoParametersObject | CouponCodeParametersObject)[];
|
|
2233
|
+
};
|
|
2234
|
+
type ButtonComponentObject = ComponentObject<ComponentTypesEnum.Button> & {
|
|
2235
|
+
parameters?: (TextParametersObject | PayloadParametersObject)[];
|
|
2236
|
+
sub_type: SubTypeEnum;
|
|
2237
|
+
index: ButtonPositionEnum;
|
|
2238
|
+
};
|
|
2239
|
+
type PayloadParametersObject = ParametersObject<ParametersTypesEnum.Payload> & {
|
|
2240
|
+
payload: string;
|
|
2241
|
+
};
|
|
2242
|
+
type MessageTemplateObject<T extends ComponentTypesEnum> = {
|
|
2243
|
+
name: string;
|
|
2244
|
+
language: LanguageObject;
|
|
2245
|
+
components?: (ComponentObject<T> | ButtonComponentObject)[];
|
|
2246
|
+
};
|
|
2247
|
+
//#endregion
|
|
2248
|
+
//#region src/api/messages/types/media.d.ts
|
|
2249
|
+
type MetaMediaObject = {
|
|
2270
2250
|
id: string;
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
}
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
video: {
|
|
2382
|
-
/**
|
|
2383
|
-
* The video caption (if provided)
|
|
2384
|
-
*/
|
|
2385
|
-
caption?: string;
|
|
2386
|
-
/**
|
|
2387
|
-
* The SHA256 hash of the video
|
|
2388
|
-
*/
|
|
2389
|
-
sha256?: string;
|
|
2390
|
-
/**
|
|
2391
|
-
* The ID for the video
|
|
2392
|
-
*/
|
|
2393
|
-
id: string;
|
|
2394
|
-
/**
|
|
2395
|
-
* The MIME type of the video
|
|
2396
|
-
*/
|
|
2397
|
-
mime_type: string;
|
|
2398
|
-
};
|
|
2399
|
-
}
|
|
2400
|
-
/**
|
|
2401
|
-
* Audio message interface
|
|
2402
|
-
*/
|
|
2403
|
-
interface AudioMessage extends BaseMessage {
|
|
2404
|
-
type: MessageTypesEnum.Audio;
|
|
2405
|
-
audio: {
|
|
2406
|
-
/**
|
|
2407
|
-
* The ID for the audio file
|
|
2408
|
-
*/
|
|
2409
|
-
id: string;
|
|
2410
|
-
/**
|
|
2411
|
-
* The MIME type of the audio file
|
|
2412
|
-
*/
|
|
2413
|
-
mime_type: string;
|
|
2414
|
-
/**
|
|
2415
|
-
* Whether the audio is a voice message
|
|
2416
|
-
*/
|
|
2417
|
-
voice?: boolean;
|
|
2418
|
-
};
|
|
2419
|
-
}
|
|
2420
|
-
/**
|
|
2421
|
-
* Document message interface
|
|
2422
|
-
*/
|
|
2423
|
-
interface DocumentMessage extends BaseMessage {
|
|
2424
|
-
type: MessageTypesEnum.Document;
|
|
2425
|
-
document: {
|
|
2426
|
-
/**
|
|
2427
|
-
* The document caption (if provided)
|
|
2428
|
-
*/
|
|
2429
|
-
caption?: string;
|
|
2430
|
-
/**
|
|
2431
|
-
* The document filename
|
|
2432
|
-
*/
|
|
2433
|
-
filename: string;
|
|
2434
|
-
/**
|
|
2435
|
-
* The SHA256 hash of the document
|
|
2436
|
-
*/
|
|
2437
|
-
sha256?: string;
|
|
2438
|
-
/**
|
|
2439
|
-
* The ID for the document
|
|
2440
|
-
*/
|
|
2441
|
-
id: string;
|
|
2442
|
-
/**
|
|
2443
|
-
* The MIME type of the document
|
|
2444
|
-
*/
|
|
2445
|
-
mime_type: string;
|
|
2446
|
-
};
|
|
2447
|
-
}
|
|
2448
|
-
/**
|
|
2449
|
-
* Sticker message interface
|
|
2450
|
-
*/
|
|
2451
|
-
interface StickerMessage extends BaseMessage {
|
|
2452
|
-
type: MessageTypesEnum.Sticker;
|
|
2453
|
-
sticker: {
|
|
2454
|
-
/**
|
|
2455
|
-
* The ID for the sticker
|
|
2456
|
-
*/
|
|
2457
|
-
id: string;
|
|
2458
|
-
/**
|
|
2459
|
-
* Whether this is an animated sticker
|
|
2460
|
-
*/
|
|
2461
|
-
animated: boolean;
|
|
2462
|
-
/**
|
|
2463
|
-
* The MIME type of the sticker
|
|
2464
|
-
*/
|
|
2465
|
-
mime_type: string;
|
|
2466
|
-
};
|
|
2467
|
-
}
|
|
2468
|
-
/**
|
|
2469
|
-
* Reaction message interface
|
|
2470
|
-
*/
|
|
2471
|
-
interface ReactionMessage extends BaseMessage {
|
|
2472
|
-
type: MessageTypesEnum.Reaction;
|
|
2473
|
-
reaction: {
|
|
2474
|
-
/**
|
|
2475
|
-
* The ID of the message being reacted to
|
|
2476
|
-
*/
|
|
2477
|
-
message_id: string;
|
|
2478
|
-
/**
|
|
2479
|
-
* Emoji used for the reaction
|
|
2480
|
-
*/
|
|
2481
|
-
emoji: string;
|
|
2482
|
-
};
|
|
2483
|
-
}
|
|
2484
|
-
/**
|
|
2485
|
-
* Contacts message interface
|
|
2486
|
-
*/
|
|
2487
|
-
interface ContactsMessage extends BaseMessage {
|
|
2488
|
-
type: MessageTypesEnum.Contacts;
|
|
2489
|
-
contacts: Array<{
|
|
2490
|
-
/**
|
|
2491
|
-
* The contact's name
|
|
2492
|
-
*/
|
|
2493
|
-
name: {
|
|
2494
|
-
/**
|
|
2495
|
-
* The formatted name
|
|
2496
|
-
*/
|
|
2497
|
-
formatted_name: string;
|
|
2498
|
-
/**
|
|
2499
|
-
* The first name
|
|
2500
|
-
*/
|
|
2501
|
-
first_name?: string;
|
|
2502
|
-
/**
|
|
2503
|
-
* The last name
|
|
2504
|
-
*/
|
|
2505
|
-
last_name?: string;
|
|
2506
|
-
/**
|
|
2507
|
-
* The middle name
|
|
2508
|
-
*/
|
|
2509
|
-
middle_name?: string;
|
|
2510
|
-
/**
|
|
2511
|
-
* The suffix
|
|
2512
|
-
*/
|
|
2513
|
-
suffix?: string;
|
|
2514
|
-
/**
|
|
2515
|
-
* The prefix
|
|
2516
|
-
*/
|
|
2517
|
-
prefix?: string;
|
|
2518
|
-
};
|
|
2519
|
-
/**
|
|
2520
|
-
* The contact's phone numbers
|
|
2521
|
-
*/
|
|
2522
|
-
phones?: Array<{
|
|
2523
|
-
phone: string;
|
|
2524
|
-
type?: string;
|
|
2525
|
-
wa_id?: string;
|
|
2526
|
-
}>;
|
|
2527
|
-
/**
|
|
2528
|
-
* The contact's emails
|
|
2529
|
-
*/
|
|
2530
|
-
emails?: Array<{
|
|
2531
|
-
email: string;
|
|
2532
|
-
type?: string;
|
|
2533
|
-
}>;
|
|
2534
|
-
/**
|
|
2535
|
-
* The contact's addresses
|
|
2536
|
-
*/
|
|
2537
|
-
addresses?: Array<{
|
|
2538
|
-
street?: string;
|
|
2539
|
-
city?: string;
|
|
2540
|
-
state?: string;
|
|
2541
|
-
zip?: string;
|
|
2542
|
-
country?: string;
|
|
2543
|
-
country_code?: string;
|
|
2544
|
-
type?: string;
|
|
2545
|
-
}>;
|
|
2546
|
-
/**
|
|
2547
|
-
* The contact's organizations
|
|
2548
|
-
*/
|
|
2549
|
-
org?: {
|
|
2550
|
-
company?: string;
|
|
2551
|
-
department?: string;
|
|
2552
|
-
title?: string;
|
|
2553
|
-
};
|
|
2554
|
-
/**
|
|
2555
|
-
* The contact's URLs
|
|
2556
|
-
*/
|
|
2557
|
-
urls?: Array<{
|
|
2558
|
-
url: string;
|
|
2559
|
-
type?: string;
|
|
2560
|
-
}>;
|
|
2561
|
-
/**
|
|
2562
|
-
* The contact's birthday (YYYY-MM-DD format)
|
|
2563
|
-
*/
|
|
2564
|
-
birthday?: string;
|
|
2565
|
-
}>;
|
|
2566
|
-
}
|
|
2567
|
-
/**
|
|
2568
|
-
* Location message interface
|
|
2569
|
-
*/
|
|
2570
|
-
interface LocationMessage extends BaseMessage {
|
|
2571
|
-
type: MessageTypesEnum.Location;
|
|
2572
|
-
location: {
|
|
2573
|
-
/**
|
|
2574
|
-
* Latitude of the location
|
|
2575
|
-
*/
|
|
2576
|
-
latitude: number;
|
|
2577
|
-
/**
|
|
2578
|
-
* Longitude of the location
|
|
2579
|
-
*/
|
|
2580
|
-
longitude: number;
|
|
2581
|
-
/**
|
|
2582
|
-
* Name of the location
|
|
2583
|
-
*/
|
|
2584
|
-
name?: string;
|
|
2585
|
-
/**
|
|
2586
|
-
* Address of the location
|
|
2587
|
-
*/
|
|
2588
|
-
address?: string;
|
|
2589
|
-
};
|
|
2590
|
-
}
|
|
2591
|
-
/**
|
|
2592
|
-
* Interactive message interface
|
|
2593
|
-
*/
|
|
2594
|
-
interface InteractiveMessage extends BaseMessage {
|
|
2595
|
-
type: MessageTypesEnum.Interactive;
|
|
2596
|
-
interactive: {
|
|
2597
|
-
/**
|
|
2598
|
-
* Type of the interactive message
|
|
2599
|
-
* Can be: button_reply, list_reply, flow, nfm_reply, etc.
|
|
2600
|
-
*/
|
|
2601
|
-
type: string;
|
|
2602
|
-
/**
|
|
2603
|
-
* ID for the button that was clicked
|
|
2604
|
-
*/
|
|
2605
|
-
button_reply?: {
|
|
2606
|
-
id: string;
|
|
2607
|
-
title: string;
|
|
2608
|
-
};
|
|
2609
|
-
/**
|
|
2610
|
-
* ID for the list item that was selected
|
|
2611
|
-
*/
|
|
2612
|
-
list_reply?: {
|
|
2613
|
-
id: string;
|
|
2614
|
-
title: string;
|
|
2615
|
-
description?: string;
|
|
2616
|
-
};
|
|
2617
|
-
/**
|
|
2618
|
-
* NFM (No-Code Flow Message) reply data
|
|
2619
|
-
*/
|
|
2620
|
-
nfm_reply?: {
|
|
2621
|
-
/**
|
|
2622
|
-
* Response data in JSON format
|
|
2623
|
-
*/
|
|
2624
|
-
response_json: string;
|
|
2625
|
-
/**
|
|
2626
|
-
* Body text of the reply
|
|
2627
|
-
*/
|
|
2628
|
-
body: string;
|
|
2629
|
-
/**
|
|
2630
|
-
* Name of the flow
|
|
2631
|
-
*/
|
|
2632
|
-
name: string;
|
|
2633
|
-
};
|
|
2634
|
-
};
|
|
2635
|
-
}
|
|
2636
|
-
/**
|
|
2637
|
-
* System message interface
|
|
2638
|
-
*/
|
|
2639
|
-
interface SystemMessage extends BaseMessage {
|
|
2640
|
-
type: MessageTypesEnum.System;
|
|
2641
|
-
system: {
|
|
2642
|
-
/**
|
|
2643
|
-
* The type of system update
|
|
2644
|
-
*/
|
|
2645
|
-
type: string;
|
|
2646
|
-
/**
|
|
2647
|
-
* User's identity if the update is a customer identity change
|
|
2648
|
-
*/
|
|
2649
|
-
identity?: string;
|
|
2650
|
-
/**
|
|
2651
|
-
* Old and new phone numbers if the update is a phone number change
|
|
2652
|
-
*/
|
|
2653
|
-
customer?: {
|
|
2654
|
-
/**
|
|
2655
|
-
* The previous phone number
|
|
2656
|
-
*/
|
|
2657
|
-
previous_wa_id: string;
|
|
2658
|
-
/**
|
|
2659
|
-
* The new phone number
|
|
2660
|
-
*/
|
|
2661
|
-
wa_id: string;
|
|
2662
|
-
};
|
|
2663
|
-
};
|
|
2664
|
-
}
|
|
2665
|
-
/**
|
|
2666
|
-
* Order message interface
|
|
2667
|
-
*/
|
|
2668
|
-
interface OrderMessage extends BaseMessage {
|
|
2669
|
-
type: MessageTypesEnum.Order;
|
|
2670
|
-
order: {
|
|
2671
|
-
/**
|
|
2672
|
-
* Catalog ID
|
|
2673
|
-
*/
|
|
2674
|
-
catalog_id: string;
|
|
2675
|
-
/**
|
|
2676
|
-
* Product items in the order
|
|
2677
|
-
*/
|
|
2678
|
-
product_items: Array<{
|
|
2679
|
-
/**
|
|
2680
|
-
* Product ID
|
|
2681
|
-
*/
|
|
2682
|
-
product_retailer_id: string;
|
|
2683
|
-
/**
|
|
2684
|
-
* Quantity of the product
|
|
2685
|
-
*/
|
|
2686
|
-
quantity: number;
|
|
2687
|
-
/**
|
|
2688
|
-
* Item price
|
|
2689
|
-
*/
|
|
2690
|
-
item_price: number;
|
|
2691
|
-
/**
|
|
2692
|
-
* Currency code
|
|
2693
|
-
*/
|
|
2694
|
-
currency: string;
|
|
2695
|
-
}>;
|
|
2696
|
-
/**
|
|
2697
|
-
* Text message included with the order
|
|
2698
|
-
*/
|
|
2699
|
-
text?: string;
|
|
2700
|
-
};
|
|
2701
|
-
}
|
|
2702
|
-
/**
|
|
2703
|
-
* Button message interface
|
|
2704
|
-
*/
|
|
2705
|
-
interface ButtonMessage extends BaseMessage {
|
|
2706
|
-
type: MessageTypesEnum.Button;
|
|
2707
|
-
button: {
|
|
2708
|
-
/**
|
|
2709
|
-
* The payload for the button
|
|
2710
|
-
*/
|
|
2711
|
-
payload: string;
|
|
2712
|
-
/**
|
|
2713
|
-
* Button text
|
|
2714
|
-
*/
|
|
2715
|
-
text: string;
|
|
2716
|
-
};
|
|
2717
|
-
}
|
|
2718
|
-
/**
|
|
2719
|
-
* Union type for all message types
|
|
2720
|
-
*/
|
|
2721
|
-
|
|
2722
|
-
/**
|
|
2723
|
-
* Represents a message received through the webhook
|
|
2724
|
-
* Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
|
|
2725
|
-
*/
|
|
2726
|
-
interface WebhookMessage {
|
|
2727
|
-
/**
|
|
2728
|
-
* The WhatsApp Business Account ID
|
|
2729
|
-
*/
|
|
2730
|
-
wabaId: string;
|
|
2731
|
-
/**
|
|
2732
|
-
* The message ID
|
|
2733
|
-
*/
|
|
2251
|
+
link?: never;
|
|
2252
|
+
};
|
|
2253
|
+
type HostedMediaObject = {
|
|
2254
|
+
id?: never;
|
|
2255
|
+
link: string;
|
|
2256
|
+
};
|
|
2257
|
+
type AudioMediaObject = MetaMediaObject | HostedMediaObject;
|
|
2258
|
+
type MetaDocumentMediaObject = MetaMediaObject & {
|
|
2259
|
+
caption?: string;
|
|
2260
|
+
filename?: string;
|
|
2261
|
+
};
|
|
2262
|
+
type HostedDocumentMediaObject = HostedMediaObject & {
|
|
2263
|
+
caption?: string;
|
|
2264
|
+
filename?: string;
|
|
2265
|
+
};
|
|
2266
|
+
type DocumentMediaObject = MetaDocumentMediaObject | HostedDocumentMediaObject;
|
|
2267
|
+
type MetaImageMediaObject = MetaMediaObject & {
|
|
2268
|
+
caption?: string;
|
|
2269
|
+
};
|
|
2270
|
+
type HostedImageMediaObject = HostedMediaObject & {
|
|
2271
|
+
caption?: string;
|
|
2272
|
+
};
|
|
2273
|
+
type ImageMediaObject = MetaImageMediaObject | HostedImageMediaObject;
|
|
2274
|
+
type MetaVideoMediaObject = MetaMediaObject & {
|
|
2275
|
+
caption?: string;
|
|
2276
|
+
};
|
|
2277
|
+
type HostedVideoMediaObject = HostedMediaObject & {
|
|
2278
|
+
caption?: string;
|
|
2279
|
+
};
|
|
2280
|
+
type VideoMediaObject = MetaVideoMediaObject | HostedVideoMediaObject;
|
|
2281
|
+
type StickerMediaObject = MetaMediaObject | HostedMediaObject;
|
|
2282
|
+
//#endregion
|
|
2283
|
+
//#region src/api/messages/types/contact.d.ts
|
|
2284
|
+
type AddressesObject = {
|
|
2285
|
+
street?: string;
|
|
2286
|
+
city?: string;
|
|
2287
|
+
state?: string;
|
|
2288
|
+
zip?: string;
|
|
2289
|
+
country?: string;
|
|
2290
|
+
country_code?: string;
|
|
2291
|
+
type?: 'HOME' | 'WORK' | string;
|
|
2292
|
+
};
|
|
2293
|
+
type EmailObject = {
|
|
2294
|
+
email?: string;
|
|
2295
|
+
type?: 'HOME' | 'WORK' | string;
|
|
2296
|
+
};
|
|
2297
|
+
type NameObject = {
|
|
2298
|
+
formatted_name: string;
|
|
2299
|
+
first_name?: string;
|
|
2300
|
+
last_name?: string;
|
|
2301
|
+
middle_name?: string;
|
|
2302
|
+
suffix?: string;
|
|
2303
|
+
prefix?: string;
|
|
2304
|
+
};
|
|
2305
|
+
type OrgObject = {
|
|
2306
|
+
company?: string;
|
|
2307
|
+
department?: string;
|
|
2308
|
+
title?: string;
|
|
2309
|
+
};
|
|
2310
|
+
type PhoneObject = {
|
|
2311
|
+
phone?: 'PHONE_NUMBER';
|
|
2312
|
+
type?: 'CELL' | 'MAIN' | 'IPHONE' | 'HOME' | 'WORK' | string;
|
|
2313
|
+
wa_id?: string;
|
|
2314
|
+
};
|
|
2315
|
+
type URLObject = {
|
|
2316
|
+
url?: string;
|
|
2317
|
+
type?: 'HOME' | 'WORK' | string;
|
|
2318
|
+
};
|
|
2319
|
+
type ContactObject = {
|
|
2320
|
+
addresses?: AddressesObject[];
|
|
2321
|
+
birthday?: `${number}${number}${number}${number}-${number}${number}-${number}${number}`;
|
|
2322
|
+
emails?: EmailObject[];
|
|
2323
|
+
name: NameObject;
|
|
2324
|
+
org?: OrgObject;
|
|
2325
|
+
phones?: PhoneObject[];
|
|
2326
|
+
urls?: URLObject[];
|
|
2327
|
+
};
|
|
2328
|
+
//#endregion
|
|
2329
|
+
//#region src/api/messages/types/location.d.ts
|
|
2330
|
+
type LocationObject = {
|
|
2331
|
+
longitude: number;
|
|
2332
|
+
latitude: number;
|
|
2333
|
+
name?: string;
|
|
2334
|
+
address?: string;
|
|
2335
|
+
};
|
|
2336
|
+
//#endregion
|
|
2337
|
+
//#region src/api/messages/types/interactive.d.ts
|
|
2338
|
+
type DocumentMediaObject$1 = {
|
|
2339
|
+
id?: string;
|
|
2340
|
+
link?: string;
|
|
2341
|
+
caption?: string;
|
|
2342
|
+
filename?: string;
|
|
2343
|
+
};
|
|
2344
|
+
type ImageMediaObject$1 = {
|
|
2345
|
+
id?: string;
|
|
2346
|
+
link?: string;
|
|
2347
|
+
caption?: string;
|
|
2348
|
+
};
|
|
2349
|
+
type VideoMediaObject$1 = {
|
|
2350
|
+
id?: string;
|
|
2351
|
+
link?: string;
|
|
2352
|
+
caption?: string;
|
|
2353
|
+
};
|
|
2354
|
+
type ProductObject = {
|
|
2355
|
+
product_retailer_id: string;
|
|
2356
|
+
};
|
|
2357
|
+
type SimpleTextObject = {
|
|
2358
|
+
text: string;
|
|
2359
|
+
};
|
|
2360
|
+
type RowObject = {
|
|
2734
2361
|
id: string;
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
status: 'delivered' | 'read' | 'sent';
|
|
2870
|
-
/**
|
|
2871
|
-
* Unix timestamp for the status message
|
|
2872
|
-
*/
|
|
2873
|
-
timestamp: string;
|
|
2362
|
+
title: string;
|
|
2363
|
+
description?: string;
|
|
2364
|
+
};
|
|
2365
|
+
type MultiProductSectionObject = {
|
|
2366
|
+
product_items: ProductObject[];
|
|
2367
|
+
rows?: never;
|
|
2368
|
+
title?: string;
|
|
2369
|
+
};
|
|
2370
|
+
type ListSectionObject = {
|
|
2371
|
+
product_items?: never;
|
|
2372
|
+
rows: RowObject[];
|
|
2373
|
+
title?: string;
|
|
2374
|
+
};
|
|
2375
|
+
type SectionObject = MultiProductSectionObject | ListSectionObject;
|
|
2376
|
+
type ButtonObject = {
|
|
2377
|
+
title: string;
|
|
2378
|
+
id: string;
|
|
2379
|
+
};
|
|
2380
|
+
type ReplyButtonObject = {
|
|
2381
|
+
type: 'reply';
|
|
2382
|
+
reply: ButtonObject;
|
|
2383
|
+
};
|
|
2384
|
+
type ActionObject = {
|
|
2385
|
+
buttons?: ReplyButtonObject[];
|
|
2386
|
+
catalog_id?: string;
|
|
2387
|
+
product_retailer_id?: string;
|
|
2388
|
+
sections?: SectionObject[];
|
|
2389
|
+
};
|
|
2390
|
+
type HeaderObject = {
|
|
2391
|
+
type: 'document' | 'image' | 'text' | 'video';
|
|
2392
|
+
document?: DocumentMediaObject$1;
|
|
2393
|
+
image?: ImageMediaObject$1;
|
|
2394
|
+
text?: string;
|
|
2395
|
+
video?: VideoMediaObject$1;
|
|
2396
|
+
};
|
|
2397
|
+
type ButtonInteractiveObject = {
|
|
2398
|
+
type: InteractiveTypesEnum.Button;
|
|
2399
|
+
body: SimpleTextObject;
|
|
2400
|
+
footer?: SimpleTextObject;
|
|
2401
|
+
header?: HeaderObject;
|
|
2402
|
+
action: ActionObject;
|
|
2403
|
+
};
|
|
2404
|
+
type ListInteractiveObject = {
|
|
2405
|
+
type: InteractiveTypesEnum.List;
|
|
2406
|
+
body: SimpleTextObject;
|
|
2407
|
+
footer?: SimpleTextObject;
|
|
2408
|
+
header?: HeaderObject;
|
|
2409
|
+
action: ActionObject;
|
|
2410
|
+
};
|
|
2411
|
+
type ProductInteractiveObject = {
|
|
2412
|
+
type: InteractiveTypesEnum.Product;
|
|
2413
|
+
body?: SimpleTextObject;
|
|
2414
|
+
footer?: SimpleTextObject;
|
|
2415
|
+
header?: HeaderObject;
|
|
2416
|
+
action: ActionObject;
|
|
2417
|
+
};
|
|
2418
|
+
type ProductListInteractiveObject = {
|
|
2419
|
+
type: InteractiveTypesEnum.ProductList;
|
|
2420
|
+
body: SimpleTextObject;
|
|
2421
|
+
footer?: SimpleTextObject;
|
|
2422
|
+
header: HeaderObject;
|
|
2423
|
+
action: ActionObject;
|
|
2424
|
+
};
|
|
2425
|
+
type CtaUrlParameters = {
|
|
2426
|
+
display_text: string;
|
|
2427
|
+
url: string;
|
|
2428
|
+
};
|
|
2429
|
+
type CtaUrlActionObject = {
|
|
2430
|
+
name: 'cta_url';
|
|
2431
|
+
parameters: CtaUrlParameters;
|
|
2432
|
+
};
|
|
2433
|
+
type CtaUrlInteractiveObject = {
|
|
2434
|
+
type: InteractiveTypesEnum.CtaUrl;
|
|
2435
|
+
body?: SimpleTextObject;
|
|
2436
|
+
footer?: SimpleTextObject;
|
|
2437
|
+
header?: HeaderObject;
|
|
2438
|
+
action: CtaUrlActionObject;
|
|
2439
|
+
};
|
|
2440
|
+
type LocationRequestActionObject = {
|
|
2441
|
+
name: 'send_location';
|
|
2442
|
+
};
|
|
2443
|
+
type LocationRequestInteractiveObject = {
|
|
2444
|
+
type: InteractiveTypesEnum.LocationRequest;
|
|
2445
|
+
body: SimpleTextObject;
|
|
2446
|
+
footer?: SimpleTextObject;
|
|
2447
|
+
header?: HeaderObject;
|
|
2448
|
+
action: LocationRequestActionObject;
|
|
2449
|
+
};
|
|
2450
|
+
type AddressValues = {
|
|
2451
|
+
name?: string;
|
|
2452
|
+
phone_number?: string;
|
|
2453
|
+
in_pin_code?: string;
|
|
2454
|
+
house_number?: string;
|
|
2455
|
+
floor_number?: string;
|
|
2456
|
+
tower_number?: string;
|
|
2457
|
+
building_name?: string;
|
|
2458
|
+
address?: string;
|
|
2459
|
+
landmark_area?: string;
|
|
2460
|
+
city?: string;
|
|
2461
|
+
state?: string;
|
|
2462
|
+
};
|
|
2463
|
+
type SavedAddress = {
|
|
2464
|
+
id: string;
|
|
2465
|
+
value: AddressValues;
|
|
2466
|
+
};
|
|
2467
|
+
type ValidationErrors = { [key in keyof AddressValues]?: string };
|
|
2468
|
+
type AddressMessageParameters = {
|
|
2469
|
+
country: string;
|
|
2470
|
+
values?: AddressValues;
|
|
2471
|
+
saved_addresses?: SavedAddress[];
|
|
2472
|
+
validation_errors?: ValidationErrors;
|
|
2473
|
+
};
|
|
2474
|
+
type AddressMessageActionObject = {
|
|
2475
|
+
name: 'address_message';
|
|
2476
|
+
parameters: AddressMessageParameters;
|
|
2477
|
+
};
|
|
2478
|
+
type AddressMessageInteractiveObject = {
|
|
2479
|
+
type: InteractiveTypesEnum.AddressMessage;
|
|
2480
|
+
body: SimpleTextObject;
|
|
2481
|
+
footer?: SimpleTextObject;
|
|
2482
|
+
header?: HeaderObject;
|
|
2483
|
+
action: AddressMessageActionObject;
|
|
2484
|
+
};
|
|
2485
|
+
type FlowParameters = {
|
|
2486
|
+
flow_message_version: string;
|
|
2487
|
+
flow_id?: string;
|
|
2488
|
+
flow_name?: string;
|
|
2489
|
+
flow_cta: string;
|
|
2490
|
+
mode?: 'draft' | 'published';
|
|
2491
|
+
flow_token: string;
|
|
2492
|
+
flow_action: 'navigate' | 'data_exchange';
|
|
2493
|
+
flow_action_payload?: {
|
|
2494
|
+
screen?: string;
|
|
2495
|
+
data?: Record<string, string>;
|
|
2874
2496
|
};
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2497
|
+
};
|
|
2498
|
+
type FlowActionObject = {
|
|
2499
|
+
name: 'flow';
|
|
2500
|
+
parameters: FlowParameters;
|
|
2501
|
+
};
|
|
2502
|
+
type FlowInteractiveObject = {
|
|
2503
|
+
type: InteractiveTypesEnum.Flow;
|
|
2504
|
+
body: SimpleTextObject;
|
|
2505
|
+
footer?: SimpleTextObject;
|
|
2506
|
+
header?: HeaderObject;
|
|
2507
|
+
action: FlowActionObject;
|
|
2508
|
+
};
|
|
2509
|
+
type InteractiveObject = ButtonInteractiveObject | ListInteractiveObject | ProductInteractiveObject | ProductListInteractiveObject | CtaUrlInteractiveObject | LocationRequestInteractiveObject | AddressMessageInteractiveObject | FlowInteractiveObject;
|
|
2510
|
+
//#endregion
|
|
2511
|
+
//#region src/api/messages/types/reaction.d.ts
|
|
2512
|
+
interface ReactionParams {
|
|
2513
|
+
messageId: string;
|
|
2514
|
+
emoji: string;
|
|
2515
|
+
to: string;
|
|
2879
2516
|
}
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
interface WebhookEvent {
|
|
2884
|
-
/**
|
|
2885
|
-
* The field type of the event
|
|
2886
|
-
*/
|
|
2887
|
-
field: string;
|
|
2888
|
-
/**
|
|
2889
|
-
* The event data
|
|
2890
|
-
*/
|
|
2891
|
-
value: any;
|
|
2517
|
+
//#endregion
|
|
2518
|
+
//#region src/api/messages/types/common.d.ts
|
|
2519
|
+
type GeneralMessageBody = GeneralRequestBody & {
|
|
2892
2520
|
/**
|
|
2893
|
-
* The
|
|
2521
|
+
* The Meta messaging product name.
|
|
2522
|
+
* @default 'whatsapp'
|
|
2894
2523
|
*/
|
|
2895
|
-
|
|
2524
|
+
messaging_product: 'whatsapp';
|
|
2525
|
+
};
|
|
2526
|
+
type ConTextObject = {
|
|
2527
|
+
message_id: string;
|
|
2528
|
+
};
|
|
2529
|
+
type MessageRequestBody<T extends MessageTypesEnum> = GeneralMessageBody & {
|
|
2530
|
+
recipient_type?: string;
|
|
2531
|
+
to: string;
|
|
2532
|
+
context?: ConTextObject;
|
|
2533
|
+
type?: T;
|
|
2534
|
+
};
|
|
2535
|
+
interface MessageRequestParams<T> {
|
|
2536
|
+
body: T;
|
|
2537
|
+
to: string;
|
|
2538
|
+
replyMessageId?: string;
|
|
2896
2539
|
}
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2540
|
+
interface StatusParams {
|
|
2541
|
+
status: string;
|
|
2542
|
+
messageId: string;
|
|
2543
|
+
typingIndicator?: {
|
|
2544
|
+
type: string;
|
|
2545
|
+
};
|
|
2546
|
+
}
|
|
2547
|
+
type MessagesResponse = GeneralMessageBody & {
|
|
2548
|
+
contacts: [{
|
|
2549
|
+
input: string;
|
|
2550
|
+
wa_id: string;
|
|
2551
|
+
}];
|
|
2552
|
+
messages: [{
|
|
2553
|
+
id: string;
|
|
2554
|
+
}];
|
|
2555
|
+
};
|
|
2556
|
+
declare class MessagesClass extends BaseClass {
|
|
2557
|
+
text(params: TextMessageParams): Promise<MessagesResponse>;
|
|
2558
|
+
template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<MessagesResponse>;
|
|
2559
|
+
audio(params: MessageRequestParams<AudioMediaObject>): Promise<MessagesResponse>;
|
|
2560
|
+
document(params: MessageRequestParams<DocumentMediaObject>): Promise<MessagesResponse>;
|
|
2561
|
+
image(params: MessageRequestParams<ImageMediaObject>): Promise<MessagesResponse>;
|
|
2562
|
+
video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
|
|
2563
|
+
sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
|
|
2564
|
+
contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
|
|
2565
|
+
location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
|
|
2566
|
+
interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
|
|
2567
|
+
interactiveList(params: MessageRequestParams<InteractiveObject & {
|
|
2568
|
+
type: InteractiveTypesEnum.List;
|
|
2569
|
+
}>): Promise<MessagesResponse>;
|
|
2570
|
+
interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
|
|
2571
|
+
type: InteractiveTypesEnum.CtaUrl;
|
|
2572
|
+
}>): Promise<MessagesResponse>;
|
|
2573
|
+
interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
|
|
2574
|
+
type: InteractiveTypesEnum.LocationRequest;
|
|
2575
|
+
}>): Promise<MessagesResponse>;
|
|
2576
|
+
interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
|
|
2577
|
+
type: InteractiveTypesEnum.AddressMessage;
|
|
2578
|
+
}>): Promise<MessagesResponse>;
|
|
2579
|
+
interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
|
|
2580
|
+
type: InteractiveTypesEnum.Button;
|
|
2581
|
+
}>): Promise<MessagesResponse>;
|
|
2582
|
+
interactiveFlow(params: MessageRequestParams<InteractiveObject & {
|
|
2583
|
+
type: InteractiveTypesEnum.Flow;
|
|
2584
|
+
}>): Promise<MessagesResponse>;
|
|
2585
|
+
reaction(params: ReactionParams): Promise<MessagesResponse>;
|
|
2586
|
+
markAsRead(params: {
|
|
2587
|
+
messageId: string;
|
|
2588
|
+
}): Promise<MessagesResponse>;
|
|
2589
|
+
showTypingIndicator(params: {
|
|
2590
|
+
messageId: string;
|
|
2591
|
+
}): Promise<MessagesResponse>;
|
|
2592
|
+
status(params: StatusParams): Promise<MessagesResponse>;
|
|
2593
|
+
}
|
|
2594
|
+
//#endregion
|
|
2595
|
+
//#region src/api/media/types/common.d.ts
|
|
2596
|
+
type MediaResponse = {
|
|
2597
|
+
id: string;
|
|
2598
|
+
url: string;
|
|
2599
|
+
mime_type: string;
|
|
2600
|
+
sha256: string;
|
|
2601
|
+
file_size: number;
|
|
2602
|
+
messaging_product: 'whatsapp';
|
|
2603
|
+
};
|
|
2604
|
+
type MediasResponse = {
|
|
2605
|
+
data: MediaResponse[];
|
|
2606
|
+
paging: {
|
|
2607
|
+
cursors: {
|
|
2608
|
+
before: string;
|
|
2609
|
+
after: string;
|
|
2610
|
+
};
|
|
2611
|
+
};
|
|
2612
|
+
};
|
|
2613
|
+
type UploadMediaResponse = {
|
|
2614
|
+
id: string;
|
|
2615
|
+
};
|
|
2616
|
+
interface MediaClass {
|
|
2617
|
+
getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
|
|
2618
|
+
uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
|
|
2619
|
+
deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
|
|
2620
|
+
downloadMedia(mediaUrl: string): Promise<Blob>;
|
|
2904
2621
|
}
|
|
2905
2622
|
//#endregion
|
|
2906
2623
|
//#region src/api/qrCode/types/common.d.ts
|
|
@@ -3006,108 +2723,476 @@ interface WabaHealthStatusEntity {
|
|
|
3006
2723
|
errors?: WabaHealthStatusError[];
|
|
3007
2724
|
}
|
|
3008
2725
|
/**
|
|
3009
|
-
* Overall WABA health status
|
|
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;
|
|
2849
|
+
column_end: number;
|
|
2850
|
+
path: string;
|
|
2851
|
+
}
|
|
2852
|
+
/**
|
|
2853
|
+
* Flow Validation Error
|
|
2854
|
+
*/
|
|
2855
|
+
interface FlowValidationError {
|
|
2856
|
+
error: string;
|
|
2857
|
+
error_type: string;
|
|
2858
|
+
message: string;
|
|
2859
|
+
line_start: number;
|
|
2860
|
+
line_end: number;
|
|
2861
|
+
column_start: number;
|
|
2862
|
+
column_end: number;
|
|
2863
|
+
pointers: FlowValidationErrorPointer[];
|
|
2864
|
+
}
|
|
2865
|
+
/**
|
|
2866
|
+
* Flow Item
|
|
2867
|
+
*/
|
|
2868
|
+
interface Flow {
|
|
2869
|
+
id: string;
|
|
2870
|
+
name: string;
|
|
2871
|
+
status: FlowStatusEnum;
|
|
2872
|
+
categories: FlowCategoryEnum[];
|
|
2873
|
+
validation_errors: FlowValidationError[];
|
|
2874
|
+
}
|
|
2875
|
+
/**
|
|
2876
|
+
* Pagination Cursors
|
|
2877
|
+
*/
|
|
2878
|
+
interface PaginationCursors {
|
|
2879
|
+
before: string;
|
|
2880
|
+
after: string;
|
|
2881
|
+
}
|
|
2882
|
+
/**
|
|
2883
|
+
* Pagination Object
|
|
2884
|
+
*/
|
|
2885
|
+
interface Pagination {
|
|
2886
|
+
cursors: PaginationCursors;
|
|
2887
|
+
}
|
|
2888
|
+
/**
|
|
2889
|
+
* Flows List Response
|
|
2890
|
+
*/
|
|
2891
|
+
interface FlowsListResponse {
|
|
2892
|
+
data: Flow[];
|
|
2893
|
+
paging: Pagination;
|
|
2894
|
+
}
|
|
2895
|
+
/**
|
|
2896
|
+
* Flow Asset
|
|
2897
|
+
*/
|
|
2898
|
+
interface FlowAsset {
|
|
2899
|
+
name: string;
|
|
2900
|
+
asset_type: string;
|
|
2901
|
+
download_url: string;
|
|
2902
|
+
}
|
|
2903
|
+
/**
|
|
2904
|
+
* Flow Assets Response
|
|
2905
|
+
*/
|
|
2906
|
+
interface FlowAssetsResponse {
|
|
2907
|
+
data: FlowAsset[];
|
|
2908
|
+
paging: Pagination;
|
|
2909
|
+
}
|
|
2910
|
+
/**
|
|
2911
|
+
* Flow Preview
|
|
2912
|
+
*/
|
|
2913
|
+
interface FlowPreview {
|
|
2914
|
+
preview_url: string;
|
|
2915
|
+
expires_at: string;
|
|
2916
|
+
}
|
|
2917
|
+
/**
|
|
2918
|
+
* Flow Preview Response
|
|
2919
|
+
*/
|
|
2920
|
+
interface FlowPreviewResponse {
|
|
2921
|
+
preview: FlowPreview;
|
|
2922
|
+
id: string;
|
|
2923
|
+
}
|
|
2924
|
+
/**
|
|
2925
|
+
* Flow Migration Result
|
|
2926
|
+
*/
|
|
2927
|
+
interface FlowMigrationResult {
|
|
2928
|
+
source_name: string;
|
|
2929
|
+
source_id: string;
|
|
2930
|
+
migrated_id: string;
|
|
2931
|
+
}
|
|
2932
|
+
/**
|
|
2933
|
+
* Flow Migration Failure
|
|
2934
|
+
*/
|
|
2935
|
+
interface FlowMigrationFailure {
|
|
2936
|
+
source_name: string;
|
|
2937
|
+
error_code: string;
|
|
2938
|
+
error_message: string;
|
|
2939
|
+
}
|
|
2940
|
+
/**
|
|
2941
|
+
* Create Flow Response
|
|
2942
|
+
*/
|
|
2943
|
+
interface CreateFlowResponse {
|
|
2944
|
+
id: string;
|
|
2945
|
+
success: boolean;
|
|
2946
|
+
validation_errors?: FlowValidationError[];
|
|
2947
|
+
}
|
|
2948
|
+
/**
|
|
2949
|
+
* Update Flow Response
|
|
2950
|
+
*/
|
|
2951
|
+
interface UpdateFlowResponse {
|
|
2952
|
+
success: boolean;
|
|
2953
|
+
validation_errors?: FlowValidationError[];
|
|
2954
|
+
}
|
|
2955
|
+
/**
|
|
2956
|
+
* Flow Migration Response
|
|
2957
|
+
*/
|
|
2958
|
+
interface FlowMigrationResponse {
|
|
2959
|
+
migrated_flows: FlowMigrationResult[];
|
|
2960
|
+
failed_flows: FlowMigrationFailure[];
|
|
2961
|
+
}
|
|
2962
|
+
/**
|
|
2963
|
+
* Validate Flow JSON Response
|
|
2964
|
+
*/
|
|
2965
|
+
interface ValidateFlowJsonResponse {
|
|
2966
|
+
valid: boolean;
|
|
2967
|
+
success: boolean;
|
|
2968
|
+
validation_errors?: FlowValidationError[];
|
|
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
|
|
3010
2999
|
*/
|
|
3011
|
-
interface
|
|
3012
|
-
|
|
3013
|
-
|
|
3000
|
+
interface FlowHealthCheckRequest {
|
|
3001
|
+
action: 'ping';
|
|
3002
|
+
version: '3.0';
|
|
3014
3003
|
}
|
|
3015
3004
|
/**
|
|
3016
|
-
* WhatsApp
|
|
3005
|
+
* WhatsApp Flow Endpoint - Health Check Response
|
|
3006
|
+
* The expected response structure for health check requests
|
|
3017
3007
|
*/
|
|
3018
|
-
interface
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
status?: WabaAccountStatus;
|
|
3023
|
-
business_verification_status?: WabaBusinessVerificationStatus;
|
|
3024
|
-
message_template_namespace?: string;
|
|
3025
|
-
name?: string;
|
|
3026
|
-
ownership_type?: string;
|
|
3027
|
-
currency?: string;
|
|
3008
|
+
interface FlowHealthCheckResponse {
|
|
3009
|
+
data: {
|
|
3010
|
+
status: 'active';
|
|
3011
|
+
};
|
|
3028
3012
|
}
|
|
3029
3013
|
/**
|
|
3030
|
-
*
|
|
3014
|
+
* WhatsApp Flow Endpoint - Data Exchange Request
|
|
3015
|
+
* Represents the structure of a data exchange request
|
|
3031
3016
|
*/
|
|
3032
|
-
|
|
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
|
+
}
|
|
3033
3026
|
/**
|
|
3034
|
-
*
|
|
3027
|
+
* WhatsApp Flow Endpoint - Data Exchange Response
|
|
3028
|
+
* The expected response structure for data exchange requests
|
|
3035
3029
|
*/
|
|
3036
|
-
|
|
3030
|
+
interface FlowDataExchangeResponse {
|
|
3031
|
+
screen?: string;
|
|
3032
|
+
data?: Record<string, any | {
|
|
3033
|
+
error_message?: string;
|
|
3034
|
+
}>;
|
|
3035
|
+
}
|
|
3037
3036
|
/**
|
|
3038
|
-
*
|
|
3037
|
+
* WhatsApp Flow Endpoint - Success Screen Response
|
|
3038
|
+
* The expected response structure for success screen requests
|
|
3039
3039
|
*/
|
|
3040
|
-
interface
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
pin: string;
|
|
3051
|
-
data_localization_region?: DataLocalizationRegionEnum;
|
|
3052
|
-
};
|
|
3053
|
-
interface RegistrationClass {
|
|
3054
|
-
register(pin: string, dataLocalizationRegion?: DataLocalizationRegionEnum): Promise<ResponseSuccess>;
|
|
3055
|
-
deregister(): Promise<ResponseSuccess>;
|
|
3056
|
-
}
|
|
3057
|
-
//#endregion
|
|
3058
|
-
//#region src/api/twoStepVerification/types/common.d.ts
|
|
3059
|
-
type TwoStepVerificationRequest = {
|
|
3060
|
-
pin: string;
|
|
3061
|
-
};
|
|
3062
|
-
interface TwoStepVerificationClass {
|
|
3063
|
-
setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
|
|
3040
|
+
interface FlowSuccessScreenResponse {
|
|
3041
|
+
screen: 'SUCCESS';
|
|
3042
|
+
data: {
|
|
3043
|
+
extension_message_response?: {
|
|
3044
|
+
params?: {
|
|
3045
|
+
flow_token: string;
|
|
3046
|
+
[key: string]: string;
|
|
3047
|
+
};
|
|
3048
|
+
};
|
|
3049
|
+
};
|
|
3064
3050
|
}
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
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
|
+
};
|
|
3076
3064
|
}
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
sendRequest(hostname: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null): Promise<HttpsClientResponseClass>;
|
|
3065
|
+
/**
|
|
3066
|
+
* WhatsApp Flow Endpoint - Error Notification Response
|
|
3067
|
+
* The expected response structure for error notification requests
|
|
3068
|
+
*/
|
|
3069
|
+
interface FlowErrorNotificationResponse {
|
|
3070
|
+
acknowledged: boolean;
|
|
3084
3071
|
}
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
sendRequest(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, contentType?: string, additionalHeaders?: Record<string, string>): Promise<HttpsClientResponseClass>;
|
|
3100
|
-
getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
3101
|
-
sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
3102
|
-
sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
3072
|
+
/**
|
|
3073
|
+
* WhatsApp Flow Endpoint - Comprehensive Request Object
|
|
3074
|
+
* A combined type that includes all possible fields from different request types
|
|
3075
|
+
* with all fields being optional for flexibility
|
|
3076
|
+
*/
|
|
3077
|
+
interface FlowEndpointRequest {
|
|
3078
|
+
version?: '3.0';
|
|
3079
|
+
action?: 'ping' | FlowActionEnum;
|
|
3080
|
+
screen?: string;
|
|
3081
|
+
flow_token?: string;
|
|
3082
|
+
data?: Record<string, any> & {
|
|
3083
|
+
error_key?: string;
|
|
3084
|
+
error_message?: string;
|
|
3085
|
+
};
|
|
3103
3086
|
}
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3087
|
+
/**
|
|
3088
|
+
* WhatsApp Flow Endpoint - Response
|
|
3089
|
+
* Union type for all possible response types from a Flow endpoint
|
|
3090
|
+
*/
|
|
3091
|
+
type FlowEndpointResponse = FlowHealthCheckResponse | FlowDataExchangeResponse | FlowErrorNotificationResponse | FlowSuccessScreenResponse;
|
|
3092
|
+
interface FlowClass {
|
|
3093
|
+
/**
|
|
3094
|
+
* List Flows
|
|
3095
|
+
*
|
|
3096
|
+
* @param wabaId - The WABA ID
|
|
3097
|
+
* @returns Promise with the list of flows
|
|
3098
|
+
*/
|
|
3099
|
+
listFlows(wabaId: string): Promise<FlowsListResponse>;
|
|
3100
|
+
/**
|
|
3101
|
+
* Create Flow
|
|
3102
|
+
*
|
|
3103
|
+
* @param wabaId - The WABA ID
|
|
3104
|
+
* @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
|
|
3105
|
+
* @returns Promise with the created flow ID
|
|
3106
|
+
*/
|
|
3107
|
+
createFlow(wabaId: string, data: {
|
|
3108
|
+
name: string;
|
|
3109
|
+
categories?: FlowCategoryEnum[];
|
|
3110
|
+
endpoint_uri?: string;
|
|
3111
|
+
clone_flow_id?: string;
|
|
3112
|
+
flow_json?: string;
|
|
3113
|
+
publish?: boolean;
|
|
3114
|
+
}): Promise<CreateFlowResponse>;
|
|
3115
|
+
/**
|
|
3116
|
+
* Get Flow
|
|
3117
|
+
*
|
|
3118
|
+
* @param flowId - The flow ID
|
|
3119
|
+
* @param fields - Optional fields to return
|
|
3120
|
+
* @param dateFormat - Optional date format
|
|
3121
|
+
* @returns Promise with the flow details
|
|
3122
|
+
*/
|
|
3123
|
+
getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
|
|
3124
|
+
/**
|
|
3125
|
+
* Update Flow Metadata
|
|
3126
|
+
*
|
|
3127
|
+
* @param flowId - The flow ID
|
|
3128
|
+
* @param data - The flow metadata to update
|
|
3129
|
+
* @returns Promise with the success status
|
|
3130
|
+
*/
|
|
3131
|
+
updateFlowMetadata(flowId: string, data: {
|
|
3132
|
+
name?: string;
|
|
3133
|
+
categories?: FlowCategoryEnum[];
|
|
3134
|
+
endpoint_uri?: string;
|
|
3135
|
+
application_id?: string;
|
|
3136
|
+
}): Promise<ResponseSuccess>;
|
|
3137
|
+
/**
|
|
3138
|
+
* Delete Flow
|
|
3139
|
+
*
|
|
3140
|
+
* @param flowId - The flow ID
|
|
3141
|
+
* @returns Promise with the success status
|
|
3142
|
+
*/
|
|
3143
|
+
deleteFlow(flowId: string): Promise<ResponseSuccess>;
|
|
3144
|
+
/**
|
|
3145
|
+
* List Assets (Get Flow JSON URL)
|
|
3146
|
+
*
|
|
3147
|
+
* @param flowId - The flow ID
|
|
3148
|
+
* @returns Promise with the list of assets
|
|
3149
|
+
*/
|
|
3150
|
+
listAssets(flowId: string): Promise<FlowAssetsResponse>;
|
|
3151
|
+
/**
|
|
3152
|
+
* Update Flow JSON
|
|
3153
|
+
*
|
|
3154
|
+
* @param flowId - The flow ID
|
|
3155
|
+
* @param data - The asset data including asset_type, file, and name
|
|
3156
|
+
* @returns Promise with the success status and validation errors
|
|
3157
|
+
*/
|
|
3158
|
+
updateFlowJson(flowId: string, data: {
|
|
3159
|
+
file: Blob | Buffer | object;
|
|
3160
|
+
name?: string;
|
|
3161
|
+
}): Promise<UpdateFlowResponse>;
|
|
3162
|
+
/**
|
|
3163
|
+
* Validate Flow JSON by attempting an update without publishing.
|
|
3164
|
+
* This is a convenience method; the API doesn't have a dedicated validation endpoint.
|
|
3165
|
+
*
|
|
3166
|
+
* @param flowId - The ID of the Flow (must exist, can be in DRAFT status).
|
|
3167
|
+
* @param flowJsonData - The Flow JSON content as a Buffer, JSON object, or Blob.
|
|
3168
|
+
* @returns Promise indicating if the JSON is valid and includes validation errors if any.
|
|
3169
|
+
*/
|
|
3170
|
+
validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
|
|
3171
|
+
/**
|
|
3172
|
+
* Publish Flow
|
|
3173
|
+
*
|
|
3174
|
+
* @param flowId - The flow ID
|
|
3175
|
+
* @returns Promise with the success status
|
|
3176
|
+
*/
|
|
3177
|
+
publishFlow(flowId: string): Promise<ResponseSuccess>;
|
|
3178
|
+
/**
|
|
3179
|
+
* Deprecate Flow
|
|
3180
|
+
*
|
|
3181
|
+
* @param flowId - The flow ID
|
|
3182
|
+
* @returns Promise with the success status
|
|
3183
|
+
*/
|
|
3184
|
+
deprecateFlow(flowId: string): Promise<ResponseSuccess>;
|
|
3185
|
+
/**
|
|
3186
|
+
* Migrate Flows
|
|
3187
|
+
*
|
|
3188
|
+
* @param wabaId - The destination WABA ID
|
|
3189
|
+
* @param data - The migration data including source_waba_id and optional source_flow_names
|
|
3190
|
+
* @returns Promise with migration results
|
|
3191
|
+
*/
|
|
3192
|
+
migrateFlows(wabaId: string, data: {
|
|
3193
|
+
source_waba_id: string;
|
|
3194
|
+
source_flow_names?: string[];
|
|
3195
|
+
}): Promise<FlowMigrationResponse>;
|
|
3111
3196
|
}
|
|
3112
3197
|
//#endregion
|
|
3113
3198
|
//#region src/api/flow/FlowApi.d.ts
|
|
@@ -4586,5 +4671,5 @@ declare function nextjsAppWebhookHandler(config: NextJsAppWebhookConfig): {
|
|
|
4586
4671
|
//#region src/core/webhook/utils/generateXHub256Sig.d.ts
|
|
4587
4672
|
declare const generateXHub256Sig: (body: string, appSecret: string) => string;
|
|
4588
4673
|
//#endregion
|
|
4589
|
-
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 };
|
|
4590
4675
|
//# sourceMappingURL=index.d.ts.map
|