meta-cloud-api 1.6.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -822,7 +822,7 @@ declare class BaseAPI implements BaseClass {
822
822
  protected sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
823
823
  }
824
824
  //#endregion
825
- //#region src/core/webhook/types.d.ts
825
+ //#region src/core/webhook/types/common.d.ts
826
826
  /**
827
827
  * WhatsApp contact information
828
828
  */
@@ -895,6 +895,8 @@ interface ReplyContext {
895
895
  from: string;
896
896
  id: string;
897
897
  }
898
+ //#endregion
899
+ //#region src/core/webhook/types/message.d.ts
898
900
  /**
899
901
  * Base message properties common to all message types
900
902
  */
@@ -1102,6 +1104,8 @@ type GroupMessage = {
1102
1104
  group_id: string;
1103
1105
  } & (TextMessage | ImageMessage | VideoMessage | AudioMessage | DocumentMessage | LocationMessage | ContactsMessage);
1104
1106
  type WhatsAppMessage = TextMessage | ImageMessage | VideoMessage | AudioMessage | DocumentMessage | StickerMessage | InteractiveMessage | ButtonMessage | LocationMessage | ContactsMessage | ReactionMessage | OrderMessage | SystemMessage | UnsupportedMessage | GroupMessage;
1107
+ //#endregion
1108
+ //#region src/core/webhook/types/status.d.ts
1105
1109
  interface StatusWebhook {
1106
1110
  id: string;
1107
1111
  status: 'sent' | 'delivered' | 'read' | 'failed';
@@ -1126,6 +1130,459 @@ interface StatusWebhook {
1126
1130
  };
1127
1131
  errors?: Array<WebhookError>;
1128
1132
  }
1133
+ /**
1134
+ * Message status enum
1135
+ */
1136
+ declare enum MessageStatus {
1137
+ DELIVERED = "delivered",
1138
+ READ = "read",
1139
+ SENT = "sent",
1140
+ FAILED = "failed",
1141
+ }
1142
+ //#endregion
1143
+ //#region src/core/webhook/types/account.d.ts
1144
+ /**
1145
+ * Account update event types
1146
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
1147
+ */
1148
+ type AccountUpdateEvent = 'VERIFIED_ACCOUNT' | 'DISABLED_UPDATE' | 'ACCOUNT_VIOLATION' | 'ACCOUNT_RESTRICTION' | 'ACCOUNT_DELETED' | 'PARTNER_REMOVED' | 'PARTNER_APP_UNINSTALLED';
1149
+ /**
1150
+ * WABA ban state
1151
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--ban_info
1152
+ */
1153
+ type WabaBanState = 'SCHEDULE_FOR_DISABLE' | 'DISABLE' | 'REINSTATE';
1154
+ /**
1155
+ * Restriction types imposed on WABA
1156
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--restriction_info
1157
+ */
1158
+ type RestrictionType = 'RESTRICTION_ADD_PHONE_NUMBER_ACTION' | 'RESTRICTED_BIZ_INITIATED_MESSAGING' | 'RESTRICTED_CUSTOMER_INITIATED_MESSAGING';
1159
+ interface AccountUpdateBanInfo {
1160
+ waba_ban_state: WabaBanState;
1161
+ waba_ban_date?: number;
1162
+ }
1163
+ interface AccountUpdateViolationInfo {
1164
+ violation_type: string;
1165
+ }
1166
+ interface AccountUpdateRestrictionInfo {
1167
+ restriction_type: RestrictionType;
1168
+ expiration?: number;
1169
+ }
1170
+ interface AccountUpdateWabaInfo {
1171
+ waba_id: string;
1172
+ owner_business_id: string;
1173
+ partner_app_id?: string;
1174
+ }
1175
+ interface AccountUpdateValue {
1176
+ phone_number?: string;
1177
+ event: AccountUpdateEvent;
1178
+ ban_info?: AccountUpdateBanInfo;
1179
+ violation_info?: AccountUpdateViolationInfo;
1180
+ restriction_info?: AccountUpdateRestrictionInfo[];
1181
+ waba_info?: AccountUpdateWabaInfo;
1182
+ }
1183
+ interface AccountUpdateWebhookValue {
1184
+ field: 'account_update';
1185
+ value: AccountUpdateValue;
1186
+ }
1187
+ /**
1188
+ * Account review decision
1189
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--decision
1190
+ */
1191
+ type ReviewDecision = 'APPROVED' | 'REJECTED' | 'DEFERRED';
1192
+ interface AccountReviewUpdateValue {
1193
+ decision: ReviewDecision;
1194
+ }
1195
+ interface AccountReviewUpdateWebhookValue {
1196
+ field: 'account_review_update';
1197
+ value: AccountReviewUpdateValue;
1198
+ }
1199
+ /**
1200
+ * Entity type for alert
1201
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#account-alerts
1202
+ */
1203
+ type AlertEntityType = 'BUSINESS' | 'PHONE_NUMBER' | 'WABA';
1204
+ /**
1205
+ * Alert severity level
1206
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#account-alerts
1207
+ */
1208
+ type AlertSeverity = 'CRITICAL' | 'WARNING' | 'INFO';
1209
+ /**
1210
+ * Alert status
1211
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#account-alerts
1212
+ */
1213
+ type AlertStatus = 'ACTIVE' | 'RESOLVED';
1214
+ /**
1215
+ * Alert types for messaging limit increases
1216
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#account-alerts
1217
+ */
1218
+ type AlertType = 'INCREASED_CAPABILITIES_ELIGIBILITY_FAILED' | 'INCREASED_CAPABILITIES_ELIGIBILITY_DEFERRED' | 'INCREASED_CAPABILITIES_ELIGIBILITY_NEED_MORE_INFO';
1219
+ interface AccountAlertsValue {
1220
+ entity_type: AlertEntityType;
1221
+ entity_id: string;
1222
+ alert_severity: AlertSeverity;
1223
+ alert_status: AlertStatus;
1224
+ alert_type: AlertType;
1225
+ alert_description: string;
1226
+ }
1227
+ interface AccountAlertsWebhookValue {
1228
+ field: 'account_alerts';
1229
+ value: AccountAlertsValue;
1230
+ }
1231
+ //#endregion
1232
+ //#region src/core/webhook/types/business.d.ts
1233
+ /**
1234
+ * Business capability limits
1235
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#business-capability-updates
1236
+ */
1237
+ interface BusinessCapabilityUpdateValue {
1238
+ max_daily_conversation_per_phone?: number;
1239
+ max_phone_numbers_per_business?: number;
1240
+ max_phone_numbers_per_waba?: number;
1241
+ }
1242
+ interface BusinessCapabilityUpdateWebhookValue {
1243
+ field: 'business_capability_update';
1244
+ value: BusinessCapabilityUpdateValue;
1245
+ }
1246
+ //#endregion
1247
+ //#region src/core/webhook/types/phoneNumber.d.ts
1248
+ /**
1249
+ * Phone number name update decision
1250
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#phone-number-updates
1251
+ */
1252
+ type PhoneNumberDecision = 'APPROVED' | 'REJECTED' | 'DEFERRED';
1253
+ interface PhoneNumberNameUpdateValue {
1254
+ display_phone_number: string;
1255
+ decision: PhoneNumberDecision;
1256
+ requested_verified_name: string;
1257
+ rejection_reason: string | null;
1258
+ }
1259
+ interface PhoneNumberNameUpdateWebhookValue {
1260
+ field: 'phone_number_name_update';
1261
+ value: PhoneNumberNameUpdateValue;
1262
+ }
1263
+ /**
1264
+ * Phone number quality events
1265
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
1266
+ */
1267
+ type PhoneNumberQualityEvent = 'FLAGGED' | 'UNFLAGGED' | 'UPGRADE' | 'DOWNGRADE' | 'ONBOARDING';
1268
+ /**
1269
+ * Messaging tier limits
1270
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--current_limit
1271
+ */
1272
+ type CurrentLimit = 'TIER_50' | 'TIER_250' | 'TIER_1K' | 'TIER_10K' | 'TIER_100K' | 'TIER_UNLIMITED';
1273
+ interface PhoneNumberQualityUpdateValue {
1274
+ display_phone_number: string;
1275
+ event: PhoneNumberQualityEvent;
1276
+ current_limit: CurrentLimit;
1277
+ }
1278
+ interface PhoneNumberQualityUpdateWebhookValue {
1279
+ field: 'phone_number_quality_update';
1280
+ value: PhoneNumberQualityUpdateValue;
1281
+ }
1282
+ //#endregion
1283
+ //#region src/core/webhook/types/template.d.ts
1284
+ /**
1285
+ * Message template status events
1286
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
1287
+ */
1288
+ type TemplateStatusEvent = 'APPROVED' | 'REJECTED' | 'PENDING' | 'DISABLED' | 'REINSTATED' | 'IN_APPEAL' | 'FLAGGED' | 'PAUSED' | 'PENDING_DELETION';
1289
+ /**
1290
+ * Template rejection reasons
1291
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--reason
1292
+ */
1293
+ type TemplateRejectionReason = 'NONE' | 'ABUSIVE_CONTENT' | 'INCORRECT_CATEGORY' | 'INVALID_FORMAT' | 'SCAM';
1294
+ interface TemplateDisableInfo {
1295
+ disable_date: string;
1296
+ }
1297
+ interface TemplatePauseInfo {
1298
+ title: string;
1299
+ description: string;
1300
+ }
1301
+ interface MessageTemplateStatusUpdateValue {
1302
+ event: TemplateStatusEvent;
1303
+ message_template_id: number;
1304
+ message_template_name: string;
1305
+ message_template_language: string;
1306
+ reason: TemplateRejectionReason | null;
1307
+ disable_info?: TemplateDisableInfo;
1308
+ other_info?: TemplatePauseInfo;
1309
+ }
1310
+ interface MessageTemplateStatusUpdateWebhookValue {
1311
+ field: 'message_template_status_update';
1312
+ value: MessageTemplateStatusUpdateValue;
1313
+ }
1314
+ /**
1315
+ * Template categories
1316
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
1317
+ */
1318
+ type TemplateCategory = 'MARKETING' | 'OTP' | 'TRANSACTIONAL' | 'AUTHENTICATION' | 'UTILITY';
1319
+ interface TemplateCategoryUpdateValue {
1320
+ message_template_id: number;
1321
+ message_template_name: string;
1322
+ message_template_language: string;
1323
+ previous_category: TemplateCategory;
1324
+ new_category: TemplateCategory;
1325
+ }
1326
+ interface TemplateCategoryUpdateWebhookValue {
1327
+ field: 'template_category_update';
1328
+ value: TemplateCategoryUpdateValue;
1329
+ }
1330
+ /**
1331
+ * Template quality scores
1332
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
1333
+ */
1334
+ type TemplateQualityScore = 'GREEN' | 'YELLOW' | 'RED' | 'UNKNOWN';
1335
+ interface MessageTemplateQualityUpdateValue {
1336
+ previous_quality_score: TemplateQualityScore;
1337
+ new_quality_score: TemplateQualityScore;
1338
+ message_template_id: number;
1339
+ message_template_name: string;
1340
+ message_template_language: string;
1341
+ }
1342
+ interface MessageTemplateQualityUpdateWebhookValue {
1343
+ field: 'message_template_quality_update';
1344
+ value: MessageTemplateQualityUpdateValue;
1345
+ }
1346
+ //#endregion
1347
+ //#region src/core/webhook/types/flows.d.ts
1348
+ /**
1349
+ * Flow event types
1350
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
1351
+ */
1352
+ type FlowEvent = 'FLOW_STATUS_CHANGE' | 'FLOW_HEALTH_UPDATE' | 'FLOW_THROTTLED';
1353
+ /**
1354
+ * Flow status values
1355
+ * @see https://developers.facebook.com/docs/whatsapp/flows/reference/flowsapi#statuses
1356
+ */
1357
+ type FlowStatus = 'DRAFT' | 'PUBLISHED' | 'DEPRECATED' | 'BLOCKED' | 'THROTTLED';
1358
+ /**
1359
+ * Flow alert state
1360
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--alert_state
1361
+ */
1362
+ type FlowAlertState = 'ACTIVE' | 'RESOLVED';
1363
+ /**
1364
+ * Flow endpoint request error
1365
+ */
1366
+ interface FlowEndpointRequestError {
1367
+ error_code: string;
1368
+ error_message: string;
1369
+ error_count: number;
1370
+ }
1371
+ /**
1372
+ * Flow webhook value
1373
+ */
1374
+ interface FlowsValue {
1375
+ event: FlowEvent;
1376
+ message?: string;
1377
+ flow_id: string;
1378
+ old_status?: FlowStatus;
1379
+ new_status?: FlowStatus;
1380
+ warning?: string;
1381
+ p90_latency?: number;
1382
+ p50_latency?: number;
1383
+ error_rate?: number;
1384
+ errors?: FlowEndpointRequestError[];
1385
+ requests_count?: number;
1386
+ availability?: number;
1387
+ threshold?: number;
1388
+ alert_state?: FlowAlertState;
1389
+ }
1390
+ interface FlowsWebhookValue {
1391
+ field: 'flows';
1392
+ value: FlowsValue;
1393
+ }
1394
+ //#endregion
1395
+ //#region src/core/webhook/types/security.d.ts
1396
+ /**
1397
+ * Two-step verification security events
1398
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
1399
+ */
1400
+ type SecurityEvent = 'PIN_CHANGED' | 'PIN_RESET_REQUEST' | 'PIN_RESET_SUCCESS';
1401
+ interface SecurityValue {
1402
+ event: SecurityEvent;
1403
+ requester?: string;
1404
+ }
1405
+ interface SecurityWebhookValue {
1406
+ field: 'security';
1407
+ value: SecurityValue;
1408
+ }
1409
+ //#endregion
1410
+ //#region src/core/webhook/types/history.d.ts
1411
+ /**
1412
+ * History sync metadata
1413
+ */
1414
+ interface HistorySyncMetadata {
1415
+ phase: number;
1416
+ chunk_order: number;
1417
+ progress: number;
1418
+ }
1419
+ /**
1420
+ * Reaction object in history
1421
+ */
1422
+ interface HistoryReaction {
1423
+ message_id: string;
1424
+ emoji: string;
1425
+ }
1426
+ /**
1427
+ * Message echo data (sent messages)
1428
+ */
1429
+ interface HistoryMessageEcho {
1430
+ from: string;
1431
+ to: string;
1432
+ id: string;
1433
+ timestamp: string;
1434
+ text?: {
1435
+ body: string;
1436
+ };
1437
+ interactive?: any;
1438
+ location?: any;
1439
+ image?: any;
1440
+ document?: any;
1441
+ voice?: any;
1442
+ audio?: any;
1443
+ video?: any;
1444
+ sticker?: any;
1445
+ button?: any;
1446
+ contacts?: any;
1447
+ reaction?: HistoryReaction;
1448
+ order?: any;
1449
+ biz_opaque_callback_data?: string;
1450
+ template?: any;
1451
+ }
1452
+ /**
1453
+ * History sync thread data
1454
+ */
1455
+ interface HistorySyncThread {
1456
+ id: string;
1457
+ messages: WhatsAppMessage[];
1458
+ }
1459
+ /**
1460
+ * History sync error data
1461
+ */
1462
+ interface HistorySyncError {
1463
+ message: string;
1464
+ error_data?: {
1465
+ details: string;
1466
+ };
1467
+ }
1468
+ /**
1469
+ * History sync data
1470
+ */
1471
+ interface HistorySyncData {
1472
+ metadata: HistorySyncMetadata;
1473
+ threads?: HistorySyncThread[];
1474
+ errors?: HistorySyncError[];
1475
+ }
1476
+ /**
1477
+ * History webhook value
1478
+ */
1479
+ interface HistoryValue {
1480
+ messaging_product: string;
1481
+ metadata: HistorySyncMetadata;
1482
+ history?: HistorySyncData[];
1483
+ messages?: WhatsAppMessage[];
1484
+ message_echoes?: HistoryMessageEcho[];
1485
+ }
1486
+ interface HistoryWebhookValue {
1487
+ field: 'history';
1488
+ value: HistoryValue;
1489
+ }
1490
+ //#endregion
1491
+ //#region src/core/webhook/types/messageEchoes.d.ts
1492
+ /**
1493
+ * Message echo error
1494
+ */
1495
+ interface MessageEchoError {
1496
+ message: string;
1497
+ error_data?: {
1498
+ details: string;
1499
+ };
1500
+ }
1501
+ /**
1502
+ * Message echo data (sent messages from business)
1503
+ */
1504
+ interface MessageEcho {
1505
+ from: string;
1506
+ to: string;
1507
+ id: string;
1508
+ timestamp: string;
1509
+ text?: {
1510
+ body: string;
1511
+ };
1512
+ interactive?: any;
1513
+ location?: any;
1514
+ image?: any;
1515
+ document?: any;
1516
+ voice?: any;
1517
+ audio?: any;
1518
+ video?: any;
1519
+ sticker?: any;
1520
+ button?: any;
1521
+ contacts?: any;
1522
+ reaction?: {
1523
+ message_id: string;
1524
+ emoji: string;
1525
+ };
1526
+ order?: any;
1527
+ biz_opaque_callback_data?: string;
1528
+ template?: any;
1529
+ system?: {
1530
+ type: string;
1531
+ };
1532
+ user_actions?: any[];
1533
+ }
1534
+ /**
1535
+ * SMB Message Echoes value
1536
+ */
1537
+ interface SmbMessageEchoesValue {
1538
+ metadata: WebhookMetadata;
1539
+ errors?: MessageEchoError[];
1540
+ message_echoes: MessageEcho[];
1541
+ }
1542
+ interface SmbMessageEchoesWebhookValue {
1543
+ field: 'smb_message_echoes';
1544
+ value: SmbMessageEchoesValue;
1545
+ }
1546
+ //#endregion
1547
+ //#region src/core/webhook/types/appStateSync.d.ts
1548
+ /**
1549
+ * Contact data in state sync
1550
+ */
1551
+ interface StateSyncContact {
1552
+ full_name: string;
1553
+ first_name: string;
1554
+ phone_number: string;
1555
+ }
1556
+ /**
1557
+ * State sync metadata
1558
+ */
1559
+ interface StateSyncMetadata {
1560
+ timestamp: string;
1561
+ version: number;
1562
+ }
1563
+ /**
1564
+ * State sync data
1565
+ */
1566
+ interface StateSyncData {
1567
+ type: string;
1568
+ contact: StateSyncContact;
1569
+ action: string;
1570
+ metadata: StateSyncMetadata;
1571
+ }
1572
+ /**
1573
+ * SMB App State Sync value
1574
+ */
1575
+ interface SmbAppStateSyncValue {
1576
+ messaging_product: string;
1577
+ metadata: WebhookMetadata;
1578
+ state_sync: StateSyncData[];
1579
+ }
1580
+ interface SmbAppStateSyncWebhookValue {
1581
+ field: 'smb_app_state_sync';
1582
+ value: SmbAppStateSyncValue;
1583
+ }
1584
+ //#endregion
1585
+ //#region src/core/webhook/types/index.d.ts
1129
1586
  /**
1130
1587
  * Webhook value for incoming messages
1131
1588
  */
@@ -1155,6 +1612,10 @@ interface ErrorWebhookValue {
1155
1612
  * Union type for all webhook value types
1156
1613
  */
1157
1614
  type WebhookValue = MessageWebhookValue | StatusWebhookValue | ErrorWebhookValue;
1615
+ /**
1616
+ * Union type for all webhook field values
1617
+ */
1618
+ type WebhookFieldValue = AccountUpdateWebhookValue | AccountReviewUpdateWebhookValue | AccountAlertsWebhookValue | BusinessCapabilityUpdateWebhookValue | PhoneNumberNameUpdateWebhookValue | PhoneNumberQualityUpdateWebhookValue | MessageTemplateStatusUpdateWebhookValue | TemplateCategoryUpdateWebhookValue | MessageTemplateQualityUpdateWebhookValue | FlowsWebhookValue | SecurityWebhookValue | HistoryWebhookValue | SmbMessageEchoesWebhookValue | SmbAppStateSyncWebhookValue;
1158
1619
  interface WebhookPayload {
1159
1620
  object: 'whatsapp_business_account';
1160
1621
  entry: Array<{
@@ -1162,7 +1623,7 @@ interface WebhookPayload {
1162
1623
  changes: Array<{
1163
1624
  value: WebhookValue;
1164
1625
  field: 'messages';
1165
- }>;
1626
+ } | WebhookFieldValue>;
1166
1627
  }>;
1167
1628
  }
1168
1629
  /**
@@ -1174,23 +1635,23 @@ interface WebhookMessage {
1174
1635
  id: string;
1175
1636
  from: string;
1176
1637
  timestamp: string;
1177
- type: MessageTypesEnum;
1638
+ type: any;
1178
1639
  phoneNumberId: string;
1179
1640
  displayPhoneNumber: string;
1180
1641
  profileName: string;
1181
- text?: TextMessage['text'];
1182
- image?: ImageMessage['image'];
1183
- video?: VideoMessage['video'];
1184
- audio?: AudioMessage['audio'];
1185
- document?: DocumentMessage['document'];
1186
- sticker?: StickerMessage['sticker'];
1187
- location?: LocationMessage['location'];
1188
- contacts?: ContactsMessage['contacts'];
1189
- interactive?: InteractiveMessage['interactive'];
1190
- button?: ButtonMessage['button'];
1191
- order?: OrderMessage['order'];
1192
- system?: SystemMessage['system'];
1193
- reaction?: ReactionMessage['reaction'];
1642
+ text?: any;
1643
+ image?: any;
1644
+ video?: any;
1645
+ audio?: any;
1646
+ document?: any;
1647
+ sticker?: any;
1648
+ location?: any;
1649
+ contacts?: any;
1650
+ interactive?: any;
1651
+ button?: any;
1652
+ order?: any;
1653
+ system?: any;
1654
+ reaction?: any;
1194
1655
  statuses?: StatusWebhook;
1195
1656
  originalData: any;
1196
1657
  }
@@ -1202,15 +1663,6 @@ interface WebhookEvent {
1202
1663
  value: any;
1203
1664
  timestamp: number;
1204
1665
  }
1205
- /**
1206
- * Message status enum
1207
- */
1208
- declare enum MessageStatus {
1209
- DELIVERED = "delivered",
1210
- READ = "read",
1211
- SENT = "sent",
1212
- FAILED = "failed",
1213
- }
1214
1666
  //#endregion
1215
1667
  //#region src/types/logger.d.ts
1216
1668
  interface LoggerInterface {
@@ -4140,6 +4592,65 @@ type ProcessedStatus = {
4140
4592
  displayPhoneNumber: string;
4141
4593
  status: StatusWebhook;
4142
4594
  };
4595
+ /**
4596
+ * Processed webhook field types for specialized handlers
4597
+ */
4598
+ type ProcessedAccountUpdate = {
4599
+ wabaId: string;
4600
+ value: AccountUpdateWebhookValue['value'];
4601
+ };
4602
+ type ProcessedAccountReviewUpdate = {
4603
+ wabaId: string;
4604
+ value: AccountReviewUpdateWebhookValue['value'];
4605
+ };
4606
+ type ProcessedAccountAlerts = {
4607
+ wabaId: string;
4608
+ value: AccountAlertsWebhookValue['value'];
4609
+ };
4610
+ type ProcessedBusinessCapabilityUpdate = {
4611
+ wabaId: string;
4612
+ value: BusinessCapabilityUpdateWebhookValue['value'];
4613
+ };
4614
+ type ProcessedPhoneNumberNameUpdate = {
4615
+ wabaId: string;
4616
+ value: PhoneNumberNameUpdateWebhookValue['value'];
4617
+ };
4618
+ type ProcessedPhoneNumberQualityUpdate = {
4619
+ wabaId: string;
4620
+ value: PhoneNumberQualityUpdateWebhookValue['value'];
4621
+ };
4622
+ type ProcessedMessageTemplateStatusUpdate = {
4623
+ wabaId: string;
4624
+ value: MessageTemplateStatusUpdateWebhookValue['value'];
4625
+ };
4626
+ type ProcessedTemplateCategoryUpdate = {
4627
+ wabaId: string;
4628
+ value: TemplateCategoryUpdateWebhookValue['value'];
4629
+ };
4630
+ type ProcessedMessageTemplateQualityUpdate = {
4631
+ wabaId: string;
4632
+ value: MessageTemplateQualityUpdateWebhookValue['value'];
4633
+ };
4634
+ type ProcessedFlows = {
4635
+ wabaId: string;
4636
+ value: FlowsWebhookValue['value'];
4637
+ };
4638
+ type ProcessedSecurity = {
4639
+ wabaId: string;
4640
+ value: SecurityWebhookValue['value'];
4641
+ };
4642
+ type ProcessedHistory = {
4643
+ wabaId: string;
4644
+ value: HistoryWebhookValue['value'];
4645
+ };
4646
+ type ProcessedSmbMessageEchoes = {
4647
+ wabaId: string;
4648
+ value: SmbMessageEchoesWebhookValue['value'];
4649
+ };
4650
+ type ProcessedSmbAppStateSync = {
4651
+ wabaId: string;
4652
+ value: SmbAppStateSyncWebhookValue['value'];
4653
+ };
4143
4654
  type TextProcessedMessage = ProcessedMessage & {
4144
4655
  message: Extract<WhatsAppMessage, {
4145
4656
  type: MessageTypesEnum.Text;
@@ -4208,6 +4719,20 @@ type SystemProcessedMessage = ProcessedMessage & {
4208
4719
  type MessageHandler = (whatsapp: WhatsApp, processed: ProcessedMessage) => void | Promise<void>;
4209
4720
  type StatusHandler = (whatsapp: WhatsApp, processed: ProcessedStatus) => void | Promise<void>;
4210
4721
  type FlowHandler = (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>;
4722
+ type AccountUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedAccountUpdate) => void | Promise<void>;
4723
+ type AccountReviewUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedAccountReviewUpdate) => void | Promise<void>;
4724
+ type AccountAlertsHandler = (whatsapp: WhatsApp, processed: ProcessedAccountAlerts) => void | Promise<void>;
4725
+ type BusinessCapabilityUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedBusinessCapabilityUpdate) => void | Promise<void>;
4726
+ type PhoneNumberNameUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedPhoneNumberNameUpdate) => void | Promise<void>;
4727
+ type PhoneNumberQualityUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedPhoneNumberQualityUpdate) => void | Promise<void>;
4728
+ type MessageTemplateStatusUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedMessageTemplateStatusUpdate) => void | Promise<void>;
4729
+ type TemplateCategoryUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedTemplateCategoryUpdate) => void | Promise<void>;
4730
+ type MessageTemplateQualityUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedMessageTemplateQualityUpdate) => void | Promise<void>;
4731
+ type FlowsHandler = (whatsapp: WhatsApp, processed: ProcessedFlows) => void | Promise<void>;
4732
+ type SecurityHandler = (whatsapp: WhatsApp, processed: ProcessedSecurity) => void | Promise<void>;
4733
+ type HistoryHandler = (whatsapp: WhatsApp, processed: ProcessedHistory) => void | Promise<void>;
4734
+ type SmbMessageEchoesHandler = (whatsapp: WhatsApp, processed: ProcessedSmbMessageEchoes) => void | Promise<void>;
4735
+ type SmbAppStateSyncHandler = (whatsapp: WhatsApp, processed: ProcessedSmbAppStateSync) => void | Promise<void>;
4211
4736
  type TextMessageHandler = (whatsapp: WhatsApp, processed: TextProcessedMessage) => void | Promise<void>;
4212
4737
  type ImageMessageHandler = (whatsapp: WhatsApp, processed: ImageProcessedMessage) => void | Promise<void>;
4213
4738
  type VideoMessageHandler = (whatsapp: WhatsApp, processed: VideoProcessedMessage) => void | Promise<void>;
@@ -4229,6 +4754,20 @@ declare function processWebhookMessages(request: Request, whatsapp: WhatsApp, ha
4229
4754
  statusHandler?: StatusHandler;
4230
4755
  preProcessHandler?: MessageHandler;
4231
4756
  postProcessHandler?: MessageHandler;
4757
+ accountUpdateHandler?: AccountUpdateHandler;
4758
+ accountReviewUpdateHandler?: AccountReviewUpdateHandler;
4759
+ accountAlertsHandler?: AccountAlertsHandler;
4760
+ businessCapabilityUpdateHandler?: BusinessCapabilityUpdateHandler;
4761
+ phoneNumberNameUpdateHandler?: PhoneNumberNameUpdateHandler;
4762
+ phoneNumberQualityUpdateHandler?: PhoneNumberQualityUpdateHandler;
4763
+ messageTemplateStatusUpdateHandler?: MessageTemplateStatusUpdateHandler;
4764
+ templateCategoryUpdateHandler?: TemplateCategoryUpdateHandler;
4765
+ messageTemplateQualityUpdateHandler?: MessageTemplateQualityUpdateHandler;
4766
+ flowsHandler?: FlowsHandler;
4767
+ securityHandler?: SecurityHandler;
4768
+ historyHandler?: HistoryHandler;
4769
+ smbMessageEchoesHandler?: SmbMessageEchoesHandler;
4770
+ smbAppStateSyncHandler?: SmbAppStateSyncHandler;
4232
4771
  }): Promise<Response>;
4233
4772
  /**
4234
4773
  * Handle flow requests
@@ -4256,6 +4795,20 @@ declare class WebhookProcessor {
4256
4795
  private preProcessHandler;
4257
4796
  private postProcessHandler;
4258
4797
  private flowHandlers;
4798
+ private accountUpdateHandler;
4799
+ private accountReviewUpdateHandler;
4800
+ private accountAlertsHandler;
4801
+ private businessCapabilityUpdateHandler;
4802
+ private phoneNumberNameUpdateHandler;
4803
+ private phoneNumberQualityUpdateHandler;
4804
+ private messageTemplateStatusUpdateHandler;
4805
+ private templateCategoryUpdateHandler;
4806
+ private messageTemplateQualityUpdateHandler;
4807
+ private flowsHandler;
4808
+ private securityHandler;
4809
+ private historyHandler;
4810
+ private smbMessageEchoesHandler;
4811
+ private smbAppStateSyncHandler;
4259
4812
  constructor(config: WhatsAppConfig);
4260
4813
  processVerification(mode: string | null, token: string | null, challenge: string | null): Promise<WebhookResponse>;
4261
4814
  processWebhook(request: Request): Promise<WebhookResponse>;
@@ -4330,6 +4883,76 @@ declare class WebhookProcessor {
4330
4883
  * @param handler Type-safe handler that receives system messages with guaranteed system field
4331
4884
  */
4332
4885
  onSystem(handler: SystemMessageHandler): void;
4886
+ /**
4887
+ * Register a handler for account_update webhook field
4888
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#account_update
4889
+ */
4890
+ onAccountUpdate(handler: AccountUpdateHandler): void;
4891
+ /**
4892
+ * Register a handler for account_review_update webhook field
4893
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#account_review_update
4894
+ */
4895
+ onAccountReviewUpdate(handler: AccountReviewUpdateHandler): void;
4896
+ /**
4897
+ * Register a handler for account_alerts webhook field
4898
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#account_alerts
4899
+ */
4900
+ onAccountAlerts(handler: AccountAlertsHandler): void;
4901
+ /**
4902
+ * Register a handler for business_capability_update webhook field
4903
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#business_capability_update
4904
+ */
4905
+ onBusinessCapabilityUpdate(handler: BusinessCapabilityUpdateHandler): void;
4906
+ /**
4907
+ * Register a handler for phone_number_name_update webhook field
4908
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#phone_number_name_update
4909
+ */
4910
+ onPhoneNumberNameUpdate(handler: PhoneNumberNameUpdateHandler): void;
4911
+ /**
4912
+ * Register a handler for phone_number_quality_update webhook field
4913
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#phone_number_quality_update
4914
+ */
4915
+ onPhoneNumberQualityUpdate(handler: PhoneNumberQualityUpdateHandler): void;
4916
+ /**
4917
+ * Register a handler for message_template_status_update webhook field
4918
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#message_template_status_update
4919
+ */
4920
+ onMessageTemplateStatusUpdate(handler: MessageTemplateStatusUpdateHandler): void;
4921
+ /**
4922
+ * Register a handler for template_category_update webhook field
4923
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#template_category_update
4924
+ */
4925
+ onTemplateCategoryUpdate(handler: TemplateCategoryUpdateHandler): void;
4926
+ /**
4927
+ * Register a handler for message_template_quality_update webhook field
4928
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#message_template_quality_update
4929
+ */
4930
+ onMessageTemplateQualityUpdate(handler: MessageTemplateQualityUpdateHandler): void;
4931
+ /**
4932
+ * Register a handler for flows webhook field
4933
+ * @see https://developers.facebook.com/docs/whatsapp/flows/guides/implementingyourflowendpoint#webhooks
4934
+ */
4935
+ onFlows(handler: FlowsHandler): void;
4936
+ /**
4937
+ * Register a handler for security webhook field
4938
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#security
4939
+ */
4940
+ onSecurity(handler: SecurityHandler): void;
4941
+ /**
4942
+ * Register a handler for history webhook field
4943
+ * @see https://developers.facebook.com/docs/graph-api/webhooks/reference/whatsapp-business-account#history
4944
+ */
4945
+ onHistory(handler: HistoryHandler): void;
4946
+ /**
4947
+ * Register a handler for smb_message_echoes webhook field
4948
+ * @see https://developers.facebook.com/docs/graph-api/webhooks/reference/whatsapp-business-account#smb_message_echoes
4949
+ */
4950
+ onSmbMessageEchoes(handler: SmbMessageEchoesHandler): void;
4951
+ /**
4952
+ * Register a handler for smb_app_state_sync webhook field
4953
+ * @see https://developers.facebook.com/docs/graph-api/webhooks/reference/whatsapp-business-account#smb_app_state_sync
4954
+ */
4955
+ onSmbAppStateSync(handler: SmbAppStateSyncHandler): void;
4333
4956
  getClient(): WhatsApp;
4334
4957
  getConfig(): WabaConfigType;
4335
4958
  }