-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Bug: Webhook handlers silently drop all but the first message in a batch
Reported by: @SmittieC
Related PR: #2975
Related comment: #2975 (comment)
Description
The handle_meta_cloud_api_message Celery task (and similarly the Turn.io handler) calls MetaCloudAPIMessage.parse / TurnWhatsappMessage.parse, which is hardcoded to access only the first element of the messages array (messages[0]) in a Meta/Turn.io webhook payload.
According to Meta's API documentation, a single webhook delivery can contain multiple messages. If a webhook delivers a batch of messages, all messages after the first will be silently ignored, leading to data loss without any error or notification.
Affected code
apps/channels/tasks.py—handle_meta_cloud_api_messageapps/channels/tasks.py—handle_turn_messageapps/channels/datamodels.py—MetaCloudAPIMessage.parse/TurnWhatsappMessage.parse
Suggested Fix
Modify the task(s) to iterate over the messages array in the webhook payload and process each message individually, rather than only processing the first one.
Notes
- Deferred from PR Meta Cloud API Whatsapp Integration #2975 to a future PR.
- Existing tests do not cover the multi-message scenario.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status