Zalo OA icon

Zalo OA

Tương tác với Zalo Official Account API

Overview

This node integrates with the Zalo Official Account (OA) API, enabling automation of various interactions with Zalo OA users and content. It supports sending different types of messages (text, image, file, list), managing followers and tags, uploading media, handling articles and products, and more.

The "Gửi Tin Nhắn Văn Bản" (Send Text Message) operation specifically allows sending plain text messages to a specified user by their User ID. This is useful for automated customer support, notifications, or marketing messages via Zalo.

Practical example:
You can use this node to send order confirmation messages to customers on Zalo after they complete a purchase on your e-commerce platform.


Properties

Name Meaning
User ID The unique identifier of the recipient user on Zalo who will receive the text message.
Nội Dung Tin Nhắn The content of the text message to be sent to the user.

Output

  • The output is a JSON object containing the response from the Zalo OA API after attempting to send the text message.
  • The structure typically includes success status, message IDs, error codes if any, and other metadata returned by the API.
  • The output is paired with the input item index for traceability.
  • This node does not output binary data for this operation.

Example output snippet (conceptual):

{
  "message_id": "123456789",
  "error": 0,
  "message": "Message sent successfully"
}

Dependencies

  • Requires an API authentication token (access token) for Zalo OA, configured in n8n credentials.
  • Uses the Zalo OA REST API endpoint https://openapi.zalo.me/v2.0/oa/message.
  • Depends on the axios HTTP client library for making API requests.
  • No additional external services are required beyond Zalo OA API access.

Troubleshooting

  • Common issues:

    • Invalid or expired access token leading to authentication errors.
    • Incorrect User ID causing message delivery failure.
    • Message content exceeding allowed length or containing unsupported characters.
    • Network connectivity issues preventing API calls.
  • Error messages and resolutions:

    • "Invalid access token": Verify that the API key credential is correct and has not expired.
    • "User not found" or similar: Confirm the User ID is valid and the user has interacted with the OA before.
    • "Message content invalid": Check the text content for unsupported characters or formatting.
    • API rate limits exceeded: Implement retry logic or reduce message frequency.
  • If the node is set to continue on fail, errors will be returned as part of the output JSON with an error field.


Links and References

Discussion