ZaloOA icon

ZaloOA

Consume ZaloOA API

Overview

This n8n node allows you to send a template message via the Zalo Official Account (OA) API. It is designed for scenarios where you need to automate communication with users on Zalo, such as sending notifications, alerts, or transactional messages using predefined templates. The node supports both authenticated and anonymous messaging, making it suitable for customer support bots, marketing campaigns, or any workflow that requires automated Zalo messaging.

Practical examples:

  • Sending order confirmation messages to customers using a Zalo message template.
  • Notifying users about account activity or promotions through Zalo OA.
  • Engaging with anonymous users in a chat-based support flow.

Properties

Name Meaning
Authentication Select the authentication method. Options: Parameter Credentials, Predefined Credentials.
Base URL The base URL that serves the Zalo OA API. Only shown if "Parameter Credentials" is selected.
Access Token OA access token required for authenticating API requests. Only shown if "Parameter Credentials" is selected.
Send To Anonymous Whether the user is anonymous or not. If true, use "Anonymous ID" and "Conversation ID"; if false, use "User ID".
User ID User ID of Zalo. Required when "Send To Anonymous" is false.
Anonymous ID The ID representing the anonymous user. Required when "Send To Anonymous" is true.
Conversation ID The ID of the conversation. Required when "Send To Anonymous" is true.

Output

The node outputs a json field containing the response from the Zalo OA API after attempting to send the template message. The structure typically includes:

  • Status code or success indicator
  • Message or error description
  • Any data returned by the Zalo API (such as message ID, timestamp, etc.)

Note: The exact output fields depend on the Zalo OA API's response for the template message endpoint.

Dependencies

  • Zalo Official Account API: Requires an active Zalo OA and valid access token.
  • API Credentials: Either provided directly as parameters or via predefined credentials in n8n.
  • n8n Configuration: No special environment variables are needed unless using predefined credentials.

Troubleshooting

Common issues:

  • Invalid Access Token: Ensure the access token is correct and has not expired.
  • Missing Required Fields: Make sure to provide either "User ID" or both "Anonymous ID" and "Conversation ID" based on the "Send To Anonymous" setting.
  • API Errors: If the Zalo API returns an error, check the error message for details (e.g., invalid template, user not found).

Common error messages:

  • "Invalid OA access token": Check your access token and re-authenticate if necessary.
  • "Missing required parameter": Verify all required properties are filled according to the chosen options.
  • "User not found": Confirm the User ID or Anonymous ID/Conversation ID is correct and exists in Zalo.

Links and References

Discussion