Zalo OA icon

Zalo OA

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

Overview

This node interacts with the Zalo Official Account (OA) API, enabling automation and management of various OA features. 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.

Common scenarios for this node include:

  • Fetching recent or specific types of articles from a Zalo OA to display or process them in workflows.
  • Automating content management by integrating article data into other systems.
  • Monitoring published content for analytics or notifications.

Practical example:

  • A marketing team can use this node to automatically pull the latest 10 normal articles from their Zalo OA and send summaries via email or post them on another platform.

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 JSON contains the response from the Zalo OA API endpoint /article/getslice. It includes:

  • data.medias: An array of article objects representing the fetched articles.
  • Additional metadata about the request and usage guidance.

The node also adds a usage guide field when articles are present, indicating how to use the article id as a token for further operations like fetching article details.

No binary data is output by this operation.

Example snippet of output structure:

{
  "data": {
    "medias": [
      {
        "id": "string",
        "title": "string",
        "author": "string",
        "description": "string",
        "content": "string",
        ...
      }
    ]
  },
  "usage_guide": {
    "message": "Use the 'id' field of the article as the article token",
    "example": "When getting article details, use the 'id' value as the token"
  }
}

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 endpoint /article/getslice with query parameters for offset, limit, and type.
  • The maximum allowed limit per request is capped at 50 by the node.

Troubleshooting

  • Common issues:

    • Invalid or expired access token causing authentication errors.
    • Requesting more than the allowed limit (over 50) may result in API errors.
    • Incorrect type parameter values other than "normal" or "video" will cause failures.
    • Network or connectivity issues to the Zalo API endpoint.
  • Error messages:

    • Errors returned from the API are included in the output JSON under an error flag with descriptive messages.
    • Typical error message example:
      "Lỗi khi lấy danh sách bài viết: <error message>" (Error when fetching article list)
    • Suggestions often recommend verifying the access token validity, permissions granted to the OA, and correctness of input parameters.
  • Resolution tips:

    • Ensure the API credential is valid and has necessary permissions.
    • Use only supported values for the type property.
    • Limit the limit property to 50 or fewer.
    • Check network connectivity and API status.

Links and References

Discussion