Overview
This node is designed to debounce and group incoming WhatsApp messages from the same sender before forwarding them as a single combined message. It collects messages received in quick succession, waits for a specified time interval without new messages, then sends the grouped messages together to a configured webhook URL. This helps reduce message noise and allows downstream workflows to process consolidated message batches instead of individual fragmented messages.
Common scenarios where this node is beneficial include:
- Handling rapid-fire WhatsApp messages from users that should be processed as one logical message.
- Reducing API calls or processing overhead by batching multiple messages into one.
- Preprocessing chat data before sending it to another system or workflow for analysis or response.
Practical example:
If a user sends three short messages quickly ("Hi", "Are you there?", "Please respond"), this node can combine them into a single message "Hi Are you there? Please respond" (or joined with a newline) and send it once after the wait time expires.
Properties
| Name | Meaning |
|---|---|
| Webhook URL | The URL of the webhook endpoint where the grouped message will be sent for further processing. |
| Tempo de Espera (s) | The waiting time in seconds to collect new messages before sending the grouped message. |
| Campo de ID Único | The JSON path to the field uniquely identifying the sender (e.g., sender.id, chatId). |
| Campo da Mensagem | The JSON path to the field containing the text of the message (e.g., message.text). |
| String de Junção | The string used to join multiple messages when combining them (e.g., space " " or newline). |
Output
The node does not produce any direct output items in the workflow (empty output array). Instead, it asynchronously sends the grouped messages as HTTP POST requests to the configured webhook URL.
The payload sent to the webhook includes:
- All original JSON fields of the first message in the group.
- The combined message text under the configured message field path.
- A new field
groupedMessagescontaining an array of all individual messages grouped. - A new field
messageCountindicating how many messages were grouped.
No binary data is output by this node.
Dependencies
- Requires an active internet connection to send HTTP POST requests.
- Uses the Axios library internally to perform HTTP requests.
- Needs a valid webhook URL accessible from the n8n instance.
- Requires an API key credential configured in n8n for authentication with the external service (not detailed in code but indicated by credentials requirement).
Troubleshooting
Common issues:
- Incorrect JSON paths for unique ID or message fields may cause messages to be ignored or grouping to fail.
- Invalid or unreachable webhook URL will result in errors when sending grouped messages.
- If messages are not arriving grouped, the wait time might be too short or messages too spaced out.
Error messages:
- Errors during HTTP POST to the webhook are logged to the console with the sender's unique ID.
- If the node is set to continue on failure, errors are attached to the output item; otherwise, execution stops.
Resolutions:
- Verify and test JSON paths for unique ID and message fields match the input data structure.
- Ensure the webhook URL is correct and the receiving service is operational.
- Adjust the wait time parameter to balance responsiveness and grouping effectiveness.
Links and References
- Axios GitHub Repository – HTTP client used internally.
- n8n Documentation: Creating Custom Nodes – Guide on building nodes similar to this one.
- JSONPath Syntax – For understanding how to specify JSON paths in properties.