Zalo Gom Tin Nhắn icon

Zalo Gom Tin Nhắn

Gom tin nhắn Zalo và chờ trong một khoảng thời gian

Overview

This node, named "Zalo Gom Tin Nhắn," is designed to collect and aggregate chat messages from Zalo conversations over a short period before outputting them together. It temporarily stores incoming message contents associated with a unique conversation thread ID, waits for a specified debounce time, and then outputs the combined messages as a single batch.

This functionality is useful in scenarios where multiple related messages arrive in quick succession and you want to process or forward them as one consolidated message rather than individually. For example, it can be used to reduce noise in chatbots by grouping user inputs sent rapidly or to accumulate partial messages before triggering further processing.

Properties

Name Meaning
Loại Cơ Sở Dữ Liệu Choose the type of database to use for temporary message storage. Options: Redis, PostgreSQL, MySQL.
ID Nhóm Chat (Thread ID) Unique identifier of the chat conversation thread to group messages by.
Nội Dung Tin Nhắn The content of the message to be collected and aggregated.
Thời Gian Chờ (giây) Wait time in seconds before aggregating and sending the collected messages.

Output

The node outputs JSON data on its main output channel structured as follows:

{
  "threadId": "string",          // The unique thread ID of the conversation
  "messages": ["string", ...],   // Array of collected message contents
  "content": "string"            // All collected messages concatenated into a single string separated by spaces
}

If no messages are collected after the wait time, the node skips outputting any data on the main output. The second output channel is used to pass through skipped or failed items.

No binary data is produced by this node.

Dependencies

  • Requires connection credentials for one of the supported databases (Redis, PostgreSQL, or MySQL) to store temporary message data.
  • The node uses an external utility module (dbManager) to abstract database operations.
  • Proper configuration of the chosen database credential within n8n is necessary.
  • No other external services or APIs are required.

Troubleshooting

  • Common Issues:

    • Misconfiguration or missing database credentials will cause failures when attempting to read/write temporary data.
    • If multiple executions happen very quickly, some intermediate messages may be skipped intentionally due to the debounce logic.
    • Long wait times may delay message processing undesirably.
  • Error Messages:

    • Errors related to database connectivity or operations will be logged with stack traces.
    • If the node encounters an error but is configured to continue on fail, it outputs an error object on the second output channel.
  • Resolutions:

    • Verify that the correct database credentials are set up and accessible.
    • Adjust the "Thời Gian Chờ (giây)" property to balance between responsiveness and message aggregation needs.
    • Monitor logs for detailed error information.

Links and References

Discussion