meta-cloud-api 1.1.9 → 1.1.10
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 +1088 -1107
- package/dist/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +737 -753
- package/dist/types/index.d.ts.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/index.d.ts
CHANGED
|
@@ -745,171 +745,827 @@ type WabaConfigType = {
|
|
|
745
745
|
[WabaConfigEnum.Passphrase]: string;
|
|
746
746
|
};
|
|
747
747
|
//#endregion
|
|
748
|
-
//#region src/types
|
|
749
|
-
|
|
750
|
-
interface RequesterResponseInterface<T> {
|
|
751
|
-
json: () => Promise<T>;
|
|
752
|
-
}
|
|
753
|
-
interface ResponseSuccess {
|
|
754
|
-
success: boolean;
|
|
755
|
-
}
|
|
756
|
-
interface ResponseData<T> {
|
|
757
|
-
data: T;
|
|
758
|
-
}
|
|
759
|
-
interface ResponsePagination<T> {
|
|
760
|
-
data: T[];
|
|
761
|
-
paging: Paging;
|
|
762
|
-
}
|
|
763
|
-
interface Paging {
|
|
764
|
-
cursors: {
|
|
765
|
-
before: string;
|
|
766
|
-
after: string;
|
|
767
|
-
};
|
|
768
|
-
next: string;
|
|
769
|
-
}
|
|
770
|
-
declare class RequesterClass {
|
|
771
|
-
constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
|
|
772
|
-
sendRequest: (method: HttpMethodsEnum, path: string, timeout: number, body?: GeneralRequestBody, contentType?: string, additionalHeaders?: Record<string, string>) => Promise<RequesterResponseInterface<unknown>>;
|
|
773
|
-
getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: GeneralRequestBody, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
774
|
-
sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
775
|
-
sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
776
|
-
}
|
|
777
|
-
//#endregion
|
|
778
|
-
//#region src/types/httpsClient.d.ts
|
|
779
|
-
type ResponseHeaderValue = string | string[] | undefined;
|
|
780
|
-
type ResponseHeaders = Record<string, ResponseHeaderValue>;
|
|
781
|
-
type ResponseJSONBody = Record<string, unknown>;
|
|
782
|
-
declare class HttpsClientResponseClass {
|
|
783
|
-
constructor(resp: Response);
|
|
784
|
-
statusCode: () => number;
|
|
785
|
-
headers: () => ResponseHeaders;
|
|
786
|
-
rawResponse: () => Response;
|
|
787
|
-
json: () => Promise<ResponseJSONBody>;
|
|
788
|
-
}
|
|
789
|
-
declare class HttpsClientClass {
|
|
790
|
-
constructor();
|
|
791
|
-
clearSockets: () => boolean;
|
|
792
|
-
sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
|
|
793
|
-
}
|
|
794
|
-
//#endregion
|
|
795
|
-
//#region src/types/base.d.ts
|
|
796
|
-
declare class BaseClass {
|
|
797
|
-
constructor(config: WabaConfigType);
|
|
798
|
-
}
|
|
799
|
-
declare class BaseAPI implements BaseClass {
|
|
800
|
-
protected config: WabaConfigType;
|
|
801
|
-
protected client: RequesterClass;
|
|
802
|
-
constructor(config: WabaConfigType, client: RequesterClass);
|
|
803
|
-
protected sendJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
|
|
804
|
-
protected sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
|
|
805
|
-
protected sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
|
|
806
|
-
}
|
|
807
|
-
//#endregion
|
|
808
|
-
//#region src/api/profile/types/upload.d.ts
|
|
809
|
-
/**
|
|
810
|
-
* Upload session information for creating upload sessions.
|
|
811
|
-
*/
|
|
812
|
-
interface UploadSession {
|
|
813
|
-
id: string;
|
|
814
|
-
video?: boolean;
|
|
815
|
-
}
|
|
816
|
-
/**
|
|
817
|
-
* Response from creating an upload session.
|
|
818
|
-
*/
|
|
819
|
-
interface UploadSessionResponse {
|
|
820
|
-
id: string;
|
|
821
|
-
}
|
|
822
|
-
/**
|
|
823
|
-
* Response from uploading business profile media.
|
|
824
|
-
*/
|
|
825
|
-
interface UploadBusinessProfileResponse {
|
|
826
|
-
h: string;
|
|
827
|
-
}
|
|
828
|
-
/**
|
|
829
|
-
* Upload handle information containing file details and handle.
|
|
830
|
-
*/
|
|
831
|
-
interface UploadHandle {
|
|
832
|
-
handle: string;
|
|
833
|
-
file_size: number;
|
|
834
|
-
upload_result: {
|
|
835
|
-
handle_type: string;
|
|
836
|
-
name: string;
|
|
837
|
-
};
|
|
838
|
-
}
|
|
839
|
-
/**
|
|
840
|
-
* Request parameters for creating upload session.
|
|
841
|
-
*/
|
|
842
|
-
interface CreateUploadSessionParams {
|
|
748
|
+
//#region src/core/webhook/types.d.ts
|
|
749
|
+
interface WebhookContact {
|
|
843
750
|
/**
|
|
844
|
-
*
|
|
751
|
+
* WhatsApp ID of the contact. Business can respond to this contact using this ID.
|
|
845
752
|
*/
|
|
846
|
-
|
|
753
|
+
wa_id: string;
|
|
847
754
|
/**
|
|
848
|
-
*
|
|
755
|
+
* Additional unique, alphanumeric identifier for a WhatsApp user
|
|
849
756
|
*/
|
|
850
|
-
|
|
757
|
+
user_id?: string;
|
|
851
758
|
/**
|
|
852
|
-
*
|
|
759
|
+
* Profile of Whatsapp user
|
|
853
760
|
*/
|
|
854
|
-
|
|
761
|
+
profile: {
|
|
762
|
+
/**
|
|
763
|
+
* The display name of the contact
|
|
764
|
+
*/
|
|
765
|
+
name: string;
|
|
766
|
+
};
|
|
855
767
|
}
|
|
856
768
|
/**
|
|
857
|
-
*
|
|
769
|
+
* Base message interface with common properties
|
|
858
770
|
*/
|
|
859
|
-
interface
|
|
771
|
+
interface BaseMessage {
|
|
772
|
+
id: string;
|
|
773
|
+
from: string;
|
|
774
|
+
timestamp: string;
|
|
775
|
+
type: MessageTypesEnum;
|
|
860
776
|
/**
|
|
861
|
-
*
|
|
777
|
+
* Context object, included when a user replies or interacts
|
|
862
778
|
*/
|
|
863
|
-
|
|
779
|
+
context?: {
|
|
780
|
+
/**
|
|
781
|
+
* ID of the message
|
|
782
|
+
*/
|
|
783
|
+
id?: string;
|
|
784
|
+
/**
|
|
785
|
+
* ID of the sender
|
|
786
|
+
*/
|
|
787
|
+
from?: string;
|
|
788
|
+
/**
|
|
789
|
+
* ID of the message being replied to or interacted with
|
|
790
|
+
*/
|
|
791
|
+
message_id: string;
|
|
792
|
+
/**
|
|
793
|
+
* ID of the forwarded message, if applicable
|
|
794
|
+
*/
|
|
795
|
+
forwarded?: boolean;
|
|
796
|
+
/**
|
|
797
|
+
* Frequently forwarded status
|
|
798
|
+
*/
|
|
799
|
+
frequently_forwarded?: boolean;
|
|
800
|
+
/**
|
|
801
|
+
* Original message information if the message was referred
|
|
802
|
+
*/
|
|
803
|
+
referred_product?: {
|
|
804
|
+
/**
|
|
805
|
+
* Catalog ID
|
|
806
|
+
*/
|
|
807
|
+
catalog_id: string;
|
|
808
|
+
/**
|
|
809
|
+
* Product ID
|
|
810
|
+
*/
|
|
811
|
+
product_retailer_id: string;
|
|
812
|
+
};
|
|
813
|
+
};
|
|
864
814
|
/**
|
|
865
|
-
*
|
|
815
|
+
* Errors array, if the message had errors
|
|
866
816
|
*/
|
|
867
|
-
|
|
817
|
+
errors?: Array<{
|
|
818
|
+
/**
|
|
819
|
+
* Error code
|
|
820
|
+
*/
|
|
821
|
+
code: number;
|
|
822
|
+
/**
|
|
823
|
+
* Error title
|
|
824
|
+
*/
|
|
825
|
+
title: string;
|
|
826
|
+
/**
|
|
827
|
+
* Error message
|
|
828
|
+
*/
|
|
829
|
+
message: string;
|
|
830
|
+
/**
|
|
831
|
+
* Error details object
|
|
832
|
+
*/
|
|
833
|
+
error_data?: {
|
|
834
|
+
/**
|
|
835
|
+
* Describes the error details
|
|
836
|
+
*/
|
|
837
|
+
details: string;
|
|
838
|
+
};
|
|
839
|
+
}>;
|
|
868
840
|
}
|
|
869
841
|
/**
|
|
870
|
-
*
|
|
842
|
+
* Text message interface
|
|
871
843
|
*/
|
|
872
|
-
interface
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
844
|
+
interface TextMessage extends BaseMessage {
|
|
845
|
+
type: MessageTypesEnum.Text;
|
|
846
|
+
text: {
|
|
847
|
+
/**
|
|
848
|
+
* The text content of the message
|
|
849
|
+
*/
|
|
850
|
+
body: string;
|
|
851
|
+
preview_url?: boolean;
|
|
852
|
+
};
|
|
877
853
|
}
|
|
878
|
-
//#endregion
|
|
879
|
-
//#region src/api/profile/types/common.d.ts
|
|
880
854
|
/**
|
|
881
|
-
*
|
|
855
|
+
* Image message interface
|
|
882
856
|
*/
|
|
883
|
-
|
|
884
|
-
type
|
|
857
|
+
interface ImageMessage extends BaseMessage {
|
|
858
|
+
type: MessageTypesEnum.Image;
|
|
859
|
+
image: {
|
|
860
|
+
/**
|
|
861
|
+
* The image caption (if provided)
|
|
862
|
+
*/
|
|
863
|
+
caption?: string;
|
|
864
|
+
/**
|
|
865
|
+
* The SHA256 hash of the image
|
|
866
|
+
*/
|
|
867
|
+
sha256?: string;
|
|
868
|
+
/**
|
|
869
|
+
* The ID for the image
|
|
870
|
+
*/
|
|
871
|
+
id: string;
|
|
872
|
+
/**
|
|
873
|
+
* The MIME type of the image
|
|
874
|
+
*/
|
|
875
|
+
mime_type: string;
|
|
876
|
+
};
|
|
877
|
+
}
|
|
885
878
|
/**
|
|
886
|
-
*
|
|
879
|
+
* Video message interface
|
|
887
880
|
*/
|
|
888
|
-
interface
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
881
|
+
interface VideoMessage extends BaseMessage {
|
|
882
|
+
type: MessageTypesEnum.Video;
|
|
883
|
+
video: {
|
|
884
|
+
/**
|
|
885
|
+
* The video caption (if provided)
|
|
886
|
+
*/
|
|
887
|
+
caption?: string;
|
|
888
|
+
/**
|
|
889
|
+
* The SHA256 hash of the video
|
|
890
|
+
*/
|
|
891
|
+
sha256?: string;
|
|
892
|
+
/**
|
|
893
|
+
* The ID for the video
|
|
894
|
+
*/
|
|
895
|
+
id: string;
|
|
896
|
+
/**
|
|
897
|
+
* The MIME type of the video
|
|
898
|
+
*/
|
|
899
|
+
mime_type: string;
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Audio message interface
|
|
904
|
+
*/
|
|
905
|
+
interface AudioMessage extends BaseMessage {
|
|
906
|
+
type: MessageTypesEnum.Audio;
|
|
907
|
+
audio: {
|
|
908
|
+
/**
|
|
909
|
+
* The ID for the audio file
|
|
910
|
+
*/
|
|
911
|
+
id: string;
|
|
912
|
+
/**
|
|
913
|
+
* The MIME type of the audio file
|
|
914
|
+
*/
|
|
915
|
+
mime_type: string;
|
|
916
|
+
/**
|
|
917
|
+
* Whether the audio is a voice message
|
|
918
|
+
*/
|
|
919
|
+
voice?: boolean;
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Document message interface
|
|
924
|
+
*/
|
|
925
|
+
interface DocumentMessage extends BaseMessage {
|
|
926
|
+
type: MessageTypesEnum.Document;
|
|
927
|
+
document: {
|
|
928
|
+
/**
|
|
929
|
+
* The document caption (if provided)
|
|
930
|
+
*/
|
|
931
|
+
caption?: string;
|
|
932
|
+
/**
|
|
933
|
+
* The document filename
|
|
934
|
+
*/
|
|
935
|
+
filename: string;
|
|
936
|
+
/**
|
|
937
|
+
* The SHA256 hash of the document
|
|
938
|
+
*/
|
|
939
|
+
sha256?: string;
|
|
940
|
+
/**
|
|
941
|
+
* The ID for the document
|
|
942
|
+
*/
|
|
943
|
+
id: string;
|
|
944
|
+
/**
|
|
945
|
+
* The MIME type of the document
|
|
946
|
+
*/
|
|
947
|
+
mime_type: string;
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* Sticker message interface
|
|
952
|
+
*/
|
|
953
|
+
interface StickerMessage extends BaseMessage {
|
|
954
|
+
type: MessageTypesEnum.Sticker;
|
|
955
|
+
sticker: {
|
|
956
|
+
/**
|
|
957
|
+
* The ID for the sticker
|
|
958
|
+
*/
|
|
959
|
+
id: string;
|
|
960
|
+
/**
|
|
961
|
+
* Whether this is an animated sticker
|
|
962
|
+
*/
|
|
963
|
+
animated: boolean;
|
|
964
|
+
/**
|
|
965
|
+
* The MIME type of the sticker
|
|
966
|
+
*/
|
|
967
|
+
mime_type: string;
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Reaction message interface
|
|
972
|
+
*/
|
|
973
|
+
interface ReactionMessage extends BaseMessage {
|
|
974
|
+
type: MessageTypesEnum.Reaction;
|
|
975
|
+
reaction: {
|
|
976
|
+
/**
|
|
977
|
+
* The ID of the message being reacted to
|
|
978
|
+
*/
|
|
979
|
+
message_id: string;
|
|
980
|
+
/**
|
|
981
|
+
* Emoji used for the reaction
|
|
982
|
+
*/
|
|
983
|
+
emoji: string;
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Contacts message interface
|
|
988
|
+
*/
|
|
989
|
+
interface ContactsMessage extends BaseMessage {
|
|
990
|
+
type: MessageTypesEnum.Contacts;
|
|
991
|
+
contacts: Array<{
|
|
992
|
+
/**
|
|
993
|
+
* The contact's name
|
|
994
|
+
*/
|
|
995
|
+
name: {
|
|
996
|
+
/**
|
|
997
|
+
* The formatted name
|
|
998
|
+
*/
|
|
999
|
+
formatted_name: string;
|
|
1000
|
+
/**
|
|
1001
|
+
* The first name
|
|
1002
|
+
*/
|
|
1003
|
+
first_name?: string;
|
|
1004
|
+
/**
|
|
1005
|
+
* The last name
|
|
1006
|
+
*/
|
|
1007
|
+
last_name?: string;
|
|
1008
|
+
/**
|
|
1009
|
+
* The middle name
|
|
1010
|
+
*/
|
|
1011
|
+
middle_name?: string;
|
|
1012
|
+
/**
|
|
1013
|
+
* The suffix
|
|
1014
|
+
*/
|
|
1015
|
+
suffix?: string;
|
|
1016
|
+
/**
|
|
1017
|
+
* The prefix
|
|
1018
|
+
*/
|
|
1019
|
+
prefix?: string;
|
|
1020
|
+
};
|
|
1021
|
+
/**
|
|
1022
|
+
* The contact's phone numbers
|
|
1023
|
+
*/
|
|
1024
|
+
phones?: Array<{
|
|
1025
|
+
phone: string;
|
|
1026
|
+
type?: string;
|
|
1027
|
+
wa_id?: string;
|
|
1028
|
+
}>;
|
|
1029
|
+
/**
|
|
1030
|
+
* The contact's emails
|
|
1031
|
+
*/
|
|
1032
|
+
emails?: Array<{
|
|
1033
|
+
email: string;
|
|
1034
|
+
type?: string;
|
|
1035
|
+
}>;
|
|
1036
|
+
/**
|
|
1037
|
+
* The contact's addresses
|
|
1038
|
+
*/
|
|
1039
|
+
addresses?: Array<{
|
|
1040
|
+
street?: string;
|
|
1041
|
+
city?: string;
|
|
1042
|
+
state?: string;
|
|
1043
|
+
zip?: string;
|
|
1044
|
+
country?: string;
|
|
1045
|
+
country_code?: string;
|
|
1046
|
+
type?: string;
|
|
1047
|
+
}>;
|
|
1048
|
+
/**
|
|
1049
|
+
* The contact's organizations
|
|
1050
|
+
*/
|
|
1051
|
+
org?: {
|
|
1052
|
+
company?: string;
|
|
1053
|
+
department?: string;
|
|
1054
|
+
title?: string;
|
|
1055
|
+
};
|
|
1056
|
+
/**
|
|
1057
|
+
* The contact's URLs
|
|
1058
|
+
*/
|
|
1059
|
+
urls?: Array<{
|
|
1060
|
+
url: string;
|
|
1061
|
+
type?: string;
|
|
1062
|
+
}>;
|
|
1063
|
+
/**
|
|
1064
|
+
* The contact's birthday (YYYY-MM-DD format)
|
|
1065
|
+
*/
|
|
1066
|
+
birthday?: string;
|
|
1067
|
+
}>;
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Location message interface
|
|
1071
|
+
*/
|
|
1072
|
+
interface LocationMessage extends BaseMessage {
|
|
1073
|
+
type: MessageTypesEnum.Location;
|
|
1074
|
+
location: {
|
|
1075
|
+
/**
|
|
1076
|
+
* Latitude of the location
|
|
1077
|
+
*/
|
|
1078
|
+
latitude: number;
|
|
1079
|
+
/**
|
|
1080
|
+
* Longitude of the location
|
|
1081
|
+
*/
|
|
1082
|
+
longitude: number;
|
|
1083
|
+
/**
|
|
1084
|
+
* Name of the location
|
|
1085
|
+
*/
|
|
1086
|
+
name?: string;
|
|
1087
|
+
/**
|
|
1088
|
+
* Address of the location
|
|
1089
|
+
*/
|
|
1090
|
+
address?: string;
|
|
1091
|
+
};
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* Interactive message interface
|
|
1095
|
+
*/
|
|
1096
|
+
interface InteractiveMessage extends BaseMessage {
|
|
1097
|
+
type: MessageTypesEnum.Interactive;
|
|
1098
|
+
interactive: {
|
|
1099
|
+
/**
|
|
1100
|
+
* Type of the interactive message
|
|
1101
|
+
* Can be: button_reply, list_reply, flow, nfm_reply, etc.
|
|
1102
|
+
*/
|
|
1103
|
+
type: string;
|
|
1104
|
+
/**
|
|
1105
|
+
* ID for the button that was clicked
|
|
1106
|
+
*/
|
|
1107
|
+
button_reply?: {
|
|
1108
|
+
id: string;
|
|
1109
|
+
title: string;
|
|
1110
|
+
};
|
|
1111
|
+
/**
|
|
1112
|
+
* ID for the list item that was selected
|
|
1113
|
+
*/
|
|
1114
|
+
list_reply?: {
|
|
1115
|
+
id: string;
|
|
1116
|
+
title: string;
|
|
1117
|
+
description?: string;
|
|
1118
|
+
};
|
|
1119
|
+
/**
|
|
1120
|
+
* NFM (No-Code Flow Message) reply data
|
|
1121
|
+
*/
|
|
1122
|
+
nfm_reply?: {
|
|
1123
|
+
/**
|
|
1124
|
+
* Response data in JSON format
|
|
1125
|
+
*/
|
|
1126
|
+
response_json: string;
|
|
1127
|
+
/**
|
|
1128
|
+
* Body text of the reply
|
|
1129
|
+
*/
|
|
1130
|
+
body: string;
|
|
1131
|
+
/**
|
|
1132
|
+
* Name of the flow
|
|
1133
|
+
*/
|
|
1134
|
+
name: string;
|
|
1135
|
+
};
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* System message interface
|
|
1140
|
+
*/
|
|
1141
|
+
interface SystemMessage extends BaseMessage {
|
|
1142
|
+
type: MessageTypesEnum.System;
|
|
1143
|
+
system: {
|
|
1144
|
+
/**
|
|
1145
|
+
* The type of system update
|
|
1146
|
+
*/
|
|
1147
|
+
type: string;
|
|
1148
|
+
/**
|
|
1149
|
+
* User's identity if the update is a customer identity change
|
|
1150
|
+
*/
|
|
1151
|
+
identity?: string;
|
|
1152
|
+
/**
|
|
1153
|
+
* Old and new phone numbers if the update is a phone number change
|
|
1154
|
+
*/
|
|
1155
|
+
customer?: {
|
|
1156
|
+
/**
|
|
1157
|
+
* The previous phone number
|
|
1158
|
+
*/
|
|
1159
|
+
previous_wa_id: string;
|
|
1160
|
+
/**
|
|
1161
|
+
* The new phone number
|
|
1162
|
+
*/
|
|
1163
|
+
wa_id: string;
|
|
1164
|
+
};
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Order message interface
|
|
1169
|
+
*/
|
|
1170
|
+
interface OrderMessage extends BaseMessage {
|
|
1171
|
+
type: MessageTypesEnum.Order;
|
|
1172
|
+
order: {
|
|
1173
|
+
/**
|
|
1174
|
+
* Catalog ID
|
|
1175
|
+
*/
|
|
1176
|
+
catalog_id: string;
|
|
1177
|
+
/**
|
|
1178
|
+
* Product items in the order
|
|
1179
|
+
*/
|
|
1180
|
+
product_items: Array<{
|
|
1181
|
+
/**
|
|
1182
|
+
* Product ID
|
|
1183
|
+
*/
|
|
1184
|
+
product_retailer_id: string;
|
|
1185
|
+
/**
|
|
1186
|
+
* Quantity of the product
|
|
1187
|
+
*/
|
|
1188
|
+
quantity: number;
|
|
1189
|
+
/**
|
|
1190
|
+
* Item price
|
|
1191
|
+
*/
|
|
1192
|
+
item_price: number;
|
|
1193
|
+
/**
|
|
1194
|
+
* Currency code
|
|
1195
|
+
*/
|
|
1196
|
+
currency: string;
|
|
1197
|
+
}>;
|
|
1198
|
+
/**
|
|
1199
|
+
* Text message included with the order
|
|
1200
|
+
*/
|
|
1201
|
+
text?: string;
|
|
1202
|
+
};
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* Button message interface
|
|
1206
|
+
*/
|
|
1207
|
+
interface ButtonMessage extends BaseMessage {
|
|
1208
|
+
type: MessageTypesEnum.Button;
|
|
1209
|
+
button: {
|
|
1210
|
+
/**
|
|
1211
|
+
* The payload for the button
|
|
1212
|
+
*/
|
|
1213
|
+
payload: string;
|
|
1214
|
+
/**
|
|
1215
|
+
* Button text
|
|
1216
|
+
*/
|
|
1217
|
+
text: string;
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Represents a message received through the webhook
|
|
1222
|
+
* Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
|
|
1223
|
+
*/
|
|
1224
|
+
interface WebhookMessage {
|
|
1225
|
+
/**
|
|
1226
|
+
* The WhatsApp Business Account ID
|
|
1227
|
+
*/
|
|
1228
|
+
wabaId: string;
|
|
1229
|
+
/**
|
|
1230
|
+
* The message ID
|
|
1231
|
+
*/
|
|
1232
|
+
id: string;
|
|
1233
|
+
/**
|
|
1234
|
+
* The sender's phone number
|
|
1235
|
+
*/
|
|
1236
|
+
from: string;
|
|
1237
|
+
/**
|
|
1238
|
+
* The timestamp of the message
|
|
1239
|
+
*/
|
|
1240
|
+
timestamp: string;
|
|
1241
|
+
/**
|
|
1242
|
+
* The type of message (text, image, etc.)
|
|
1243
|
+
*/
|
|
1244
|
+
type: MessageTypesEnum;
|
|
1245
|
+
/**
|
|
1246
|
+
* The phone number ID that received the message
|
|
1247
|
+
*/
|
|
1248
|
+
phoneNumberId: string;
|
|
1249
|
+
/**
|
|
1250
|
+
* The display phone number that received the message
|
|
1251
|
+
*/
|
|
1252
|
+
displayPhoneNumber: string;
|
|
1253
|
+
/**
|
|
1254
|
+
* The profile name of the sender
|
|
1255
|
+
*/
|
|
1256
|
+
profileName: string;
|
|
1257
|
+
text?: TextMessage['text'];
|
|
1258
|
+
image?: ImageMessage['image'];
|
|
1259
|
+
video?: VideoMessage['video'];
|
|
1260
|
+
audio?: AudioMessage['audio'];
|
|
1261
|
+
document?: DocumentMessage['document'];
|
|
1262
|
+
sticker?: StickerMessage['sticker'];
|
|
1263
|
+
location?: LocationMessage['location'];
|
|
1264
|
+
contacts?: ContactsMessage['contacts'];
|
|
1265
|
+
interactive?: InteractiveMessage['interactive'];
|
|
1266
|
+
button?: ButtonMessage['button'];
|
|
1267
|
+
order?: OrderMessage['order'];
|
|
1268
|
+
system?: SystemMessage['system'];
|
|
1269
|
+
reaction?: ReactionMessage['reaction'];
|
|
1270
|
+
statuses?: {
|
|
1271
|
+
/**
|
|
1272
|
+
* Arbitrary string included in sent message
|
|
1273
|
+
*/
|
|
1274
|
+
biz_opaque_callback_data?: string;
|
|
1275
|
+
/**
|
|
1276
|
+
* Information about the conversation
|
|
1277
|
+
*/
|
|
1278
|
+
conversation?: {
|
|
1279
|
+
/**
|
|
1280
|
+
* Represents the ID of the conversation the given status notification belongs to
|
|
1281
|
+
*/
|
|
1282
|
+
id: string;
|
|
1283
|
+
/**
|
|
1284
|
+
* Describes conversation category
|
|
1285
|
+
*/
|
|
1286
|
+
origin: {
|
|
1287
|
+
/**
|
|
1288
|
+
* Indicates conversation category. This can also be referred to as a conversation entry point
|
|
1289
|
+
* - authentication: Conversation opened by business sending template categorized as AUTHENTICATION
|
|
1290
|
+
* - marketing: Conversation opened by business sending template categorized as MARKETING
|
|
1291
|
+
* - utility: Conversation opened by business sending template categorized as UTILITY
|
|
1292
|
+
* - service: Conversation opened by business replying to customer within service window
|
|
1293
|
+
* - referral_conversion: Free entry point conversation
|
|
1294
|
+
*/
|
|
1295
|
+
type: 'authentication' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
|
|
1296
|
+
};
|
|
1297
|
+
/**
|
|
1298
|
+
* Date when the conversation expires. Only present for messages with status 'sent'
|
|
1299
|
+
*/
|
|
1300
|
+
expiration_timestamp?: string;
|
|
1301
|
+
};
|
|
1302
|
+
/**
|
|
1303
|
+
* Array of error objects describing the error
|
|
1304
|
+
*/
|
|
1305
|
+
errors?: Array<{
|
|
1306
|
+
/**
|
|
1307
|
+
* Error code
|
|
1308
|
+
*/
|
|
1309
|
+
code: number;
|
|
1310
|
+
/**
|
|
1311
|
+
* Error code title
|
|
1312
|
+
*/
|
|
1313
|
+
title: string;
|
|
1314
|
+
/**
|
|
1315
|
+
* Error code message
|
|
1316
|
+
*/
|
|
1317
|
+
message: string;
|
|
1318
|
+
/**
|
|
1319
|
+
* Error details object
|
|
1320
|
+
*/
|
|
1321
|
+
error_data?: {
|
|
1322
|
+
/**
|
|
1323
|
+
* Describes the error details
|
|
1324
|
+
*/
|
|
1325
|
+
details: string;
|
|
1326
|
+
};
|
|
1327
|
+
}>;
|
|
1328
|
+
/**
|
|
1329
|
+
* The ID for the message that the business sent to a customer
|
|
1330
|
+
*/
|
|
1331
|
+
id: string;
|
|
1332
|
+
/**
|
|
1333
|
+
* Pricing information for the message/conversation
|
|
1334
|
+
*/
|
|
1335
|
+
pricing?: {
|
|
1336
|
+
/**
|
|
1337
|
+
* Indicates if the given message or conversation is billable
|
|
1338
|
+
* @deprecated This field is deprecated. Visit the WhatsApp Changelog for more information.
|
|
1339
|
+
*/
|
|
1340
|
+
billable?: boolean;
|
|
1341
|
+
/**
|
|
1342
|
+
* Indicates the conversation category:
|
|
1343
|
+
* - authentication: Authentication conversation
|
|
1344
|
+
* - authentication_international: Authentication-international conversation
|
|
1345
|
+
* - marketing: Marketing conversation
|
|
1346
|
+
* - utility: Utility conversation
|
|
1347
|
+
* - service: Service conversation
|
|
1348
|
+
* - referral_conversion: Free entry point conversation
|
|
1349
|
+
*/
|
|
1350
|
+
category: 'authentication' | 'authentication_international' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
|
|
1351
|
+
/**
|
|
1352
|
+
* Type of pricing model used by the business. Current supported value is CBP
|
|
1353
|
+
*/
|
|
1354
|
+
pricing_model: 'CBP';
|
|
1355
|
+
};
|
|
1356
|
+
/**
|
|
1357
|
+
* The customer's WhatsApp ID. Business can respond to customer using this ID.
|
|
1358
|
+
* This ID may not match the customer's phone number.
|
|
1359
|
+
*/
|
|
1360
|
+
recipient_id: string;
|
|
1361
|
+
/**
|
|
1362
|
+
* Status of the message:
|
|
1363
|
+
* - delivered: Message has been delivered
|
|
1364
|
+
* - read: Message has been read by the customer
|
|
1365
|
+
* - sent: Message has been sent to the customer
|
|
1366
|
+
*/
|
|
1367
|
+
status: 'delivered' | 'read' | 'sent';
|
|
1368
|
+
/**
|
|
1369
|
+
* Unix timestamp for the status message
|
|
1370
|
+
*/
|
|
1371
|
+
timestamp: string;
|
|
1372
|
+
};
|
|
1373
|
+
/**
|
|
1374
|
+
* The original message data as received from the webhook
|
|
1375
|
+
*/
|
|
1376
|
+
originalData: any;
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Webhook event received from WhatsApp
|
|
1380
|
+
*/
|
|
1381
|
+
interface WebhookEvent {
|
|
1382
|
+
/**
|
|
1383
|
+
* The field type of the event
|
|
1384
|
+
*/
|
|
1385
|
+
field: string;
|
|
1386
|
+
/**
|
|
1387
|
+
* The event data
|
|
1388
|
+
*/
|
|
1389
|
+
value: any;
|
|
1390
|
+
/**
|
|
1391
|
+
* The timestamp when the event was received
|
|
1392
|
+
*/
|
|
1393
|
+
timestamp: number;
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Message status enum
|
|
1397
|
+
*/
|
|
1398
|
+
declare enum MessageStatus {
|
|
1399
|
+
DELIVERED = "delivered",
|
|
1400
|
+
READ = "read",
|
|
1401
|
+
SENT = "sent",
|
|
1402
|
+
}
|
|
1403
|
+
//#endregion
|
|
1404
|
+
//#region src/types/request.d.ts
|
|
1405
|
+
type GeneralRequestBody = Record<string, unknown>;
|
|
1406
|
+
interface RequesterResponseInterface<T> {
|
|
1407
|
+
json: () => Promise<T>;
|
|
1408
|
+
}
|
|
1409
|
+
interface ResponseSuccess {
|
|
1410
|
+
success: boolean;
|
|
1411
|
+
}
|
|
1412
|
+
interface ResponseData<T> {
|
|
1413
|
+
data: T;
|
|
1414
|
+
}
|
|
1415
|
+
interface ResponsePagination<T> {
|
|
1416
|
+
data: T[];
|
|
1417
|
+
paging: Paging;
|
|
1418
|
+
}
|
|
1419
|
+
interface Paging {
|
|
1420
|
+
cursors: {
|
|
1421
|
+
before: string;
|
|
1422
|
+
after: string;
|
|
1423
|
+
};
|
|
1424
|
+
next: string;
|
|
1425
|
+
}
|
|
1426
|
+
declare class RequesterClass {
|
|
1427
|
+
constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
|
|
1428
|
+
sendRequest: (method: HttpMethodsEnum, path: string, timeout: number, body?: GeneralRequestBody, contentType?: string, additionalHeaders?: Record<string, string>) => Promise<RequesterResponseInterface<unknown>>;
|
|
1429
|
+
getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: GeneralRequestBody, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
1430
|
+
sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
1431
|
+
sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
|
|
1432
|
+
}
|
|
1433
|
+
//#endregion
|
|
1434
|
+
//#region src/types/httpsClient.d.ts
|
|
1435
|
+
type ResponseHeaderValue = string | string[] | undefined;
|
|
1436
|
+
type ResponseHeaders = Record<string, ResponseHeaderValue>;
|
|
1437
|
+
type ResponseJSONBody = Record<string, unknown>;
|
|
1438
|
+
declare class HttpsClientResponseClass {
|
|
1439
|
+
constructor(resp: Response);
|
|
1440
|
+
statusCode: () => number;
|
|
1441
|
+
headers: () => ResponseHeaders;
|
|
1442
|
+
rawResponse: () => Response;
|
|
1443
|
+
json: () => Promise<ResponseJSONBody>;
|
|
1444
|
+
}
|
|
1445
|
+
declare class HttpsClientClass {
|
|
1446
|
+
constructor();
|
|
1447
|
+
clearSockets: () => boolean;
|
|
1448
|
+
sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
|
|
1449
|
+
}
|
|
1450
|
+
//#endregion
|
|
1451
|
+
//#region src/types/base.d.ts
|
|
1452
|
+
declare class BaseClass {
|
|
1453
|
+
constructor(config: WabaConfigType);
|
|
1454
|
+
}
|
|
1455
|
+
declare class BaseAPI implements BaseClass {
|
|
1456
|
+
protected config: WabaConfigType;
|
|
1457
|
+
protected client: RequesterClass;
|
|
1458
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
1459
|
+
protected sendJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
|
|
1460
|
+
protected sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
|
|
1461
|
+
protected sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
|
|
1462
|
+
}
|
|
1463
|
+
//#endregion
|
|
1464
|
+
//#region src/api/profile/types/upload.d.ts
|
|
1465
|
+
/**
|
|
1466
|
+
* Upload session information for creating upload sessions.
|
|
1467
|
+
*/
|
|
1468
|
+
interface UploadSession {
|
|
1469
|
+
id: string;
|
|
1470
|
+
video?: boolean;
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* Response from creating an upload session.
|
|
1474
|
+
*/
|
|
1475
|
+
interface UploadSessionResponse {
|
|
1476
|
+
id: string;
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Response from uploading business profile media.
|
|
1480
|
+
*/
|
|
1481
|
+
interface UploadBusinessProfileResponse {
|
|
1482
|
+
h: string;
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* Upload handle information containing file details and handle.
|
|
1486
|
+
*/
|
|
1487
|
+
interface UploadHandle {
|
|
1488
|
+
handle: string;
|
|
1489
|
+
file_size: number;
|
|
1490
|
+
upload_result: {
|
|
1491
|
+
handle_type: string;
|
|
1492
|
+
name: string;
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
/**
|
|
1496
|
+
* Request parameters for creating upload session.
|
|
1497
|
+
*/
|
|
1498
|
+
interface CreateUploadSessionParams {
|
|
1499
|
+
/**
|
|
1500
|
+
* Length of the file to be uploaded in bytes.
|
|
1501
|
+
*/
|
|
1502
|
+
fileLength: number;
|
|
1503
|
+
/**
|
|
1504
|
+
* MIME type of the file (e.g., 'image/jpeg').
|
|
1505
|
+
*/
|
|
1506
|
+
fileType: string;
|
|
1507
|
+
/**
|
|
1508
|
+
* Name of the file with extension.
|
|
1509
|
+
*/
|
|
1510
|
+
fileName: string;
|
|
1511
|
+
}
|
|
1512
|
+
/**
|
|
1513
|
+
* Request parameters for uploading media.
|
|
1514
|
+
*/
|
|
1515
|
+
interface UploadMediaParams {
|
|
1516
|
+
/**
|
|
1517
|
+
* The upload session ID from createUploadSession response.
|
|
1518
|
+
*/
|
|
1519
|
+
uploadId: string;
|
|
1520
|
+
/**
|
|
1521
|
+
* The binary data of the file (Buffer).
|
|
1522
|
+
*/
|
|
1523
|
+
file: Buffer;
|
|
1524
|
+
}
|
|
1525
|
+
/**
|
|
1526
|
+
* Request parameters for getting upload handle.
|
|
1527
|
+
*/
|
|
1528
|
+
interface GetUploadHandleParams {
|
|
1529
|
+
/**
|
|
1530
|
+
* The upload session ID from createUploadSession response.
|
|
1531
|
+
*/
|
|
1532
|
+
uploadId: string;
|
|
1533
|
+
}
|
|
1534
|
+
//#endregion
|
|
1535
|
+
//#region src/api/profile/types/common.d.ts
|
|
1536
|
+
/**
|
|
1537
|
+
* Available fields that can be requested when retrieving a business profile.
|
|
1538
|
+
*/
|
|
1539
|
+
type BusinessProfileField = 'about' | 'address' | 'description' | 'email' | 'profile_picture_url' | 'websites' | 'vertical';
|
|
1540
|
+
type BusinessProfileFieldsParam = BusinessProfileField[] | string;
|
|
1541
|
+
/**
|
|
1542
|
+
* Business profile data structure containing all profile information.
|
|
1543
|
+
*/
|
|
1544
|
+
interface BusinessProfileData {
|
|
1545
|
+
/**
|
|
1546
|
+
* The business's About text. This text appears in the business's profile, beneath its profile image,
|
|
1547
|
+
* phone number, and contact buttons.
|
|
1548
|
+
* - String cannot be empty
|
|
1549
|
+
* - Strings must be between 1 and 139 characters
|
|
1550
|
+
* - Rendered emojis are supported however their unicode values are not.
|
|
1551
|
+
* Emoji unicode values must be Java- or JavaScript-escape encoded
|
|
1552
|
+
* - Hyperlinks can be included but will not render as clickable links
|
|
1553
|
+
* - Markdown is not supported
|
|
1554
|
+
*/
|
|
1555
|
+
about?: string;
|
|
1556
|
+
/**
|
|
1557
|
+
* Address of the business. Character limit 256.
|
|
1558
|
+
*/
|
|
1559
|
+
address?: string;
|
|
1560
|
+
/**
|
|
1561
|
+
* Description of the business. Character limit 512.
|
|
1562
|
+
*/
|
|
1563
|
+
description?: string;
|
|
1564
|
+
/**
|
|
1565
|
+
* The contact email address (in valid email format) of the business. Character limit 128.
|
|
1566
|
+
*/
|
|
1567
|
+
email?: string;
|
|
1568
|
+
/**
|
|
913
1569
|
* The messaging service used for the request. Always set it to "whatsapp" if you are using
|
|
914
1570
|
* the WhatsApp Business API.
|
|
915
1571
|
*/
|
|
@@ -1851,1056 +2507,381 @@ declare class MessagesClass extends BaseClass {
|
|
|
1851
2507
|
interactiveFlow(params: MessageRequestParams<InteractiveObject & {
|
|
1852
2508
|
type: InteractiveTypesEnum.Flow;
|
|
1853
2509
|
}>): 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';
|
|
1872
|
-
};
|
|
1873
|
-
type MediasResponse = {
|
|
1874
|
-
data: MediaResponse[];
|
|
1875
|
-
paging: {
|
|
1876
|
-
cursors: {
|
|
1877
|
-
before: string;
|
|
1878
|
-
after: string;
|
|
1879
|
-
};
|
|
1880
|
-
};
|
|
1881
|
-
};
|
|
1882
|
-
type UploadMediaResponse = {
|
|
1883
|
-
id: string;
|
|
1884
|
-
};
|
|
1885
|
-
interface MediaClass {
|
|
1886
|
-
getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
|
|
1887
|
-
uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
|
|
1888
|
-
deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
|
|
1889
|
-
downloadMedia(mediaUrl: string): Promise<Blob>;
|
|
1890
|
-
}
|
|
1891
|
-
//#endregion
|
|
1892
|
-
//#region src/api/flow/types/common.d.ts
|
|
1893
|
-
/**
|
|
1894
|
-
* Enum for Flow Status
|
|
1895
|
-
*/
|
|
1896
|
-
declare enum FlowStatusEnum {
|
|
1897
|
-
Draft = "DRAFT",
|
|
1898
|
-
Published = "PUBLISHED",
|
|
1899
|
-
Throttled = "THROTTLED",
|
|
1900
|
-
Blocked = "BLOCKED",
|
|
1901
|
-
Deprecated = "DEPRECATED",
|
|
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",
|
|
1915
|
-
}
|
|
1916
|
-
declare enum FlowActionEnum {
|
|
1917
|
-
INIT = "INIT",
|
|
1918
|
-
BACK = "BACK",
|
|
1919
|
-
DATA_EXCHANGE = "data_exchange",
|
|
1920
|
-
}
|
|
1921
|
-
/**
|
|
1922
|
-
* Enum for Flow Types in webhook handlers
|
|
1923
|
-
* Used to register handlers for specific flow events
|
|
1924
|
-
*/
|
|
1925
|
-
declare enum FlowTypeEnum {
|
|
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 = "*",
|
|
1934
|
-
}
|
|
1935
|
-
type FlowType = (typeof FlowTypeEnum)[keyof typeof FlowTypeEnum];
|
|
1936
|
-
/**
|
|
1937
|
-
* Flow Validation Error Pointer
|
|
1938
|
-
*/
|
|
1939
|
-
interface FlowValidationErrorPointer {
|
|
1940
|
-
line_start: number;
|
|
1941
|
-
line_end: number;
|
|
1942
|
-
column_start: number;
|
|
1943
|
-
column_end: number;
|
|
1944
|
-
path: string;
|
|
1945
|
-
}
|
|
1946
|
-
/**
|
|
1947
|
-
* Flow Validation Error
|
|
1948
|
-
*/
|
|
1949
|
-
interface FlowValidationError {
|
|
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[];
|
|
1958
|
-
}
|
|
1959
|
-
/**
|
|
1960
|
-
* Flow Item
|
|
1961
|
-
*/
|
|
1962
|
-
interface Flow {
|
|
1963
|
-
id: string;
|
|
1964
|
-
name: string;
|
|
1965
|
-
status: FlowStatusEnum;
|
|
1966
|
-
categories: FlowCategoryEnum[];
|
|
1967
|
-
validation_errors: FlowValidationError[];
|
|
1968
|
-
}
|
|
1969
|
-
/**
|
|
1970
|
-
* Pagination Cursors
|
|
1971
|
-
*/
|
|
1972
|
-
interface PaginationCursors {
|
|
1973
|
-
before: string;
|
|
1974
|
-
after: string;
|
|
1975
|
-
}
|
|
1976
|
-
/**
|
|
1977
|
-
* Pagination Object
|
|
1978
|
-
*/
|
|
1979
|
-
interface Pagination {
|
|
1980
|
-
cursors: PaginationCursors;
|
|
1981
|
-
}
|
|
1982
|
-
/**
|
|
1983
|
-
* Flows List Response
|
|
1984
|
-
*/
|
|
1985
|
-
interface FlowsListResponse {
|
|
1986
|
-
data: Flow[];
|
|
1987
|
-
paging: Pagination;
|
|
1988
|
-
}
|
|
1989
|
-
/**
|
|
1990
|
-
* Flow Asset
|
|
1991
|
-
*/
|
|
1992
|
-
interface FlowAsset {
|
|
1993
|
-
name: string;
|
|
1994
|
-
asset_type: string;
|
|
1995
|
-
download_url: string;
|
|
1996
|
-
}
|
|
1997
|
-
/**
|
|
1998
|
-
* Flow Assets Response
|
|
1999
|
-
*/
|
|
2000
|
-
interface FlowAssetsResponse {
|
|
2001
|
-
data: FlowAsset[];
|
|
2002
|
-
paging: Pagination;
|
|
2003
|
-
}
|
|
2004
|
-
/**
|
|
2005
|
-
* Flow Preview
|
|
2006
|
-
*/
|
|
2007
|
-
interface FlowPreview {
|
|
2008
|
-
preview_url: string;
|
|
2009
|
-
expires_at: string;
|
|
2010
|
-
}
|
|
2011
|
-
/**
|
|
2012
|
-
* Flow Preview Response
|
|
2013
|
-
*/
|
|
2014
|
-
interface FlowPreviewResponse {
|
|
2015
|
-
preview: FlowPreview;
|
|
2016
|
-
id: string;
|
|
2017
|
-
}
|
|
2018
|
-
/**
|
|
2019
|
-
* Flow Migration Result
|
|
2020
|
-
*/
|
|
2021
|
-
interface FlowMigrationResult {
|
|
2022
|
-
source_name: string;
|
|
2023
|
-
source_id: string;
|
|
2024
|
-
migrated_id: string;
|
|
2025
|
-
}
|
|
2026
|
-
/**
|
|
2027
|
-
* Flow Migration Failure
|
|
2028
|
-
*/
|
|
2029
|
-
interface FlowMigrationFailure {
|
|
2030
|
-
source_name: string;
|
|
2031
|
-
error_code: string;
|
|
2032
|
-
error_message: string;
|
|
2033
|
-
}
|
|
2034
|
-
/**
|
|
2035
|
-
* Create Flow Response
|
|
2036
|
-
*/
|
|
2037
|
-
interface CreateFlowResponse {
|
|
2038
|
-
id: string;
|
|
2039
|
-
success: boolean;
|
|
2040
|
-
validation_errors?: FlowValidationError[];
|
|
2041
|
-
}
|
|
2042
|
-
/**
|
|
2043
|
-
* Update Flow Response
|
|
2044
|
-
*/
|
|
2045
|
-
interface UpdateFlowResponse {
|
|
2046
|
-
success: boolean;
|
|
2047
|
-
validation_errors?: FlowValidationError[];
|
|
2048
|
-
}
|
|
2049
|
-
/**
|
|
2050
|
-
* Flow Migration Response
|
|
2051
|
-
*/
|
|
2052
|
-
interface FlowMigrationResponse {
|
|
2053
|
-
migrated_flows: FlowMigrationResult[];
|
|
2054
|
-
failed_flows: FlowMigrationFailure[];
|
|
2055
|
-
}
|
|
2056
|
-
/**
|
|
2057
|
-
* Validate Flow JSON Response
|
|
2058
|
-
*/
|
|
2059
|
-
interface ValidateFlowJsonResponse {
|
|
2060
|
-
valid: boolean;
|
|
2061
|
-
success: boolean;
|
|
2062
|
-
validation_errors?: FlowValidationError[];
|
|
2063
|
-
}
|
|
2064
|
-
/**
|
|
2065
|
-
* WhatsApp Flow Endpoint - Encrypted Request Payload
|
|
2066
|
-
* Represents the raw encrypted data received from WhatsApp
|
|
2067
|
-
*/
|
|
2068
|
-
|
|
2069
|
-
/**
|
|
2070
|
-
* WhatsApp Flow Endpoint - Health Check Response
|
|
2071
|
-
* The expected response structure for health check requests
|
|
2072
|
-
*/
|
|
2073
|
-
interface FlowHealthCheckResponse {
|
|
2074
|
-
data: {
|
|
2075
|
-
status: 'active';
|
|
2510
|
+
reaction(params: ReactionParams): Promise<MessagesResponse>;
|
|
2511
|
+
markAsRead(params: {
|
|
2512
|
+
messageId: string;
|
|
2513
|
+
}): Promise<MessagesResponse>;
|
|
2514
|
+
showTypingIndicator(params: {
|
|
2515
|
+
messageId: string;
|
|
2516
|
+
}): Promise<MessagesResponse>;
|
|
2517
|
+
status(params: StatusParams): Promise<MessagesResponse>;
|
|
2518
|
+
}
|
|
2519
|
+
//#endregion
|
|
2520
|
+
//#region src/api/media/types/common.d.ts
|
|
2521
|
+
type MediaResponse = {
|
|
2522
|
+
id: string;
|
|
2523
|
+
url: string;
|
|
2524
|
+
mime_type: string;
|
|
2525
|
+
sha256: string;
|
|
2526
|
+
file_size: number;
|
|
2527
|
+
messaging_product: 'whatsapp';
|
|
2528
|
+
};
|
|
2529
|
+
type MediasResponse = {
|
|
2530
|
+
data: MediaResponse[];
|
|
2531
|
+
paging: {
|
|
2532
|
+
cursors: {
|
|
2533
|
+
before: string;
|
|
2534
|
+
after: string;
|
|
2535
|
+
};
|
|
2076
2536
|
};
|
|
2537
|
+
};
|
|
2538
|
+
type UploadMediaResponse = {
|
|
2539
|
+
id: string;
|
|
2540
|
+
};
|
|
2541
|
+
interface MediaClass {
|
|
2542
|
+
getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
|
|
2543
|
+
uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
|
|
2544
|
+
deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
|
|
2545
|
+
downloadMedia(mediaUrl: string): Promise<Blob>;
|
|
2077
2546
|
}
|
|
2547
|
+
//#endregion
|
|
2548
|
+
//#region src/api/flow/types/common.d.ts
|
|
2078
2549
|
/**
|
|
2079
|
-
*
|
|
2080
|
-
* Represents the structure of a data exchange request
|
|
2081
|
-
*/
|
|
2082
|
-
|
|
2083
|
-
/**
|
|
2084
|
-
* WhatsApp Flow Endpoint - Data Exchange Response
|
|
2085
|
-
* The expected response structure for data exchange requests
|
|
2550
|
+
* Enum for Flow Status
|
|
2086
2551
|
*/
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2552
|
+
declare enum FlowStatusEnum {
|
|
2553
|
+
Draft = "DRAFT",
|
|
2554
|
+
Published = "PUBLISHED",
|
|
2555
|
+
Throttled = "THROTTLED",
|
|
2556
|
+
Blocked = "BLOCKED",
|
|
2557
|
+
Deprecated = "DEPRECATED",
|
|
2092
2558
|
}
|
|
2093
2559
|
/**
|
|
2094
|
-
*
|
|
2095
|
-
* The expected response structure for success screen requests
|
|
2560
|
+
* Enum for Flow Categories
|
|
2096
2561
|
*/
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2562
|
+
declare enum FlowCategoryEnum {
|
|
2563
|
+
SignUp = "SIGN_UP",
|
|
2564
|
+
SignIn = "SIGN_IN",
|
|
2565
|
+
AppointmentBooking = "APPOINTMENT_BOOKING",
|
|
2566
|
+
LeadGeneration = "LEAD_GENERATION",
|
|
2567
|
+
ContactUs = "CONTACT_US",
|
|
2568
|
+
CustomerSupport = "CUSTOMER_SUPPORT",
|
|
2569
|
+
Survey = "SURVEY",
|
|
2570
|
+
Other = "OTHER",
|
|
2571
|
+
}
|
|
2572
|
+
declare enum FlowActionEnum {
|
|
2573
|
+
INIT = "INIT",
|
|
2574
|
+
BACK = "BACK",
|
|
2575
|
+
DATA_EXCHANGE = "data_exchange",
|
|
2107
2576
|
}
|
|
2108
2577
|
/**
|
|
2109
|
-
*
|
|
2110
|
-
*
|
|
2111
|
-
*/
|
|
2112
|
-
|
|
2113
|
-
/**
|
|
2114
|
-
* WhatsApp Flow Endpoint - Error Notification Response
|
|
2115
|
-
* The expected response structure for error notification requests
|
|
2578
|
+
* Enum for Flow Types in webhook handlers
|
|
2579
|
+
* Used to register handlers for specific flow events
|
|
2116
2580
|
*/
|
|
2117
|
-
|
|
2118
|
-
|
|
2581
|
+
declare enum FlowTypeEnum {
|
|
2582
|
+
/** Health check/ping requests */
|
|
2583
|
+
Ping = "ping",
|
|
2584
|
+
/** Data exchange requests */
|
|
2585
|
+
Change = "data_exchange",
|
|
2586
|
+
/** Error notification requests */
|
|
2587
|
+
Error = "error",
|
|
2588
|
+
/** Match all flow action types */
|
|
2589
|
+
All = "*",
|
|
2119
2590
|
}
|
|
2591
|
+
type FlowType = (typeof FlowTypeEnum)[keyof typeof FlowTypeEnum];
|
|
2120
2592
|
/**
|
|
2121
|
-
*
|
|
2122
|
-
* A combined type that includes all possible fields from different request types
|
|
2123
|
-
* with all fields being optional for flexibility
|
|
2593
|
+
* Flow Validation Error Pointer
|
|
2124
2594
|
*/
|
|
2125
|
-
interface
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
error_key?: string;
|
|
2132
|
-
error_message?: string;
|
|
2133
|
-
};
|
|
2595
|
+
interface FlowValidationErrorPointer {
|
|
2596
|
+
line_start: number;
|
|
2597
|
+
line_end: number;
|
|
2598
|
+
column_start: number;
|
|
2599
|
+
column_end: number;
|
|
2600
|
+
path: string;
|
|
2134
2601
|
}
|
|
2135
2602
|
/**
|
|
2136
|
-
*
|
|
2137
|
-
* Union type for all possible response types from a Flow endpoint
|
|
2603
|
+
* Flow Validation Error
|
|
2138
2604
|
*/
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
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>;
|
|
2244
|
-
}
|
|
2245
|
-
//#endregion
|
|
2246
|
-
//#region src/core/webhook/types.d.ts
|
|
2247
|
-
interface WebhookContact {
|
|
2248
|
-
/**
|
|
2249
|
-
* WhatsApp ID of the contact. Business can respond to this contact using this ID.
|
|
2250
|
-
*/
|
|
2251
|
-
wa_id: string;
|
|
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
|
-
};
|
|
2605
|
+
interface FlowValidationError {
|
|
2606
|
+
error: string;
|
|
2607
|
+
error_type: string;
|
|
2608
|
+
message: string;
|
|
2609
|
+
line_start: number;
|
|
2610
|
+
line_end: number;
|
|
2611
|
+
column_start: number;
|
|
2612
|
+
column_end: number;
|
|
2613
|
+
pointers: FlowValidationErrorPointer[];
|
|
2265
2614
|
}
|
|
2266
2615
|
/**
|
|
2267
|
-
*
|
|
2616
|
+
* Flow Item
|
|
2268
2617
|
*/
|
|
2269
|
-
interface
|
|
2618
|
+
interface Flow {
|
|
2270
2619
|
id: string;
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
* Context object, included when a user replies or interacts
|
|
2276
|
-
*/
|
|
2277
|
-
context?: {
|
|
2278
|
-
/**
|
|
2279
|
-
* ID of the message
|
|
2280
|
-
*/
|
|
2281
|
-
id?: string;
|
|
2282
|
-
/**
|
|
2283
|
-
* ID of the sender
|
|
2284
|
-
*/
|
|
2285
|
-
from?: string;
|
|
2286
|
-
/**
|
|
2287
|
-
* ID of the message being replied to or interacted with
|
|
2288
|
-
*/
|
|
2289
|
-
message_id: string;
|
|
2290
|
-
/**
|
|
2291
|
-
* ID of the forwarded message, if applicable
|
|
2292
|
-
*/
|
|
2293
|
-
forwarded?: boolean;
|
|
2294
|
-
/**
|
|
2295
|
-
* Frequently forwarded status
|
|
2296
|
-
*/
|
|
2297
|
-
frequently_forwarded?: boolean;
|
|
2298
|
-
/**
|
|
2299
|
-
* Original message information if the message was referred
|
|
2300
|
-
*/
|
|
2301
|
-
referred_product?: {
|
|
2302
|
-
/**
|
|
2303
|
-
* Catalog ID
|
|
2304
|
-
*/
|
|
2305
|
-
catalog_id: string;
|
|
2306
|
-
/**
|
|
2307
|
-
* Product ID
|
|
2308
|
-
*/
|
|
2309
|
-
product_retailer_id: string;
|
|
2310
|
-
};
|
|
2311
|
-
};
|
|
2312
|
-
/**
|
|
2313
|
-
* Errors array, if the message had errors
|
|
2314
|
-
*/
|
|
2315
|
-
errors?: Array<{
|
|
2316
|
-
/**
|
|
2317
|
-
* Error code
|
|
2318
|
-
*/
|
|
2319
|
-
code: number;
|
|
2320
|
-
/**
|
|
2321
|
-
* Error title
|
|
2322
|
-
*/
|
|
2323
|
-
title: string;
|
|
2324
|
-
/**
|
|
2325
|
-
* Error message
|
|
2326
|
-
*/
|
|
2327
|
-
message: string;
|
|
2328
|
-
/**
|
|
2329
|
-
* Error details object
|
|
2330
|
-
*/
|
|
2331
|
-
error_data?: {
|
|
2332
|
-
/**
|
|
2333
|
-
* Describes the error details
|
|
2334
|
-
*/
|
|
2335
|
-
details: string;
|
|
2336
|
-
};
|
|
2337
|
-
}>;
|
|
2620
|
+
name: string;
|
|
2621
|
+
status: FlowStatusEnum;
|
|
2622
|
+
categories: FlowCategoryEnum[];
|
|
2623
|
+
validation_errors: FlowValidationError[];
|
|
2338
2624
|
}
|
|
2339
2625
|
/**
|
|
2340
|
-
*
|
|
2626
|
+
* Pagination Cursors
|
|
2341
2627
|
*/
|
|
2342
|
-
interface
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
/**
|
|
2346
|
-
* The text content of the message
|
|
2347
|
-
*/
|
|
2348
|
-
body: string;
|
|
2349
|
-
preview_url?: boolean;
|
|
2350
|
-
};
|
|
2628
|
+
interface PaginationCursors {
|
|
2629
|
+
before: string;
|
|
2630
|
+
after: string;
|
|
2351
2631
|
}
|
|
2352
2632
|
/**
|
|
2353
|
-
*
|
|
2633
|
+
* Pagination Object
|
|
2354
2634
|
*/
|
|
2355
|
-
interface
|
|
2356
|
-
|
|
2357
|
-
image: {
|
|
2358
|
-
/**
|
|
2359
|
-
* The image caption (if provided)
|
|
2360
|
-
*/
|
|
2361
|
-
caption?: string;
|
|
2362
|
-
/**
|
|
2363
|
-
* The SHA256 hash of the image
|
|
2364
|
-
*/
|
|
2365
|
-
sha256?: string;
|
|
2366
|
-
/**
|
|
2367
|
-
* The ID for the image
|
|
2368
|
-
*/
|
|
2369
|
-
id: string;
|
|
2370
|
-
/**
|
|
2371
|
-
* The MIME type of the image
|
|
2372
|
-
*/
|
|
2373
|
-
mime_type: string;
|
|
2374
|
-
};
|
|
2635
|
+
interface Pagination {
|
|
2636
|
+
cursors: PaginationCursors;
|
|
2375
2637
|
}
|
|
2376
2638
|
/**
|
|
2377
|
-
*
|
|
2639
|
+
* Flows List Response
|
|
2378
2640
|
*/
|
|
2379
|
-
interface
|
|
2380
|
-
|
|
2381
|
-
|
|
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
|
-
};
|
|
2641
|
+
interface FlowsListResponse {
|
|
2642
|
+
data: Flow[];
|
|
2643
|
+
paging: Pagination;
|
|
2399
2644
|
}
|
|
2400
2645
|
/**
|
|
2401
|
-
*
|
|
2646
|
+
* Flow Asset
|
|
2402
2647
|
*/
|
|
2403
|
-
interface
|
|
2404
|
-
|
|
2405
|
-
|
|
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
|
-
};
|
|
2648
|
+
interface FlowAsset {
|
|
2649
|
+
name: string;
|
|
2650
|
+
asset_type: string;
|
|
2651
|
+
download_url: string;
|
|
2419
2652
|
}
|
|
2420
2653
|
/**
|
|
2421
|
-
*
|
|
2654
|
+
* Flow Assets Response
|
|
2422
2655
|
*/
|
|
2423
|
-
interface
|
|
2424
|
-
|
|
2425
|
-
|
|
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
|
-
};
|
|
2656
|
+
interface FlowAssetsResponse {
|
|
2657
|
+
data: FlowAsset[];
|
|
2658
|
+
paging: Pagination;
|
|
2447
2659
|
}
|
|
2448
2660
|
/**
|
|
2449
|
-
*
|
|
2661
|
+
* Flow Preview
|
|
2450
2662
|
*/
|
|
2451
|
-
interface
|
|
2452
|
-
|
|
2453
|
-
|
|
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
|
-
};
|
|
2663
|
+
interface FlowPreview {
|
|
2664
|
+
preview_url: string;
|
|
2665
|
+
expires_at: string;
|
|
2467
2666
|
}
|
|
2468
2667
|
/**
|
|
2469
|
-
*
|
|
2668
|
+
* Flow Preview Response
|
|
2470
2669
|
*/
|
|
2471
|
-
interface
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2670
|
+
interface FlowPreviewResponse {
|
|
2671
|
+
preview: FlowPreview;
|
|
2672
|
+
id: string;
|
|
2673
|
+
}
|
|
2674
|
+
/**
|
|
2675
|
+
* Flow Migration Result
|
|
2676
|
+
*/
|
|
2677
|
+
interface FlowMigrationResult {
|
|
2678
|
+
source_name: string;
|
|
2679
|
+
source_id: string;
|
|
2680
|
+
migrated_id: string;
|
|
2681
|
+
}
|
|
2682
|
+
/**
|
|
2683
|
+
* Flow Migration Failure
|
|
2684
|
+
*/
|
|
2685
|
+
interface FlowMigrationFailure {
|
|
2686
|
+
source_name: string;
|
|
2687
|
+
error_code: string;
|
|
2688
|
+
error_message: string;
|
|
2689
|
+
}
|
|
2690
|
+
/**
|
|
2691
|
+
* Create Flow Response
|
|
2692
|
+
*/
|
|
2693
|
+
interface CreateFlowResponse {
|
|
2694
|
+
id: string;
|
|
2695
|
+
success: boolean;
|
|
2696
|
+
validation_errors?: FlowValidationError[];
|
|
2697
|
+
}
|
|
2698
|
+
/**
|
|
2699
|
+
* Update Flow Response
|
|
2700
|
+
*/
|
|
2701
|
+
interface UpdateFlowResponse {
|
|
2702
|
+
success: boolean;
|
|
2703
|
+
validation_errors?: FlowValidationError[];
|
|
2483
2704
|
}
|
|
2484
2705
|
/**
|
|
2485
|
-
*
|
|
2706
|
+
* Flow Migration Response
|
|
2486
2707
|
*/
|
|
2487
|
-
interface
|
|
2488
|
-
|
|
2489
|
-
|
|
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
|
-
}>;
|
|
2708
|
+
interface FlowMigrationResponse {
|
|
2709
|
+
migrated_flows: FlowMigrationResult[];
|
|
2710
|
+
failed_flows: FlowMigrationFailure[];
|
|
2566
2711
|
}
|
|
2567
2712
|
/**
|
|
2568
|
-
*
|
|
2713
|
+
* Validate Flow JSON Response
|
|
2569
2714
|
*/
|
|
2570
|
-
interface
|
|
2571
|
-
|
|
2572
|
-
|
|
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
|
-
};
|
|
2715
|
+
interface ValidateFlowJsonResponse {
|
|
2716
|
+
valid: boolean;
|
|
2717
|
+
success: boolean;
|
|
2718
|
+
validation_errors?: FlowValidationError[];
|
|
2590
2719
|
}
|
|
2591
2720
|
/**
|
|
2592
|
-
*
|
|
2721
|
+
* WhatsApp Flow Endpoint - Health Check Response
|
|
2722
|
+
* The expected response structure for health check requests
|
|
2593
2723
|
*/
|
|
2594
|
-
interface
|
|
2595
|
-
|
|
2596
|
-
|
|
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
|
-
};
|
|
2724
|
+
interface FlowHealthCheckResponse {
|
|
2725
|
+
data: {
|
|
2726
|
+
status: 'active';
|
|
2634
2727
|
};
|
|
2635
2728
|
}
|
|
2636
2729
|
/**
|
|
2637
|
-
*
|
|
2730
|
+
* WhatsApp Flow Endpoint - Data Exchange Response
|
|
2731
|
+
* The expected response structure for data exchange requests
|
|
2638
2732
|
*/
|
|
2639
|
-
interface
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
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
|
-
};
|
|
2733
|
+
interface FlowDataExchangeResponse {
|
|
2734
|
+
screen?: string;
|
|
2735
|
+
data?: Record<string, any | {
|
|
2736
|
+
error_message?: string;
|
|
2737
|
+
}>;
|
|
2664
2738
|
}
|
|
2665
2739
|
/**
|
|
2666
|
-
*
|
|
2740
|
+
* WhatsApp Flow Endpoint - Success Screen Response
|
|
2741
|
+
* The expected response structure for success screen requests
|
|
2667
2742
|
*/
|
|
2668
|
-
interface
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
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;
|
|
2743
|
+
interface FlowSuccessScreenResponse {
|
|
2744
|
+
screen: 'SUCCESS';
|
|
2745
|
+
data: {
|
|
2746
|
+
extension_message_response?: {
|
|
2747
|
+
params?: {
|
|
2748
|
+
flow_token: string;
|
|
2749
|
+
[key: string]: string;
|
|
2750
|
+
};
|
|
2751
|
+
};
|
|
2700
2752
|
};
|
|
2701
2753
|
}
|
|
2702
2754
|
/**
|
|
2703
|
-
*
|
|
2755
|
+
* WhatsApp Flow Endpoint - Error Notification Response
|
|
2756
|
+
* The expected response structure for error notification requests
|
|
2704
2757
|
*/
|
|
2705
|
-
interface
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2758
|
+
interface FlowErrorNotificationResponse {
|
|
2759
|
+
acknowledged: boolean;
|
|
2760
|
+
}
|
|
2761
|
+
/**
|
|
2762
|
+
* WhatsApp Flow Endpoint - Comprehensive Request Object
|
|
2763
|
+
* A combined type that includes all possible fields from different request types
|
|
2764
|
+
* with all fields being optional for flexibility
|
|
2765
|
+
*/
|
|
2766
|
+
interface FlowEndpointRequest {
|
|
2767
|
+
version?: '3.0';
|
|
2768
|
+
action?: 'ping' | FlowActionEnum;
|
|
2769
|
+
screen?: string;
|
|
2770
|
+
flow_token?: string;
|
|
2771
|
+
data?: Record<string, any> & {
|
|
2772
|
+
error_key?: string;
|
|
2773
|
+
error_message?: string;
|
|
2716
2774
|
};
|
|
2717
2775
|
}
|
|
2718
2776
|
/**
|
|
2719
|
-
*
|
|
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
|
|
2777
|
+
* WhatsApp Flow Endpoint - Response
|
|
2778
|
+
* Union type for all possible response types from a Flow endpoint
|
|
2725
2779
|
*/
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
* The WhatsApp Business Account ID
|
|
2729
|
-
*/
|
|
2730
|
-
wabaId: string;
|
|
2780
|
+
type FlowEndpointResponse = FlowHealthCheckResponse | FlowDataExchangeResponse | FlowErrorNotificationResponse | FlowSuccessScreenResponse;
|
|
2781
|
+
interface FlowClass {
|
|
2731
2782
|
/**
|
|
2732
|
-
*
|
|
2783
|
+
* List Flows
|
|
2784
|
+
*
|
|
2785
|
+
* @param wabaId - The WABA ID
|
|
2786
|
+
* @returns Promise with the list of flows
|
|
2733
2787
|
*/
|
|
2734
|
-
|
|
2788
|
+
listFlows(wabaId: string): Promise<FlowsListResponse>;
|
|
2735
2789
|
/**
|
|
2736
|
-
*
|
|
2790
|
+
* Create Flow
|
|
2791
|
+
*
|
|
2792
|
+
* @param wabaId - The WABA ID
|
|
2793
|
+
* @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
|
|
2794
|
+
* @returns Promise with the created flow ID
|
|
2737
2795
|
*/
|
|
2738
|
-
|
|
2796
|
+
createFlow(wabaId: string, data: {
|
|
2797
|
+
name: string;
|
|
2798
|
+
categories?: FlowCategoryEnum[];
|
|
2799
|
+
endpoint_uri?: string;
|
|
2800
|
+
clone_flow_id?: string;
|
|
2801
|
+
flow_json?: string;
|
|
2802
|
+
publish?: boolean;
|
|
2803
|
+
}): Promise<CreateFlowResponse>;
|
|
2739
2804
|
/**
|
|
2740
|
-
*
|
|
2805
|
+
* Get Flow
|
|
2806
|
+
*
|
|
2807
|
+
* @param flowId - The flow ID
|
|
2808
|
+
* @param fields - Optional fields to return
|
|
2809
|
+
* @param dateFormat - Optional date format
|
|
2810
|
+
* @returns Promise with the flow details
|
|
2741
2811
|
*/
|
|
2742
|
-
|
|
2812
|
+
getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
|
|
2743
2813
|
/**
|
|
2744
|
-
*
|
|
2814
|
+
* Update Flow Metadata
|
|
2815
|
+
*
|
|
2816
|
+
* @param flowId - The flow ID
|
|
2817
|
+
* @param data - The flow metadata to update
|
|
2818
|
+
* @returns Promise with the success status
|
|
2745
2819
|
*/
|
|
2746
|
-
|
|
2820
|
+
updateFlowMetadata(flowId: string, data: {
|
|
2821
|
+
name?: string;
|
|
2822
|
+
categories?: FlowCategoryEnum[];
|
|
2823
|
+
endpoint_uri?: string;
|
|
2824
|
+
application_id?: string;
|
|
2825
|
+
}): Promise<ResponseSuccess>;
|
|
2747
2826
|
/**
|
|
2748
|
-
*
|
|
2827
|
+
* Delete Flow
|
|
2828
|
+
*
|
|
2829
|
+
* @param flowId - The flow ID
|
|
2830
|
+
* @returns Promise with the success status
|
|
2749
2831
|
*/
|
|
2750
|
-
|
|
2832
|
+
deleteFlow(flowId: string): Promise<ResponseSuccess>;
|
|
2751
2833
|
/**
|
|
2752
|
-
*
|
|
2834
|
+
* List Assets (Get Flow JSON URL)
|
|
2835
|
+
*
|
|
2836
|
+
* @param flowId - The flow ID
|
|
2837
|
+
* @returns Promise with the list of assets
|
|
2753
2838
|
*/
|
|
2754
|
-
|
|
2839
|
+
listAssets(flowId: string): Promise<FlowAssetsResponse>;
|
|
2755
2840
|
/**
|
|
2756
|
-
*
|
|
2841
|
+
* Update Flow JSON
|
|
2842
|
+
*
|
|
2843
|
+
* @param flowId - The flow ID
|
|
2844
|
+
* @param data - The asset data including asset_type, file, and name
|
|
2845
|
+
* @returns Promise with the success status and validation errors
|
|
2757
2846
|
*/
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
audio?: AudioMessage['audio'];
|
|
2763
|
-
document?: DocumentMessage['document'];
|
|
2764
|
-
sticker?: StickerMessage['sticker'];
|
|
2765
|
-
location?: LocationMessage['location'];
|
|
2766
|
-
contacts?: ContactsMessage['contacts'];
|
|
2767
|
-
interactive?: InteractiveMessage['interactive'];
|
|
2768
|
-
button?: ButtonMessage['button'];
|
|
2769
|
-
order?: OrderMessage['order'];
|
|
2770
|
-
system?: SystemMessage['system'];
|
|
2771
|
-
reaction?: ReactionMessage['reaction'];
|
|
2772
|
-
statuses?: {
|
|
2773
|
-
/**
|
|
2774
|
-
* Arbitrary string included in sent message
|
|
2775
|
-
*/
|
|
2776
|
-
biz_opaque_callback_data?: string;
|
|
2777
|
-
/**
|
|
2778
|
-
* Information about the conversation
|
|
2779
|
-
*/
|
|
2780
|
-
conversation?: {
|
|
2781
|
-
/**
|
|
2782
|
-
* Represents the ID of the conversation the given status notification belongs to
|
|
2783
|
-
*/
|
|
2784
|
-
id: string;
|
|
2785
|
-
/**
|
|
2786
|
-
* Describes conversation category
|
|
2787
|
-
*/
|
|
2788
|
-
origin: {
|
|
2789
|
-
/**
|
|
2790
|
-
* Indicates conversation category. This can also be referred to as a conversation entry point
|
|
2791
|
-
* - authentication: Conversation opened by business sending template categorized as AUTHENTICATION
|
|
2792
|
-
* - marketing: Conversation opened by business sending template categorized as MARKETING
|
|
2793
|
-
* - utility: Conversation opened by business sending template categorized as UTILITY
|
|
2794
|
-
* - service: Conversation opened by business replying to customer within service window
|
|
2795
|
-
* - referral_conversion: Free entry point conversation
|
|
2796
|
-
*/
|
|
2797
|
-
type: 'authentication' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
|
|
2798
|
-
};
|
|
2799
|
-
/**
|
|
2800
|
-
* Date when the conversation expires. Only present for messages with status 'sent'
|
|
2801
|
-
*/
|
|
2802
|
-
expiration_timestamp?: string;
|
|
2803
|
-
};
|
|
2804
|
-
/**
|
|
2805
|
-
* Array of error objects describing the error
|
|
2806
|
-
*/
|
|
2807
|
-
errors?: Array<{
|
|
2808
|
-
/**
|
|
2809
|
-
* Error code
|
|
2810
|
-
*/
|
|
2811
|
-
code: number;
|
|
2812
|
-
/**
|
|
2813
|
-
* Error code title
|
|
2814
|
-
*/
|
|
2815
|
-
title: string;
|
|
2816
|
-
/**
|
|
2817
|
-
* Error code message
|
|
2818
|
-
*/
|
|
2819
|
-
message: string;
|
|
2820
|
-
/**
|
|
2821
|
-
* Error details object
|
|
2822
|
-
*/
|
|
2823
|
-
error_data?: {
|
|
2824
|
-
/**
|
|
2825
|
-
* Describes the error details
|
|
2826
|
-
*/
|
|
2827
|
-
details: string;
|
|
2828
|
-
};
|
|
2829
|
-
}>;
|
|
2830
|
-
/**
|
|
2831
|
-
* The ID for the message that the business sent to a customer
|
|
2832
|
-
*/
|
|
2833
|
-
id: string;
|
|
2834
|
-
/**
|
|
2835
|
-
* Pricing information for the message/conversation
|
|
2836
|
-
*/
|
|
2837
|
-
pricing?: {
|
|
2838
|
-
/**
|
|
2839
|
-
* Indicates if the given message or conversation is billable
|
|
2840
|
-
* @deprecated This field is deprecated. Visit the WhatsApp Changelog for more information.
|
|
2841
|
-
*/
|
|
2842
|
-
billable?: boolean;
|
|
2843
|
-
/**
|
|
2844
|
-
* Indicates the conversation category:
|
|
2845
|
-
* - authentication: Authentication conversation
|
|
2846
|
-
* - authentication_international: Authentication-international conversation
|
|
2847
|
-
* - marketing: Marketing conversation
|
|
2848
|
-
* - utility: Utility conversation
|
|
2849
|
-
* - service: Service conversation
|
|
2850
|
-
* - referral_conversion: Free entry point conversation
|
|
2851
|
-
*/
|
|
2852
|
-
category: 'authentication' | 'authentication_international' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
|
|
2853
|
-
/**
|
|
2854
|
-
* Type of pricing model used by the business. Current supported value is CBP
|
|
2855
|
-
*/
|
|
2856
|
-
pricing_model: 'CBP';
|
|
2857
|
-
};
|
|
2858
|
-
/**
|
|
2859
|
-
* The customer's WhatsApp ID. Business can respond to customer using this ID.
|
|
2860
|
-
* This ID may not match the customer's phone number.
|
|
2861
|
-
*/
|
|
2862
|
-
recipient_id: string;
|
|
2863
|
-
/**
|
|
2864
|
-
* Status of the message:
|
|
2865
|
-
* - delivered: Message has been delivered
|
|
2866
|
-
* - read: Message has been read by the customer
|
|
2867
|
-
* - sent: Message has been sent to the customer
|
|
2868
|
-
*/
|
|
2869
|
-
status: 'delivered' | 'read' | 'sent';
|
|
2870
|
-
/**
|
|
2871
|
-
* Unix timestamp for the status message
|
|
2872
|
-
*/
|
|
2873
|
-
timestamp: string;
|
|
2874
|
-
};
|
|
2847
|
+
updateFlowJson(flowId: string, data: {
|
|
2848
|
+
file: Blob | Buffer | object;
|
|
2849
|
+
name?: string;
|
|
2850
|
+
}): Promise<UpdateFlowResponse>;
|
|
2875
2851
|
/**
|
|
2876
|
-
*
|
|
2852
|
+
* Validate Flow JSON by attempting an update without publishing.
|
|
2853
|
+
* This is a convenience method; the API doesn't have a dedicated validation endpoint.
|
|
2854
|
+
*
|
|
2855
|
+
* @param flowId - The ID of the Flow (must exist, can be in DRAFT status).
|
|
2856
|
+
* @param flowJsonData - The Flow JSON content as a Buffer, JSON object, or Blob.
|
|
2857
|
+
* @returns Promise indicating if the JSON is valid and includes validation errors if any.
|
|
2877
2858
|
*/
|
|
2878
|
-
|
|
2879
|
-
}
|
|
2880
|
-
/**
|
|
2881
|
-
* Webhook event received from WhatsApp
|
|
2882
|
-
*/
|
|
2883
|
-
interface WebhookEvent {
|
|
2859
|
+
validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
|
|
2884
2860
|
/**
|
|
2885
|
-
*
|
|
2861
|
+
* Publish Flow
|
|
2862
|
+
*
|
|
2863
|
+
* @param flowId - The flow ID
|
|
2864
|
+
* @returns Promise with the success status
|
|
2886
2865
|
*/
|
|
2887
|
-
|
|
2866
|
+
publishFlow(flowId: string): Promise<ResponseSuccess>;
|
|
2888
2867
|
/**
|
|
2889
|
-
*
|
|
2868
|
+
* Deprecate Flow
|
|
2869
|
+
*
|
|
2870
|
+
* @param flowId - The flow ID
|
|
2871
|
+
* @returns Promise with the success status
|
|
2890
2872
|
*/
|
|
2891
|
-
|
|
2873
|
+
deprecateFlow(flowId: string): Promise<ResponseSuccess>;
|
|
2892
2874
|
/**
|
|
2893
|
-
*
|
|
2875
|
+
* Migrate Flows
|
|
2876
|
+
*
|
|
2877
|
+
* @param wabaId - The destination WABA ID
|
|
2878
|
+
* @param data - The migration data including source_waba_id and optional source_flow_names
|
|
2879
|
+
* @returns Promise with migration results
|
|
2894
2880
|
*/
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
*/
|
|
2900
|
-
declare enum MessageStatus {
|
|
2901
|
-
DELIVERED = "delivered",
|
|
2902
|
-
READ = "read",
|
|
2903
|
-
SENT = "sent",
|
|
2881
|
+
migrateFlows(wabaId: string, data: {
|
|
2882
|
+
source_waba_id: string;
|
|
2883
|
+
source_flow_names?: string[];
|
|
2884
|
+
}): Promise<FlowMigrationResponse>;
|
|
2904
2885
|
}
|
|
2905
2886
|
//#endregion
|
|
2906
2887
|
//#region src/api/qrCode/types/common.d.ts
|