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 and management tasks related to a Zalo OA. Specifically, the "Lấy Danh Sách Tag" (Get Tag List) operation retrieves a list of tags associated with the OA. Tags are useful for categorizing or segmenting followers or users interacting with the OA.

Common scenarios where this node is beneficial include:

  • Managing user segmentation by retrieving available tags to assign or remove tags from users.
  • Automating marketing campaigns or customer support workflows based on user tags.
  • Synchronizing tag data between Zalo OA and other systems.

Practical example:

  • A marketing automation workflow fetches the current list of tags to display them in a UI or to use their IDs/names for tagging users dynamically in subsequent steps.

Properties

Name Meaning
Số Lượng Tối Đa The starting position (offset) from which to begin fetching the list of tags.
Số Lượng The number of tags to retrieve (limit/count).

Output

The output JSON contains the response from the Zalo OA API's tag listing endpoint. It includes:

  • data.tags: An array of tag objects, each enriched with normalized fields:
    • tag_id: The unique identifier of the tag.
    • tag_name: The name of the tag.
    • display_info: A string combining ID and name for easy display (e.g., "ID: 123 - Name: VIP").
  • usage_guide: An object providing usage instructions and examples on how to use tag_id or tag_name when assigning or removing tags in other operations.

If an error occurs during the API call, the output JSON will contain:

  • error: true
  • message: Description of the error.
  • response: Raw API error response if available.
  • suggestion: Recommendations to resolve the issue, such as checking access permissions or token validity.

No binary data is output by this operation.

Dependencies

  • Requires an active Zalo Official Account API access token credential configured in n8n.
  • Uses the Zalo OA API base URL: https://openapi.zalo.me/v2.0/oa.
  • Makes HTTP GET requests to the /tag/gettagsofoa endpoint with query parameters offset and count.
  • Relies on the axios library for HTTP requests.

Troubleshooting

Common Issues

  • Invalid or expired access token: The API may return authorization errors if the access token is invalid or expired.
  • Incorrect offset or count values: Providing negative or excessively large numbers might cause unexpected results or errors.
  • API version fallback: If the v3.0 API call fails, the node attempts to retry using the v2.0 API endpoint transparently.

Error Messages and Resolutions

  • "Lỗi khi gọi API gettagsofoa v3.0": Indicates failure calling the latest API version. The node retries with v2.0 automatically.
  • "Lỗi khi lấy danh sách tag": General failure to fetch tags; check OA access rights and token validity.
  • Network or connectivity errors: Ensure that the n8n instance has internet access and can reach the Zalo API endpoints.

In all cases, verify that the Zalo OA has granted the necessary permissions and that the access token is current.

Links and References

Discussion