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 users to manage and interact with their Zalo OA content programmatically. Specifically, the "Lấy Danh Sách Bài Viết" (Get Article List) operation retrieves a list of articles published on the Zalo OA.

Typical use cases include:

  • Fetching recent or specific types of articles from a Zalo OA for display or further processing.
  • Automating content management workflows by retrieving article metadata.
  • Integrating Zalo OA articles into other systems such as CMS, newsletters, or analytics platforms.

For example, a marketing team could use this node to automatically pull the latest 10 normal articles starting from the first one, then process or share them elsewhere.

Properties

Name Meaning
Vị Trí Bắt Đầu The starting position (offset) in the list of articles to retrieve.
Số Lượng The number of articles to fetch (limit).
Loại Bài Viết The type of articles to retrieve. Options: "Bài Viết Thường" (normal), "Bài Viết Video" (video).

Output

The output is a JSON object containing the response from the Zalo OA API endpoint that returns the article list. The main structure includes:

  • data.medias: An array of article objects representing each article retrieved.
  • usage_guide: An optional field providing guidance on how to use the article IDs as tokens for further operations like fetching article details.

Each article object typically contains metadata such as article ID, title, author, description, cover image URL, status, and other relevant fields depending on the API response.

No binary data output is involved in this operation.

Dependencies

  • Requires an API authentication token (access token) for the Zalo Official Account API.
  • Uses the Axios HTTP client library to make REST API calls.
  • The node expects proper configuration of credentials within n8n to provide the access token.
  • The API endpoint used is https://openapi.zalo.me/v2.0/article/getslice.

Troubleshooting

Common Issues

  • Invalid or expired access token: The API call will fail if the access token is missing, invalid, or expired.
  • Incorrect parameters: Providing an offset or limit outside allowed ranges or unsupported article types may cause errors.
  • API version limitations: The code notes that this endpoint is supported only in API v2.0; using it with v3.0 might cause issues.
  • Network or permission errors: Lack of proper permissions or network connectivity issues can prevent successful API calls.

Error Messages and Resolutions

  • Errors returned from the API are captured and included in the output JSON under an error flag with descriptive messages.
  • If the API returns an error related to access rights, ensure the Zalo OA has granted the necessary permissions and the access token is valid.
  • For parameter-related errors, verify that offset and limit are numbers within acceptable ranges and that type is either "normal" or "video".
  • If persistent errors occur, consult the latest Zalo OA API documentation at https://developers.zalo.me/docs for updates or changes.

Links and References

Discussion