Zalo icon

Zalo

Send messages and interact with Zalo Official Account API

Overview

The Zalo node for n8n enables you to send text messages to Zalo users via the Zalo Official Account API. This is particularly useful for businesses or services that want to automate customer communication, notifications, or support through Zalo, a popular messaging platform in Vietnam.

Common scenarios:

  • Sending automated welcome or support messages to users who interact with your Zalo Official Account.
  • Notifying users about order status, promotions, or important updates.
  • Integrating Zalo messaging into broader automation workflows (e.g., after receiving a new order, send a confirmation message).

Practical example:
When a user submits a form on your website, you can use this node to automatically send them a personalized thank-you message on Zalo.


Properties

Name Type Meaning
User ID String The unique identifier of the Zalo user to whom the message will be sent.
Message String The text content of the message to send. Example: "Hello, how can I help you today?"

Output

The node outputs a JSON object for each processed item with the following structure:

{
  "success": true,
  "response": { /* Zalo API response object */ }
}
  • success: Indicates whether the message was sent successfully (true) or if there was an error (false).
  • response: Contains the raw response from the Zalo API, which may include details such as message IDs, status codes, and any additional information returned by Zalo.

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 in n8n, specifically:
    • Access Token (managed via OAuth2/PKCE flow)
    • Secret Key
  • n8n Configuration: Ensure the Zalo node has valid credentials set up in the n8n credential manager.

Troubleshooting

Common issues:

  • Invalid or expired access token: If your access token has expired and no refresh token is available, you'll need to reauthorize the node using the PKCE flow.
  • Incorrect User ID: If the provided User ID does not exist or is incorrect, the message will not be delivered, and the API may return an error.
  • Missing required fields: Both "User ID" and "Message" are required. Omitting either will result in an error.

Common error messages:

  • "Your Zalo access token has expired and no refresh token is available."
    Resolution: Reauthorize your Zalo credentials using the PKCE authorization process.
  • "Failed to send text message to Zalo: ..."
    Resolution: Check the error details for more information. Common causes include invalid credentials, network issues, or incorrect parameters.
  • "Secret Key is required to exchange code for tokens."
    Resolution: Make sure your Zalo API credentials in n8n include the Secret Key.

Links and References

Discussion