Zalo icon

Zalo

Send messages and interact with Zalo Official Account API

Overview

The Zalo n8n node allows you to send a template message with user information to a Zalo user via the Zalo Official Account API. This operation is useful for scenarios where you want to prompt a Zalo user to share their personal information (such as name, phone number, etc.) in a structured and interactive way.

Common use cases:

  • Onboarding flows where you need to collect user details.
  • Customer support bots that require user verification or additional info.
  • Marketing campaigns requesting users to update their profile or preferences.

Example:
A business wants to verify a user's identity before providing support. The node sends a template message asking the user to confirm their name and contact details by clicking on the provided template.


Properties

Name Type Meaning
Template Title String Title displayed in the template message.
Template Subtitle String Subtitle displayed below the title in the template message.
Image URL String URL of the image to display in the template. If not provided, a default Zalo image is used.
User ID String The ID of the Zalo user to send the template to. Use {{$fromAI("userId")}} for AI integration.

Output

The node outputs a JSON object for each input item processed. The structure is:

{
  "success": true,
  "response": { /* Zalo API response object */ }
}
  • success: Indicates if the message was sent successfully (true or false).
  • response: Contains the raw response from the Zalo API, which typically includes status codes and any returned data.
  • error (only if failed): Error message string describing what went wrong.

Note: No binary data is output by this operation.


Dependencies

  • External Service: Requires access to the Zalo Official Account API.
  • API Credentials: You must configure Zalo API credentials in n8n, including at least the Secret Key.
  • n8n Configuration: Ensure your n8n instance can reach Zalo's API endpoints.

Troubleshooting

Common Issues:

  • Invalid or expired access token: If your Zalo credentials are outdated, the node will fail. Refresh your tokens using the PKCE flow.
  • Missing required fields: All properties except "Image URL" are required. Omitting them will result in an error.
  • User ID not found: If the provided User ID does not exist or is incorrect, Zalo will return an error.

Error Messages & Resolutions:

  • "Your Zalo access token has expired and no refresh token is available...": Update your credentials and reauthorize via PKCE.
  • "Failed to send template message to Zalo: ...": Check your input parameters and network connectivity.
  • "Secret Key is required to exchange code for tokens...": Make sure your Zalo credentials in n8n include the Secret Key.

Links and References

Discussion