Zalo icon

Zalo

Send messages and interact with Zalo Official Account API

Overview

The Zalo node's "Send Quoted Message" operation allows you to send a text message to a Zalo user while quoting a previous message. This is particularly useful for customer support, chatbots, or any workflow where referencing an earlier message in the conversation provides context. For example, you can reply to a user's question by quoting their original message, making the conversation clearer and more interactive.

Practical scenarios:

  • Customer service agents replying to specific user queries.
  • Automated bots providing follow-up information based on a user's previous message.
  • Any workflow that requires contextual replies within Zalo chats.

Properties

Name Type Meaning
User ID String The ID of the Zalo user to send the message to. Use {{$fromAI("userId")}} for AI integration.
Message Text String The text message to send.
Quote Message ID String ID of the message to quote (from original message).

Output

The output for each processed item will be a JSON object with the following structure:

{
  "success": true,
  "response": { /* Zalo API response object */ }
}
  • success: Boolean indicating if the message was sent successfully.
  • response: The raw response from the Zalo API, which typically includes details about the sent message.

If an error occurs and "Continue On Fail" is enabled, the output will look like:

{
  "success": false,
  "error": "Error message"
}

Dependencies

  • External Service: Requires access to the Zalo Official Account API.
  • API Credentials: You must configure Zalo API credentials (zaloApi) in n8n, including at least the Secret Key, Access Token, and Refresh Token.
  • Environment: Your n8n instance must be able to reach https://openapi.zalo.me/v3.0/oa/message/cs.

Troubleshooting

Common Issues:

  • Invalid or expired tokens: If your access or refresh token has expired, you'll need to reauthorize via the PKCE flow.
  • Missing credentials: If the Secret Key or other required credential fields are missing, the node will throw an error.
  • Incorrect User ID or Quote Message ID: If these IDs are invalid or do not exist, the Zalo API may return an error.

Common Error Messages:

  • "Your Zalo access token has expired and no refresh token is available."
    Resolution: Update your credentials and complete the PKCE authorization process again.
  • "Failed to send quoted message to Zalo: ..."
    Resolution: Check the error message for details. Ensure all input properties are correct and your credentials are valid.
  • "Secret Key is required to exchange code for tokens."
    Resolution: Make sure your Zalo API credentials include the Secret Key.

Links and References

Discussion