meta-cloud-api 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -36,6 +36,7 @@ declare enum MessageTypesEnum {
36
36
  Button = "button",
37
37
  Order = "order",
38
38
  System = "system",
39
+ Unsupported = "unsupported",
39
40
  Unknown = "unknown",
40
41
  Statuses = "statuses",
41
42
  '*' = "*",
@@ -786,6 +787,17 @@ interface Paging {
786
787
  };
787
788
  next: string;
788
789
  }
790
+ /**
791
+ * Common error detail structure used in Meta API responses
792
+ * Used for individual item errors in bulk operations
793
+ */
794
+ interface MetaErrorDetail {
795
+ message: string;
796
+ code: string;
797
+ error_data?: {
798
+ details: string;
799
+ };
800
+ }
789
801
  declare class RequesterClass {
790
802
  constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
791
803
  sendRequest: (method: HttpMethodsEnum, path: string, timeout: number, body?: GeneralRequestBody, contentType?: string, additionalHeaders?: Record<string, string>) => Promise<RequesterResponseInterface<unknown>>;
@@ -851,6 +863,196 @@ declare class BaseAPI implements BaseClass {
851
863
  protected sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
852
864
  }
853
865
  //#endregion
866
+ //#region src/api/blockUsers/types/blockUsers.d.ts
867
+ /**
868
+ * Block Users API Types
869
+ * @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users
870
+ */
871
+ /**
872
+ * User object for blocking/unblocking operations
873
+ */
874
+ type BlockUserObject = {
875
+ user: string;
876
+ };
877
+ /**
878
+ * Blocked user information in response
879
+ */
880
+ type BlockedUserInfo = {
881
+ input: string;
882
+ wa_id: string;
883
+ };
884
+ /**
885
+ * Failed user information with error details
886
+ * Uses common MetaErrorDetail type for consistency across APIs
887
+ */
888
+ type FailedUserInfo = BlockedUserInfo & {
889
+ errors?: MetaErrorDetail[];
890
+ };
891
+ /**
892
+ * Request body for blocking users
893
+ */
894
+ type BlockUsersRequest = {
895
+ messaging_product: 'whatsapp';
896
+ block_users: BlockUserObject[];
897
+ };
898
+ /**
899
+ * Request body for unblocking users
900
+ */
901
+ type UnblockUsersRequest = {
902
+ messaging_product: 'whatsapp';
903
+ block_users: BlockUserObject[];
904
+ };
905
+ /**
906
+ * Response for block/unblock operations
907
+ */
908
+ type BlockUsersResponse = {
909
+ messaging_product: 'whatsapp';
910
+ block_users: {
911
+ added_users?: BlockedUserInfo[];
912
+ failed_users?: FailedUserInfo[];
913
+ };
914
+ };
915
+ /**
916
+ * Pagination cursors for list operations
917
+ */
918
+ type PagingCursors = {
919
+ after?: string;
920
+ before?: string;
921
+ };
922
+ /**
923
+ * Pagination information
924
+ */
925
+ type PagingInfo = {
926
+ cursors?: PagingCursors;
927
+ previous?: string;
928
+ next?: string;
929
+ };
930
+ /**
931
+ * List blocked users response
932
+ */
933
+ type ListBlockedUsersResponse = {
934
+ data: Array<{
935
+ block_users: BlockedUserInfo[];
936
+ }>;
937
+ paging?: PagingInfo;
938
+ };
939
+ /**
940
+ * Query parameters for listing blocked users
941
+ */
942
+ type ListBlockedUsersParams = {
943
+ limit?: number;
944
+ after?: string;
945
+ before?: string;
946
+ };
947
+ /**
948
+ * Block Users API Interface
949
+ */
950
+ interface BlockUsersClass {
951
+ /**
952
+ * Block one or more WhatsApp users
953
+ * @param users - Array of phone numbers or WhatsApp IDs to block
954
+ * @returns Response with successfully blocked and failed users
955
+ * @throws Error if users have not messaged in last 24 hours
956
+ * @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#block-users
957
+ */
958
+ block(users: string[]): Promise<BlockUsersResponse>;
959
+ /**
960
+ * Unblock one or more WhatsApp users
961
+ * @param users - Array of phone numbers or WhatsApp IDs to unblock
962
+ * @returns Response with successfully unblocked and failed users
963
+ * @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#unblock-users
964
+ */
965
+ unblock(users: string[]): Promise<BlockUsersResponse>;
966
+ /**
967
+ * Get list of blocked WhatsApp users with pagination
968
+ * @param params - Optional pagination parameters
969
+ * @returns List of blocked users with pagination info
970
+ * @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#get-list-of-blocked-numbers
971
+ */
972
+ listBlockedUsers(params?: ListBlockedUsersParams): Promise<ListBlockedUsersResponse>;
973
+ }
974
+ //#endregion
975
+ //#region src/api/blockUsers/BlockUsersApi.d.ts
976
+ /**
977
+ * Block Users API
978
+ * @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users
979
+ *
980
+ * Limitations:
981
+ * - Can only block users that have messaged your business in the last 24 hours
982
+ * - 64k blocklist limit
983
+ */
984
+ declare class BlockUsersApi extends BaseAPI implements BlockUsersClass {
985
+ private readonly endpoint;
986
+ constructor(config: WabaConfigType, client: RequesterClass);
987
+ /**
988
+ * Build request body for block/unblock operations
989
+ */
990
+ private buildBlockUsersBody;
991
+ /**
992
+ * Block one or more WhatsApp users
993
+ * @param users - Array of phone numbers or WhatsApp IDs to block
994
+ * @returns Response with successfully blocked and failed users
995
+ * @throws Error if users have not messaged in last 24 hours
996
+ * @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#block-users
997
+ *
998
+ * @example
999
+ * ```typescript
1000
+ * // Block single user
1001
+ * const result = await client.blockUsers.block(['1234567890']);
1002
+ *
1003
+ * // Block multiple users
1004
+ * const result = await client.blockUsers.block(['1234567890', '0987654321']);
1005
+ *
1006
+ * // Check results
1007
+ * console.log('Blocked:', result.block_users.added_users);
1008
+ * console.log('Failed:', result.block_users.failed_users);
1009
+ * ```
1010
+ */
1011
+ block(users: string[]): Promise<BlockUsersResponse>;
1012
+ /**
1013
+ * Unblock one or more WhatsApp users
1014
+ * @param users - Array of phone numbers or WhatsApp IDs to unblock
1015
+ * @returns Response with successfully unblocked and failed users
1016
+ * @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#unblock-users
1017
+ *
1018
+ * @example
1019
+ * ```typescript
1020
+ * // Unblock single user
1021
+ * const result = await client.blockUsers.unblock(['1234567890']);
1022
+ *
1023
+ * // Unblock multiple users
1024
+ * const result = await client.blockUsers.unblock(['1234567890', '0987654321']);
1025
+ *
1026
+ * // Check results
1027
+ * console.log('Unblocked:', result.block_users.added_users);
1028
+ * console.log('Failed:', result.block_users.failed_users);
1029
+ * ```
1030
+ */
1031
+ unblock(users: string[]): Promise<BlockUsersResponse>;
1032
+ /**
1033
+ * Get list of blocked WhatsApp users with pagination
1034
+ * @param params - Optional pagination parameters
1035
+ * @returns List of blocked users with pagination info
1036
+ * @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#get-list-of-blocked-numbers
1037
+ *
1038
+ * @example
1039
+ * ```typescript
1040
+ * // Get first 10 blocked users
1041
+ * const result = await client.blockUsers.listBlockedUsers({ limit: 10 });
1042
+ *
1043
+ * // Pagination with cursor
1044
+ * const nextPage = await client.blockUsers.listBlockedUsers({
1045
+ * limit: 10,
1046
+ * after: result.paging?.cursors?.after
1047
+ * });
1048
+ *
1049
+ * // Get all blocked users
1050
+ * const allBlocked = await client.blockUsers.listBlockedUsers();
1051
+ * ```
1052
+ */
1053
+ listBlockedUsers(params?: ListBlockedUsersParams): Promise<ListBlockedUsersResponse>;
1054
+ }
1055
+ //#endregion
854
1056
  //#region src/api/encryption/types/publicKey.d.ts
855
1057
  type EncryptionPublicKeyResponse = ResponseData<{
856
1058
  business_public_key: string;
@@ -872,513 +1074,348 @@ declare class EncryptionApi extends BaseAPI implements EncryptionClass {
872
1074
  }
873
1075
  //#endregion
874
1076
  //#region src/core/webhook/types.d.ts
1077
+ /**
1078
+ * WhatsApp contact information
1079
+ */
875
1080
  interface WebhookContact {
876
- /**
877
- * WhatsApp ID of the contact. Business can respond to this contact using this ID.
878
- */
879
1081
  wa_id: string;
880
- /**
881
- * Additional unique, alphanumeric identifier for a WhatsApp user
882
- */
883
- user_id?: string;
884
- /**
885
- * Profile of Whatsapp user
886
- */
887
1082
  profile: {
888
- /**
889
- * The display name of the contact
890
- */
891
1083
  name: string;
892
1084
  };
1085
+ identity_key_hash?: string;
893
1086
  }
894
1087
  /**
895
- * Base message interface with common properties
1088
+ * Metadata included in all webhooks
896
1089
  */
897
- interface BaseMessage {
898
- id: string;
1090
+ interface WebhookMetadata {
1091
+ display_phone_number: string;
1092
+ phone_number_id: string;
1093
+ }
1094
+ /**
1095
+ * Error object structure
1096
+ */
1097
+ interface WebhookError {
1098
+ code: number;
1099
+ title: string;
1100
+ message: string;
1101
+ error_data?: {
1102
+ details: string;
1103
+ };
1104
+ href?: string;
1105
+ }
1106
+ /**
1107
+ * Click to WhatsApp ad referral information
1108
+ */
1109
+ interface ReferralInfo {
1110
+ source_url: string;
1111
+ source_id: string;
1112
+ source_type: 'ad';
1113
+ body?: string;
1114
+ headline?: string;
1115
+ media_type?: 'image' | 'video';
1116
+ image_url?: string;
1117
+ video_url?: string;
1118
+ thumbnail_url?: string;
1119
+ ctwa_clid?: string;
1120
+ welcome_message?: {
1121
+ text: string;
1122
+ };
1123
+ }
1124
+ /**
1125
+ * Context for forwarded messages
1126
+ */
1127
+ interface ForwardedContext {
1128
+ forwarded?: true;
1129
+ frequently_forwarded?: true;
1130
+ }
1131
+ /**
1132
+ * Context for product inquiry messages
1133
+ */
1134
+ interface ProductContext {
899
1135
  from: string;
900
- timestamp: string;
901
- type: MessageTypesEnum;
902
- /**
903
- * Context object, included when a user replies or interacts
904
- */
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
- };
1136
+ id: string;
1137
+ referred_product: {
1138
+ catalog_id: string;
1139
+ product_retailer_id: string;
939
1140
  };
940
- /**
941
- * Errors array, if the message had errors
942
- */
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
- }>;
966
1141
  }
967
1142
  /**
968
- * Text message interface
1143
+ * Context for interactive/button replies
1144
+ */
1145
+ interface ReplyContext {
1146
+ from: string;
1147
+ id: string;
1148
+ }
1149
+ /**
1150
+ * Base message properties common to all message types
969
1151
  */
1152
+ interface BaseMessage {
1153
+ from: string;
1154
+ id: string;
1155
+ timestamp: string;
1156
+ }
970
1157
  interface TextMessage extends BaseMessage {
971
1158
  type: MessageTypesEnum.Text;
972
1159
  text: {
973
- /**
974
- * The text content of the message
975
- */
976
1160
  body: string;
977
- preview_url?: boolean;
978
1161
  };
1162
+ context?: ForwardedContext | ProductContext;
1163
+ referral?: ReferralInfo;
979
1164
  }
980
- /**
981
- * Image message interface
982
- */
983
1165
  interface ImageMessage extends BaseMessage {
984
1166
  type: MessageTypesEnum.Image;
985
1167
  image: {
986
- /**
987
- * The image caption (if provided)
988
- */
989
1168
  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
1169
  mime_type: string;
1170
+ sha256: string;
1171
+ id: string;
1172
+ url: string;
1002
1173
  };
1174
+ context?: ForwardedContext;
1175
+ referral?: ReferralInfo;
1003
1176
  }
1004
- /**
1005
- * Video message interface
1006
- */
1007
1177
  interface VideoMessage extends BaseMessage {
1008
1178
  type: MessageTypesEnum.Video;
1009
1179
  video: {
1010
- /**
1011
- * The video caption (if provided)
1012
- */
1013
1180
  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
1181
  mime_type: string;
1182
+ sha256: string;
1183
+ id: string;
1184
+ url: string;
1026
1185
  };
1186
+ context?: ForwardedContext;
1187
+ referral?: ReferralInfo;
1027
1188
  }
1028
- /**
1029
- * Audio message interface
1030
- */
1031
1189
  interface AudioMessage extends BaseMessage {
1032
1190
  type: MessageTypesEnum.Audio;
1033
1191
  audio: {
1034
- /**
1035
- * The ID for the audio file
1036
- */
1037
- id: string;
1038
- /**
1039
- * The MIME type of the audio file
1040
- */
1041
1192
  mime_type: string;
1042
- /**
1043
- * Whether the audio is a voice message
1044
- */
1045
- voice?: boolean;
1193
+ sha256: string;
1194
+ id: string;
1195
+ url: string;
1196
+ voice: boolean;
1046
1197
  };
1198
+ referral?: ReferralInfo;
1047
1199
  }
1048
- /**
1049
- * Document message interface
1050
- */
1051
1200
  interface DocumentMessage extends BaseMessage {
1052
1201
  type: MessageTypesEnum.Document;
1053
1202
  document: {
1054
- /**
1055
- * The document caption (if provided)
1056
- */
1057
1203
  caption?: string;
1058
- /**
1059
- * The document filename
1060
- */
1061
1204
  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
1205
  mime_type: string;
1206
+ sha256: string;
1207
+ id: string;
1208
+ url: string;
1074
1209
  };
1210
+ referral?: ReferralInfo;
1075
1211
  }
1076
- /**
1077
- * Sticker message interface
1078
- */
1079
1212
  interface StickerMessage extends BaseMessage {
1080
1213
  type: MessageTypesEnum.Sticker;
1081
1214
  sticker: {
1082
- /**
1083
- * The ID for the sticker
1084
- */
1215
+ mime_type: string;
1216
+ sha256: string;
1085
1217
  id: string;
1086
- /**
1087
- * Whether this is an animated sticker
1088
- */
1218
+ url: string;
1089
1219
  animated: boolean;
1090
- /**
1091
- * The MIME type of the sticker
1092
- */
1093
- mime_type: string;
1094
1220
  };
1221
+ referral?: ReferralInfo;
1095
1222
  }
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;
1223
+ interface InteractiveListReplyMessage extends BaseMessage {
1224
+ type: MessageTypesEnum.Interactive;
1225
+ context: ReplyContext;
1226
+ interactive: {
1227
+ type: 'list_reply';
1228
+ list_reply: {
1229
+ id: string;
1230
+ title: string;
1231
+ description?: string;
1232
+ };
1110
1233
  };
1111
1234
  }
1112
- /**
1113
- * Contacts message interface
1114
- */
1235
+ interface InteractiveButtonReplyMessage extends BaseMessage {
1236
+ type: MessageTypesEnum.Interactive;
1237
+ context: ReplyContext;
1238
+ interactive: {
1239
+ type: 'button_reply';
1240
+ button_reply: {
1241
+ id: string;
1242
+ title: string;
1243
+ };
1244
+ };
1245
+ }
1246
+ type InteractiveMessage = InteractiveListReplyMessage | InteractiveButtonReplyMessage;
1247
+ interface ButtonMessage extends BaseMessage {
1248
+ type: MessageTypesEnum.Button;
1249
+ context: ReplyContext;
1250
+ button: {
1251
+ payload: string;
1252
+ text: string;
1253
+ };
1254
+ }
1255
+ interface LocationMessage extends BaseMessage {
1256
+ type: MessageTypesEnum.Location;
1257
+ location: {
1258
+ latitude: number;
1259
+ longitude: number;
1260
+ name?: string;
1261
+ address?: string;
1262
+ url?: string;
1263
+ };
1264
+ referral?: ReferralInfo;
1265
+ }
1115
1266
  interface ContactsMessage extends BaseMessage {
1116
1267
  type: MessageTypesEnum.Contacts;
1117
1268
  contacts: Array<{
1118
- /**
1119
- * The contact's name
1120
- */
1269
+ addresses?: Array<{
1270
+ city?: string;
1271
+ country?: string;
1272
+ country_code?: string;
1273
+ state?: string;
1274
+ street?: string;
1275
+ type?: string;
1276
+ zip?: string;
1277
+ }>;
1278
+ birthday?: string;
1279
+ emails?: Array<{
1280
+ email: string;
1281
+ type?: string;
1282
+ }>;
1121
1283
  name: {
1122
- /**
1123
- * The formatted name
1124
- */
1125
1284
  formatted_name: string;
1126
- /**
1127
- * The first name
1128
- */
1129
1285
  first_name?: string;
1130
- /**
1131
- * The last name
1132
- */
1133
1286
  last_name?: string;
1134
- /**
1135
- * The middle name
1136
- */
1137
1287
  middle_name?: string;
1138
- /**
1139
- * The suffix
1140
- */
1141
1288
  suffix?: string;
1142
- /**
1143
- * The prefix
1144
- */
1145
1289
  prefix?: string;
1146
1290
  };
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
1291
  org?: {
1178
1292
  company?: string;
1179
1293
  department?: string;
1180
1294
  title?: string;
1181
1295
  };
1182
- /**
1183
- * The contact's URLs
1184
- */
1296
+ phones?: Array<{
1297
+ phone: string;
1298
+ wa_id?: string;
1299
+ type?: string;
1300
+ }>;
1185
1301
  urls?: Array<{
1186
1302
  url: string;
1187
1303
  type?: string;
1188
1304
  }>;
1189
- /**
1190
- * The contact's birthday (YYYY-MM-DD format)
1191
- */
1192
- birthday?: string;
1193
1305
  }>;
1306
+ referral?: ReferralInfo;
1194
1307
  }
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;
1308
+ interface ReactionMessage extends BaseMessage {
1309
+ type: MessageTypesEnum.Reaction;
1310
+ reaction: {
1311
+ message_id: string;
1312
+ emoji?: string;
1217
1313
  };
1218
1314
  }
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
- };
1263
- }
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
- };
1291
- };
1292
- }
1293
- /**
1294
- * Order message interface
1295
- */
1296
1315
  interface OrderMessage extends BaseMessage {
1297
1316
  type: MessageTypesEnum.Order;
1298
1317
  order: {
1299
- /**
1300
- * Catalog ID
1301
- */
1302
1318
  catalog_id: string;
1303
- /**
1304
- * Product items in the order
1305
- */
1319
+ text?: string;
1306
1320
  product_items: Array<{
1307
- /**
1308
- * Product ID
1309
- */
1310
1321
  product_retailer_id: string;
1311
- /**
1312
- * Quantity of the product
1313
- */
1314
1322
  quantity: number;
1315
- /**
1316
- * Item price
1317
- */
1318
1323
  item_price: number;
1319
- /**
1320
- * Currency code
1321
- */
1322
1324
  currency: string;
1323
1325
  }>;
1324
- /**
1325
- * Text message included with the order
1326
- */
1327
- text?: string;
1328
1326
  };
1329
1327
  }
1328
+ interface SystemMessage extends BaseMessage {
1329
+ type: MessageTypesEnum.System;
1330
+ system: {
1331
+ body: string;
1332
+ wa_id: string;
1333
+ type: 'user_changed_number';
1334
+ };
1335
+ }
1336
+ interface UnsupportedMessage extends BaseMessage {
1337
+ type: MessageTypesEnum.Unsupported;
1338
+ errors: Array<WebhookError>;
1339
+ }
1340
+ type GroupMessage = {
1341
+ group_id: string;
1342
+ } & (TextMessage | ImageMessage | VideoMessage | AudioMessage | DocumentMessage | LocationMessage | ContactsMessage);
1343
+ type WhatsAppMessage = TextMessage | ImageMessage | VideoMessage | AudioMessage | DocumentMessage | StickerMessage | InteractiveMessage | ButtonMessage | LocationMessage | ContactsMessage | ReactionMessage | OrderMessage | SystemMessage | UnsupportedMessage | GroupMessage;
1344
+ interface StatusWebhook {
1345
+ id: string;
1346
+ status: 'sent' | 'delivered' | 'read' | 'failed';
1347
+ timestamp: string;
1348
+ recipient_id: string;
1349
+ recipient_type?: 'group';
1350
+ recipient_participant_id?: string;
1351
+ recipient_identity_key_hash?: string;
1352
+ biz_opaque_callback_data?: string;
1353
+ conversation?: {
1354
+ id: string;
1355
+ expiration_timestamp?: string;
1356
+ origin: {
1357
+ type: 'authentication' | 'authentication_international' | 'marketing' | 'marketing_lite' | 'referral_conversion' | 'service' | 'utility';
1358
+ };
1359
+ };
1360
+ pricing?: {
1361
+ billable: boolean;
1362
+ pricing_model: 'CBP' | 'PMP';
1363
+ type: 'regular' | 'free_customer_service' | 'free_entry_point';
1364
+ category: 'authentication' | 'authentication_international' | 'marketing' | 'marketing_lite' | 'referral_conversion' | 'service' | 'utility';
1365
+ };
1366
+ errors?: Array<WebhookError>;
1367
+ }
1330
1368
  /**
1331
- * Button message interface
1369
+ * Webhook value for incoming messages
1332
1370
  */
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
- */
1343
- text: string;
1344
- };
1371
+ interface MessageWebhookValue {
1372
+ messaging_product: 'whatsapp';
1373
+ metadata: WebhookMetadata;
1374
+ contacts: Array<WebhookContact>;
1375
+ messages: Array<WhatsAppMessage>;
1376
+ }
1377
+ /**
1378
+ * Webhook value for status updates
1379
+ */
1380
+ interface StatusWebhookValue {
1381
+ messaging_product: 'whatsapp';
1382
+ metadata: WebhookMetadata;
1383
+ statuses: Array<StatusWebhook>;
1345
1384
  }
1346
1385
  /**
1386
+ * Webhook value for errors (no contacts or messages)
1387
+ */
1388
+ interface ErrorWebhookValue {
1389
+ messaging_product: 'whatsapp';
1390
+ metadata: WebhookMetadata;
1391
+ errors: Array<WebhookError>;
1392
+ }
1393
+ /**
1394
+ * Union type for all webhook value types
1395
+ */
1396
+ type WebhookValue = MessageWebhookValue | StatusWebhookValue | ErrorWebhookValue;
1397
+ interface WebhookPayload {
1398
+ object: 'whatsapp_business_account';
1399
+ entry: Array<{
1400
+ id: string;
1401
+ changes: Array<{
1402
+ value: WebhookValue;
1403
+ field: 'messages';
1404
+ }>;
1405
+ }>;
1406
+ }
1407
+ /**
1408
+ * @deprecated Use specific message types instead
1347
1409
  * 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
1410
  */
1350
1411
  interface WebhookMessage {
1351
- /**
1352
- * The WhatsApp Business Account ID
1353
- */
1354
1412
  wabaId: string;
1355
- /**
1356
- * The message ID
1357
- */
1358
1413
  id: string;
1359
- /**
1360
- * The sender's phone number
1361
- */
1362
1414
  from: string;
1363
- /**
1364
- * The timestamp of the message
1365
- */
1366
1415
  timestamp: string;
1367
- /**
1368
- * The type of message (text, image, etc.)
1369
- */
1370
1416
  type: MessageTypesEnum;
1371
- /**
1372
- * The phone number ID that received the message
1373
- */
1374
1417
  phoneNumberId: string;
1375
- /**
1376
- * The display phone number that received the message
1377
- */
1378
1418
  displayPhoneNumber: string;
1379
- /**
1380
- * The profile name of the sender
1381
- */
1382
1419
  profileName: string;
1383
1420
  text?: TextMessage['text'];
1384
1421
  image?: ImageMessage['image'];
@@ -1393,129 +1430,15 @@ interface WebhookMessage {
1393
1430
  order?: OrderMessage['order'];
1394
1431
  system?: SystemMessage['system'];
1395
1432
  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';
1422
- };
1423
- /**
1424
- * Date when the conversation expires. Only present for messages with status 'sent'
1425
- */
1426
- expiration_timestamp?: string;
1427
- };
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
- */
1433
+ statuses?: StatusWebhook;
1502
1434
  originalData: any;
1503
1435
  }
1504
1436
  /**
1505
1437
  * Webhook event received from WhatsApp
1506
1438
  */
1507
1439
  interface WebhookEvent {
1508
- /**
1509
- * The field type of the event
1510
- */
1511
1440
  field: string;
1512
- /**
1513
- * The event data
1514
- */
1515
1441
  value: any;
1516
- /**
1517
- * The timestamp when the event was received
1518
- */
1519
1442
  timestamp: number;
1520
1443
  }
1521
1444
  /**
@@ -1525,6 +1448,7 @@ declare enum MessageStatus {
1525
1448
  DELIVERED = "delivered",
1526
1449
  READ = "read",
1527
1450
  SENT = "sent",
1451
+ FAILED = "failed",
1528
1452
  }
1529
1453
  //#endregion
1530
1454
  //#region src/types/logger.d.ts
@@ -1820,11 +1744,49 @@ type VerifyCodeRequest = {
1820
1744
  type TwoStepVerificationParams = {
1821
1745
  pin: string;
1822
1746
  };
1747
+ /**
1748
+ * Conversational Components - Commands
1749
+ */
1750
+ type ConversationalCommand = {
1751
+ command_name: string;
1752
+ command_description: string;
1753
+ };
1754
+ /**
1755
+ * Conversational Components - Ice Breakers (Prompts)
1756
+ */
1757
+ type ConversationalPrompt = string;
1758
+ /**
1759
+ * Request payload for configuring conversational automation
1760
+ */
1761
+ type ConversationalAutomationRequest = {
1762
+ enable_welcome_message?: boolean;
1763
+ commands?: ConversationalCommand[];
1764
+ prompts?: ConversationalPrompt[];
1765
+ };
1766
+ /**
1767
+ * Response from conversational automation GET endpoint
1768
+ */
1769
+ type ConversationalAutomationResponse = {
1770
+ enable_welcome_message?: boolean;
1771
+ commands?: ConversationalCommand[];
1772
+ prompts?: ConversationalPrompt[];
1773
+ id: string;
1774
+ };
1775
+ /**
1776
+ * Response from throughput GET endpoint
1777
+ */
1778
+ type ThroughputResponse = {
1779
+ throughput: Throughput;
1780
+ id: string;
1781
+ };
1823
1782
  interface PhoneNumberClass {
1824
1783
  getPhoneNumberById(fields?: string): Promise<PhoneNumberResponse>;
1825
1784
  getPhoneNumbers(): Promise<PhoneNumbersResponse>;
1826
1785
  requestVerificationCode(params: RequestVerificationCodeRequest): Promise<ResponseSuccess>;
1827
1786
  verifyCode(params: VerifyCodeRequest): Promise<ResponseSuccess>;
1787
+ setConversationalAutomation(params: ConversationalAutomationRequest): Promise<ResponseSuccess>;
1788
+ getConversationalAutomation(): Promise<ConversationalAutomationResponse>;
1789
+ getThroughput(): Promise<ThroughputResponse>;
1828
1790
  }
1829
1791
  //#endregion
1830
1792
  //#region src/api/template/types/common.d.ts
@@ -3550,541 +3512,6 @@ declare class MessagesApi extends BaseAPI implements MessagesClass {
3550
3512
  reaction(params: ReactionParams): Promise<MessagesResponse>;
3551
3513
  }
3552
3514
  //#endregion
3553
- //#region src/api/messages/builders/ContactMessageBuilder.d.ts
3554
- /**
3555
- * Builder class for creating contact messages with a fluent API
3556
- */
3557
- declare class ContactMessageBuilder {
3558
- private contact;
3559
- /**
3560
- * Set the contact name (required)
3561
- */
3562
- setName(name: NameObject): this;
3563
- /**
3564
- * Set simple name with first name only
3565
- */
3566
- setSimpleName(firstName: string, lastName?: string): this;
3567
- /**
3568
- * Set full name details
3569
- */
3570
- setFullName(firstName: string, lastName?: string, middleName?: string, suffix?: string, prefix?: string): this;
3571
- /**
3572
- * Add phone numbers
3573
- */
3574
- addPhone(phone: string, type?: string, waId?: string): this;
3575
- /**
3576
- * Add email addresses
3577
- */
3578
- addEmail(email: string, type?: string): this;
3579
- /**
3580
- * Add address
3581
- */
3582
- addAddress(address: AddressesObject): this;
3583
- /**
3584
- * Add simple address
3585
- */
3586
- addSimpleAddress(street: string, city: string, country: string, type?: string): this;
3587
- /**
3588
- * Set organization details
3589
- */
3590
- setOrganization(company: string, department?: string, title?: string): this;
3591
- /**
3592
- * Add URL
3593
- */
3594
- addUrl(url: string, type?: string): this;
3595
- /**
3596
- * Set birthday (format: YYYY-MM-DD)
3597
- */
3598
- setBirthday(year: number, month: number, day: number): this;
3599
- /**
3600
- * Build the final contact object
3601
- */
3602
- build(): ContactObject;
3603
- /**
3604
- * Reset the builder for reuse
3605
- */
3606
- reset(): this;
3607
- }
3608
- /**
3609
- * Factory class for common contact patterns
3610
- */
3611
- declare class ContactMessageFactory {
3612
- /**
3613
- * Create a simple contact with name and phone
3614
- */
3615
- static createSimpleContact(firstName: string, phone: string): ContactObject;
3616
- /**
3617
- * Create a business contact
3618
- */
3619
- static createBusinessContact(firstName: string, lastName: string, company: string, title: string, phone: string, email: string): ContactObject;
3620
- /**
3621
- * Create a personal contact with full details
3622
- */
3623
- static createPersonalContact(firstName: string, lastName: string, mobilePhone: string, email?: string, birthday?: {
3624
- year: number;
3625
- month: number;
3626
- day: number;
3627
- }): ContactObject;
3628
- }
3629
- //#endregion
3630
- //#region src/api/messages/builders/InteractiveMessageBuilder.d.ts
3631
- /**
3632
- * Builder class for creating interactive messages with a fluent API
3633
- */
3634
- declare class InteractiveMessageBuilder {
3635
- private message;
3636
- /**
3637
- * Set the interactive message type
3638
- */
3639
- setType(type: InteractiveTypesEnum): this;
3640
- /**
3641
- * Set the body text of the message
3642
- */
3643
- setBody(text: string): this;
3644
- /**
3645
- * Set the footer text of the message
3646
- */
3647
- setFooter(text: string): this;
3648
- /**
3649
- * Set a text header
3650
- */
3651
- setTextHeader(text: string): this;
3652
- /**
3653
- * Set an image header
3654
- */
3655
- setImageHeader(imageUrl: string): this;
3656
- /**
3657
- * Add reply buttons (for button type messages)
3658
- */
3659
- addReplyButtons(buttons: Array<{
3660
- id: string;
3661
- title: string;
3662
- }>): this;
3663
- /**
3664
- * Add list sections (for list type messages)
3665
- * Note: This creates a single section with multiple rows
3666
- */
3667
- addListSections(sections: Array<{
3668
- title?: string;
3669
- rows: Array<{
3670
- id: string;
3671
- title: string;
3672
- description?: string;
3673
- }>;
3674
- }>): this;
3675
- /**
3676
- * Set the button text for list messages
3677
- */
3678
- setListButtonText(buttonText: string): this;
3679
- /**
3680
- * Set CTA URL action
3681
- */
3682
- setCTAUrl(displayText: string, url: string): this;
3683
- /**
3684
- * Build the final interactive object
3685
- */
3686
- build(): InteractiveObject;
3687
- /**
3688
- * Reset the builder for reuse
3689
- */
3690
- reset(): this;
3691
- }
3692
- /**
3693
- * Convenience factory functions for common interactive message types
3694
- */
3695
- declare class InteractiveMessageFactory {
3696
- /**
3697
- * Create a button message with reply buttons
3698
- */
3699
- static createButtonMessage(bodyText: string, buttons: Array<{
3700
- id: string;
3701
- title: string;
3702
- }>, options?: {
3703
- headerText?: string;
3704
- footerText?: string;
3705
- }): InteractiveObject;
3706
- /**
3707
- * Create a list message with sections
3708
- */
3709
- static createListMessage(bodyText: string, buttonText: string, sections: Array<{
3710
- title?: string;
3711
- rows: Array<{
3712
- id: string;
3713
- title: string;
3714
- description?: string;
3715
- }>;
3716
- }>, options?: {
3717
- headerText?: string;
3718
- footerText?: string;
3719
- }): InteractiveObject;
3720
- /**
3721
- * Create a CTA URL message
3722
- */
3723
- static createCTAUrlMessage(bodyText: string, displayText: string, url: string, options?: {
3724
- headerText?: string;
3725
- footerText?: string;
3726
- }): InteractiveObject;
3727
- }
3728
- //#endregion
3729
- //#region src/api/messages/builders/LocationMessageBuilder.d.ts
3730
- /**
3731
- * Builder class for creating location messages with a fluent API
3732
- */
3733
- declare class LocationMessageBuilder {
3734
- private location;
3735
- /**
3736
- * Set the latitude coordinate
3737
- */
3738
- setLatitude(latitude: number): this;
3739
- /**
3740
- * Set the longitude coordinate
3741
- */
3742
- setLongitude(longitude: number): this;
3743
- /**
3744
- * Set coordinates using latitude and longitude
3745
- */
3746
- setCoordinates(latitude: number, longitude: number): this;
3747
- /**
3748
- * Set the location name
3749
- */
3750
- setName(name: string): this;
3751
- /**
3752
- * Set the location address
3753
- */
3754
- setAddress(address: string): this;
3755
- /**
3756
- * Build the final location object
3757
- */
3758
- build(): LocationObject;
3759
- /**
3760
- * Reset the builder for reuse
3761
- */
3762
- reset(): this;
3763
- }
3764
- /**
3765
- * Factory class for common location patterns
3766
- */
3767
- declare class LocationMessageFactory {
3768
- /**
3769
- * Create a simple location with just coordinates
3770
- */
3771
- static createSimpleLocation(latitude: number, longitude: number): LocationObject;
3772
- /**
3773
- * Create a location with name and address
3774
- */
3775
- static createNamedLocation(latitude: number, longitude: number, name: string, address: string): LocationObject;
3776
- /**
3777
- * Create a business location
3778
- */
3779
- static createBusinessLocation(latitude: number, longitude: number, businessName: string, fullAddress: string): LocationObject;
3780
- }
3781
- //#endregion
3782
- //#region src/api/messages/builders/MediaMessageBuilder.d.ts
3783
- /**
3784
- * Base builder for media messages
3785
- */
3786
- declare abstract class BaseMediaBuilder<T> {
3787
- protected media: Partial<T>;
3788
- /**
3789
- * Set media ID (for uploaded media)
3790
- */
3791
- setId(id: string): this;
3792
- /**
3793
- * Set media URL
3794
- */
3795
- setLink(url: string): this;
3796
- /**
3797
- * Set media caption
3798
- */
3799
- setCaption(caption: string): this;
3800
- /**
3801
- * Build the media object
3802
- */
3803
- build(): T;
3804
- /**
3805
- * Reset the builder
3806
- */
3807
- reset(): this;
3808
- }
3809
- /**
3810
- * Builder for image messages
3811
- */
3812
- declare class ImageMessageBuilder extends BaseMediaBuilder<ImageMediaObject> {}
3813
- /**
3814
- * Builder for video messages
3815
- */
3816
- declare class VideoMessageBuilder extends BaseMediaBuilder<VideoMediaObject> {}
3817
- /**
3818
- * Builder for audio messages
3819
- */
3820
- declare class AudioMessageBuilder extends BaseMediaBuilder<AudioMediaObject> {
3821
- setCaption(caption: string): this;
3822
- }
3823
- /**
3824
- * Builder for document messages
3825
- */
3826
- declare class DocumentMessageBuilder extends BaseMediaBuilder<DocumentMediaObject> {
3827
- /**
3828
- * Set document filename
3829
- */
3830
- setFilename(filename: string): this;
3831
- }
3832
- /**
3833
- * Builder for sticker messages
3834
- */
3835
- declare class StickerMessageBuilder extends BaseMediaBuilder<StickerMediaObject> {
3836
- setCaption(caption: string): this;
3837
- }
3838
- /**
3839
- * Factory class for common media patterns
3840
- */
3841
- declare class MediaMessageFactory {
3842
- /**
3843
- * Create an image with caption
3844
- */
3845
- static createImageWithCaption(linkOrId: string, caption: string, isId?: boolean): ImageMediaObject;
3846
- /**
3847
- * Create a video with caption
3848
- */
3849
- static createVideoWithCaption(linkOrId: string, caption: string, isId?: boolean): VideoMediaObject;
3850
- /**
3851
- * Create a document with filename
3852
- */
3853
- static createDocument(linkOrId: string, filename: string, caption?: string, isId?: boolean): DocumentMediaObject;
3854
- /**
3855
- * Create an audio message
3856
- */
3857
- static createAudio(linkOrId: string, isId?: boolean): AudioMediaObject;
3858
- /**
3859
- * Create a sticker message
3860
- */
3861
- static createSticker(linkOrId: string, isId?: boolean): StickerMediaObject;
3862
- }
3863
- //#endregion
3864
- //#region src/api/messages/builders/ReactionMessageBuilder.d.ts
3865
- /**
3866
- * Builder class for creating reaction messages with a fluent API
3867
- */
3868
- declare class ReactionMessageBuilder {
3869
- private reaction;
3870
- /**
3871
- * Set the message ID to react to
3872
- */
3873
- setMessageId(messageId: string): this;
3874
- /**
3875
- * Set the emoji for the reaction
3876
- */
3877
- setEmoji(emoji: string): this;
3878
- /**
3879
- * Remove a reaction (by sending empty emoji)
3880
- */
3881
- removeReaction(): this;
3882
- /**
3883
- * Build the final reaction object
3884
- */
3885
- build(): {
3886
- message_id: string;
3887
- emoji: string;
3888
- };
3889
- /**
3890
- * Reset the builder for reuse
3891
- */
3892
- reset(): this;
3893
- }
3894
- /**
3895
- * Factory class for common reaction patterns
3896
- */
3897
- declare class ReactionMessageFactory {
3898
- /**
3899
- * Create a like reaction
3900
- */
3901
- static createLike(messageId: string): {
3902
- message_id: string;
3903
- emoji: string;
3904
- };
3905
- /**
3906
- * Create a heart reaction
3907
- */
3908
- static createHeart(messageId: string): {
3909
- message_id: string;
3910
- emoji: string;
3911
- };
3912
- /**
3913
- * Create a laughing reaction
3914
- */
3915
- static createLaugh(messageId: string): {
3916
- message_id: string;
3917
- emoji: string;
3918
- };
3919
- /**
3920
- * Create a wow reaction
3921
- */
3922
- static createWow(messageId: string): {
3923
- message_id: string;
3924
- emoji: string;
3925
- };
3926
- /**
3927
- * Create a sad reaction
3928
- */
3929
- static createSad(messageId: string): {
3930
- message_id: string;
3931
- emoji: string;
3932
- };
3933
- /**
3934
- * Create an angry reaction
3935
- */
3936
- static createAngry(messageId: string): {
3937
- message_id: string;
3938
- emoji: string;
3939
- };
3940
- /**
3941
- * Remove a reaction
3942
- */
3943
- static removeReaction(messageId: string): {
3944
- message_id: string;
3945
- emoji: string;
3946
- };
3947
- }
3948
- //#endregion
3949
- //#region src/api/messages/builders/TemplateMessageBuilder.d.ts
3950
- type CurrencyParameterHelper = {
3951
- type: ParametersTypesEnum.Currency;
3952
- currency: {
3953
- fallback_value: string;
3954
- code: CurrencyCodesEnum;
3955
- amount_1000: number;
3956
- };
3957
- };
3958
- type DateTimeParameterHelper = {
3959
- type: ParametersTypesEnum.DateTime;
3960
- date_time: {
3961
- fallback_value: string;
3962
- timestamp: number;
3963
- };
3964
- };
3965
- type ParameterObject = CurrencyParameterHelper | DateTimeParameterHelper;
3966
- /**
3967
- * Builder class for creating template messages with a fluent API
3968
- */
3969
- declare class TemplateMessageBuilder {
3970
- private template;
3971
- /**
3972
- * Set the template name
3973
- */
3974
- setName(name: string): this;
3975
- /**
3976
- * Set the template language
3977
- */
3978
- setLanguage(code: string): this;
3979
- /**
3980
- * Add a header component with text parameters
3981
- */
3982
- addTextHeader(parameters: string[]): this;
3983
- /**
3984
- * Add a header component with image
3985
- */
3986
- addImageHeader(imageUrl: string): this;
3987
- /**
3988
- * Add a body component with text parameters
3989
- */
3990
- addBody(parameters: string[]): this;
3991
- /**
3992
- * Add a footer component (usually no parameters needed)
3993
- */
3994
- addFooter(): this;
3995
- /**
3996
- * Add button components (for quick replies, URLs, etc.)
3997
- */
3998
- addButtons(buttons: Array<{
3999
- index: number;
4000
- type: 'quick_reply' | 'url';
4001
- parameters?: string[];
4002
- }>): this;
4003
- /**
4004
- * Add a currency parameter for header/body
4005
- */
4006
- addCurrencyParameter(fallbackValue: string, currencyCode: string, amount: number): CurrencyParameterHelper;
4007
- /**
4008
- * Add a date time parameter
4009
- */
4010
- addDateTimeParameter(fallbackValue: string, timestamp: number): DateTimeParameterHelper;
4011
- /**
4012
- * Build the final template object
4013
- */
4014
- build(): MessageTemplateObject<ComponentTypesEnum>;
4015
- /**
4016
- * Reset the builder for reuse
4017
- */
4018
- reset(): this;
4019
- }
4020
- /**
4021
- * Factory class for common template patterns
4022
- */
4023
- declare class TemplateMessageFactory {
4024
- /**
4025
- * Create a simple text-only template
4026
- */
4027
- static createSimpleTextTemplate(name: string, language: string, bodyParameters: string[]): MessageTemplateObject<ComponentTypesEnum>;
4028
- /**
4029
- * Create a template with header, body and buttons
4030
- */
4031
- static createCompleteTemplate(name: string, language: string, options: {
4032
- headerParameters?: string[];
4033
- headerImage?: string;
4034
- bodyParameters: string[];
4035
- buttons?: Array<{
4036
- index: number;
4037
- type: 'quick_reply' | 'url';
4038
- parameters?: string[];
4039
- }>;
4040
- }): MessageTemplateObject<ComponentTypesEnum>;
4041
- /**
4042
- * Create an order confirmation template
4043
- */
4044
- static createOrderConfirmationTemplate(language: string, customerName: string, orderNumber: string, amount: number, currencyCode: string): MessageTemplateObject<ComponentTypesEnum>;
4045
- }
4046
- //#endregion
4047
- //#region src/api/messages/builders/TextMessageBuilder.d.ts
4048
- /**
4049
- * Builder class for creating text messages with a fluent API
4050
- */
4051
- declare class TextMessageBuilder {
4052
- private textMessage;
4053
- /**
4054
- * Set the message body text
4055
- */
4056
- setBody(text: string): this;
4057
- /**
4058
- * Enable or disable URL preview
4059
- */
4060
- setPreviewUrl(enable?: boolean): this;
4061
- /**
4062
- * Build the final text object
4063
- */
4064
- build(): TextObject;
4065
- /**
4066
- * Reset the builder for reuse
4067
- */
4068
- reset(): this;
4069
- }
4070
- /**
4071
- * Factory class for common text message patterns
4072
- */
4073
- declare class TextMessageFactory {
4074
- /**
4075
- * Create a simple text message
4076
- */
4077
- static createSimpleText(body: string): TextObject;
4078
- /**
4079
- * Create a text message with URL preview
4080
- */
4081
- static createTextWithPreview(body: string): TextObject;
4082
- /**
4083
- * Create a notification message
4084
- */
4085
- static createNotification(title: string, message: string): TextObject;
4086
- }
4087
- //#endregion
4088
3515
  //#region src/api/phone/PhoneNumberApi.d.ts
4089
3516
  /**
4090
3517
  * API for managing WhatsApp Phone Numb ers.
@@ -4143,6 +3570,71 @@ declare class PhoneNumberApi extends BaseAPI implements PhoneNumberClass {
4143
3570
  * });
4144
3571
  */
4145
3572
  verifyCode(request: VerifyCodeRequest): Promise<ResponseSuccess>;
3573
+ /**
3574
+ * Configure conversational automation features (Welcome Messages, Ice Breakers, Commands).
3575
+ *
3576
+ * @param request Configuration for conversational components
3577
+ * @returns Response indicating success or failure
3578
+ *
3579
+ * @example
3580
+ * // Enable welcome message
3581
+ * await whatsappClient.phoneNumber.setConversationalAutomation({
3582
+ * enable_welcome_message: true
3583
+ * });
3584
+ *
3585
+ * @example
3586
+ * // Configure commands
3587
+ * await whatsappClient.phoneNumber.setConversationalAutomation({
3588
+ * commands: [
3589
+ * { command_name: 'tickets', command_description: 'Book flight tickets' },
3590
+ * { command_name: 'hotel', command_description: 'Book hotel' }
3591
+ * ]
3592
+ * });
3593
+ *
3594
+ * @example
3595
+ * // Configure ice breakers (prompts)
3596
+ * await whatsappClient.phoneNumber.setConversationalAutomation({
3597
+ * prompts: ['Book a flight', 'Plan a vacation']
3598
+ * });
3599
+ *
3600
+ * @example
3601
+ * // Configure all features
3602
+ * await whatsappClient.phoneNumber.setConversationalAutomation({
3603
+ * enable_welcome_message: true,
3604
+ * commands: [
3605
+ * { command_name: 'tickets', command_description: 'Book flight tickets' }
3606
+ * ],
3607
+ * prompts: ['Book a flight']
3608
+ * });
3609
+ */
3610
+ setConversationalAutomation(request: ConversationalAutomationRequest): Promise<ResponseSuccess>;
3611
+ /**
3612
+ * Get the current configuration of conversational automation features.
3613
+ *
3614
+ * @returns Current configuration including welcome message status, commands, and prompts
3615
+ *
3616
+ * @example
3617
+ * const config = await whatsappClient.phoneNumber.getConversationalAutomation();
3618
+ * console.log(config.enable_welcome_message); // true/false
3619
+ * console.log(config.commands); // Array of commands
3620
+ * console.log(config.prompts); // Array of ice breakers
3621
+ */
3622
+ getConversationalAutomation(): Promise<ConversationalAutomationResponse>;
3623
+ /**
3624
+ * Get the current throughput level for the phone number.
3625
+ *
3626
+ * Throughput represents the maximum messages per second (mps) that can be sent/received.
3627
+ * - Default: 80 mps
3628
+ * - Automatic upgrade to 1,000 mps available for eligible numbers
3629
+ * - WhatsApp Business app coexistence numbers: fixed at 5 mps
3630
+ *
3631
+ * @returns Current throughput information including the level (STANDARD, HIGH, or NOT_APPLICABLE)
3632
+ *
3633
+ * @example
3634
+ * const throughput = await whatsappClient.phoneNumber.getThroughput();
3635
+ * console.log(throughput.throughput.level); // 'STANDARD' | 'HIGH' | 'NOT_APPLICABLE'
3636
+ */
3637
+ getThroughput(): Promise<ThroughputResponse>;
4146
3638
  }
4147
3639
  //#endregion
4148
3640
  //#region src/api/profile/BusinessProfileApi.d.ts
@@ -4497,6 +3989,7 @@ declare class WabaApi extends BaseAPI implements WABAClass {
4497
3989
  declare class WhatsApp {
4498
3990
  config: WabaConfigType;
4499
3991
  requester: Readonly<Requester>;
3992
+ blockUsers: BlockUsersApi;
4500
3993
  messages: MessagesApi;
4501
3994
  media: MediaApi;
4502
3995
  phoneNumbers: PhoneNumberApi;
@@ -4690,5 +4183,5 @@ declare function nextjsAppWebhookHandler(config: NextJsAppWebhookConfig): {
4690
4183
  //#region src/core/webhook/utils/generateXHub256Sig.d.ts
4691
4184
  declare const generateXHub256Sig: (body: string, appSecret: string) => string;
4692
4185
  //#endregion
4693
- 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, createFlowErrorResponse, createFlowPingResponse, createLimitedTimeOfferTemplate, createMPMTemplate, createMediaCardCarouselTemplate, createOTPTemplate, createProductCardCarouselTemplate, createSPMTemplate, createTemplate, expressWebhookHandler, generateXHub256Sig, nextjsAppWebhookHandler, nextjsPagesWebhookHandler, processFlowRequest, processWebhookMessages };
4186
+ export { AccountMode, AudioMediaObject, AudioMediaTypesEnum, AudioMessage, AuthenticationTemplateOptions, BaseClass, BlockUserObject, BlockUsersApi, BlockUsersClass, BlockUsersRequest, BlockUsersResponse, BlockedUserInfo, BodyOptions, BusinessProfileApi, BusinessProfileClass, BusinessProfileData, BusinessProfileField, BusinessProfileFieldsParam, BusinessProfileResponse, BusinessVerticalEnum, ButtonMessage, ButtonOptions, ButtonPositionEnum, CarouselCard, CarouselOptions, CatalogButton, CatalogTemplateOptions, CategoryEnum, CodeVerificationStatus, ComponentTypes, ComponentTypesEnum, ContactObject, ContactsMessage, ConversationTypesEnum, CopyCodeButton, CouponTemplateOptions, CreateFlowResponse, CreateQrCodeRequest, CreateUploadSessionParams, CurrencyCodesEnum, CurrencyParameter, Cursors, DataLocalizationRegionEnum, DateTimeParameter, DocumentMediaObject, DocumentMediaTypesEnum, DocumentMessage, EncryptionApi, EncryptionClass, EncryptionPublicKeyResponse, ErrorWebhookValue, ExpressRequest, ExpressResponse, ExpressWebhookConfig, FailedUserInfo, Flow, FlowActionEnum, FlowApi, FlowAsset, FlowAssetsResponse, FlowButton, FlowCategoryEnum, FlowClass, FlowDataExchangeRequest, FlowDataExchangeResponse, FlowDecryptedRequestResponse, FlowEncryptedRequestPayload, FlowEndpointRequest, FlowEndpointResponse, FlowErrorNotificationRequest, FlowErrorNotificationResponse, FlowHandler, FlowHealthCheckRequest, FlowHealthCheckResponse, FlowHttpRequest, FlowMigrationFailure, FlowMigrationResponse, FlowMigrationResult, FlowPreview, FlowPreviewResponse, FlowStatusEnum, FlowSuccessScreenResponse, FlowType, FlowTypeEnum, FlowValidationError, FlowValidationErrorPointer, FlowsListResponse, FooterOptions, GeneralHeaderInterface, GeneralMessageBody, GeneralRequestBody, GetUploadHandleParams, GroupMessage, HeaderOptions, HealthStatus, HealthStatusEntity, HttpMethodsEnum, HttpsClientClass, HttpsClientResponseClass, ImageMediaObject, ImageMediaTypesEnum, ImageMessage, InteractiveButtonReplyMessage, InteractiveListReplyMessage, InteractiveMessage, InteractiveObject, InteractiveTypesEnum, LanguagesEnum, LimitedTimeOfferOptions, LimitedTimeOfferTemplateOptions, ListBlockedUsersParams, ListBlockedUsersResponse, LocationMessage, LocationObject, LocationParameter, LoggerInterface, MPMButton, MPMTemplateOptions, MediaApi, MediaCardCarouselTemplateOptions, MediaCarouselCard, MediaClass, MediaParameter, MediaResponse, MediasResponse, MessagesApi as MessageApi, MessagesApi, MessageHandler, MessageRequestBody, MessageRequestParams, MessageStatus, MessageTemplateObject, MessageTypesEnum, MessageWebhookValue, MessagesClass, MessagesResponse, MessagingLimitTier, MetaError, MetaErrorDetail, NextFunction, NextJsAppWebhookConfig, NextJsWebhookConfig, OTPButton, OTPTemplateOptions, OrderMessage, Pagination, PaginationCursors, Paging, PagingCursors, PagingInfo, ParametersTypesEnum, PhoneNumberApi, PhoneNumberButton, PhoneNumberClass, PhoneNumberResponse, PhoneNumbersResponse, PlatformType, ProductCardCarouselTemplateOptions, ProductCarouselCard, ProductParameter, ProductSection, QrCodeApi, QrCodeClass, QrCodeResponse, QrCodesResponse, QualityRating, QualityScore, QuickReplyButton, ReactionMessage, ReactionParams, ReferralSourceTypesEnum, RegistrationApi, RegistrationClass, RegistrationRequest, RequestCodeMethodsEnum, RequestVerificationCodeRequest, RequesterClass, RequesterResponseInterface, ResponseData, ResponseHeaderValue, ResponseHeaders, ResponseJSONBody, ResponsePagination, ResponseSuccess, SPMButton, SPMTemplateOptions, StatusEnum, StatusParams, StatusWebhook, StatusWebhookValue, StickerMediaObject, StickerMediaTypesEnum, StickerMessage, SubTypeEnum, SystemChangeTypesEnum, SystemMessage, TemplateApi, TemplateBody, TemplateButton, TemplateButtons, TemplateCarousel, TemplateClass, TemplateDeleteParams, TemplateFooter, TemplateFormat, TemplateGetParams, TemplateHeader, TemplateHeaderExample, TemplateLimitedTimeOffer, TemplateOptions, TemplateParameter, TemplateRequestBody, TemplateResponse, TemplateStatusEnum, TextMessage, TextMessageParams, TextObject, TextParameter, Throughput, ThroughputLevel, TwoStepVerificationApi, TwoStepVerificationClass, TwoStepVerificationParams, TwoStepVerificationRequest, URLButton, UnblockUsersRequest, UnsupportedMessage, UpdateBusinessProfileRequest, UpdateFlowResponse, UpdateQrCodeRequest, UpdateWabaSubscription, UploadBusinessProfileResponse, UploadHandle, UploadMediaParams, UploadMediaResponse, UploadSession, UploadSessionResponse, ValidateFlowJsonResponse, VerifyCodeRequest, VideoMediaObject, VideoMediaTypesEnum, VideoMessage, WABAClass, WabaAccount, WabaAccountFields, WabaAccountFieldsParam, WabaAccountReviewStatus, WabaAccountStatus, WabaApi, WabaBusinessVerificationStatus, WabaConfigEnum, WabaConfigType, WabaHealthStatus, WabaHealthStatusCanSendMessage, WabaHealthStatusEntity, WabaHealthStatusError, WabaSubscription, WabaSubscriptions, WebhookContact, WebhookEvent, WebhookMessage, WebhookPayload, WebhookProcessor, WebhookResponse, WebhookTypesEnum, WebhookValue, WhatsApp, WhatsAppConfig, WhatsAppMessage, constructFullUrl, createAuthenticationTemplate, createCatalogTemplate, createCouponTemplate, createFlowErrorResponse, createFlowPingResponse, createLimitedTimeOfferTemplate, createMPMTemplate, createMediaCardCarouselTemplate, createOTPTemplate, createProductCardCarouselTemplate, createSPMTemplate, createTemplate, expressWebhookHandler, generateXHub256Sig, nextjsAppWebhookHandler, nextjsPagesWebhookHandler, processFlowRequest, processWebhookMessages };
4694
4187
  //# sourceMappingURL=index.d.ts.map