WhatsApp - Message Grouper icon

WhatsApp - Message Grouper

Agrupa mensagens rápidas do mesmo usuário. Funciona com Trigger simples ou Multi Trigger. IMPORTANTE: Coloque logo após o Trigger!

WhatsApp - Message Grouper

AI-generated

Overview

This node groups rapid WhatsApp messages from the same user into a single aggregated message. It is useful in scenarios where multiple quick messages need to be combined before processing, such as chatbots or message triggers that receive bursts of messages. For example, it can wait for a few seconds to collect messages, or process immediately if a maximum message count is reached, helping to reduce message noise and improve handling efficiency.

Use Case Examples

  1. A chatbot receiving multiple short messages from a user within seconds can use this node to group them into one message before processing.
  2. A multi-trigger workflow can use this node to aggregate messages from the same chat to avoid processing each message individually.

Properties

Name Meaning
Ativar Agrupamento Enable or disable message grouping. If enabled, messages are grouped; if disabled, messages are processed immediately.
Tempo de Espera (segundos) Maximum time in seconds to wait for messages before processing the group.
Máximo de Mensagens Maximum number of messages to collect before processing immediately, even if the timer has not expired.
Timeout de Inatividade (segundos) Process the group if no new messages arrive within this inactivity timeout period (0 disables this feature).
Campo para Agrupar The JSON field containing the message text to be grouped, e.g., {{ $json.body }} or {{ $json.message }}.
Campo do Chat ID The JSON field identifying the chat, e.g., {{ $json.from }} or {{ $json.chatId }}.
Anti-Loop If enabled, blocks messages sent by the bot itself to prevent loops.
Separador de Mensagens String used to separate grouped messages in the final aggregated text, e.g., \n\n, |, or ---.

Output

JSON

  • groupedText - The final aggregated text combining all grouped messages.
  • body - Same as groupedText, the combined message body.
  • message - Same as groupedText, the combined message content.
  • text - Same as groupedText, the combined message text.
  • messageCount - Number of messages grouped together.
  • isGrouped - Boolean indicating if more than one message was grouped.
  • separator - The separator string used between messages.
  • individualMessages - Array of individual message texts that were grouped.
  • originalFirstMessage - The text of the first message in the group.
  • messagesDetailed - Array of objects with detailed info for each message: index, text, timestamp, and sender.
  • from - Sender identifier of the first message.
  • chatId - Chat identifier of the first message.
  • to - Recipient identifier from the first message.
  • timestamp - Timestamp of the first message.
  • session - Session or sessionId from the first message.
  • _originalData - The original JSON data of the first message.

Troubleshooting

  • If the chat ID field is not correctly configured or missing, the node will ignore messages because it cannot identify the chat.
  • If Anti-Loop is enabled, messages sent by the bot itself will be blocked and not processed, which might cause confusion if not expected.
  • If the message field is incorrectly set or the JSON path is invalid, the node may produce empty or incorrect grouped text.
  • Ensure that the node is placed immediately after a Trigger node, as it relies on incoming messages to group them properly.

Discussion