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, specifically providing functionality to retrieve a list of product categories associated with a Zalo OA store. The "Lấy Danh Sách Danh Mục" operation fetches a paginated list of categories, which can be useful for managing or displaying product categories in automation workflows.

Typical use cases include:

  • Synchronizing category data from Zalo OA into other systems.
  • Displaying available product categories in a custom dashboard.
  • Automating inventory or catalog updates based on category information.

For example, you might use this node to fetch the first 10 categories starting from an offset of 0 to display them in a user interface or to process them further in your workflow.

Properties

Name Meaning
Vị Trí Bắt Đầu (offset) The starting position (offset) in the list of categories to begin fetching from. Default is 0.
Số Lượng (count) The number of categories to retrieve. Default is 10. The maximum allowed is capped at 50 by the API.

Output

The output JSON contains the response from the Zalo OA API endpoint that returns the category list. It typically includes:

  • A data object containing an array of category items.
  • Each category item may have fields such as category ID, name, description, status, and parent category if applicable.
  • Additional metadata related to pagination or API response status.

Example structure (simplified):

{
  "data": {
    "categories": [
      {
        "id": "category_id_1",
        "name": "Category Name 1",
        "description": "Description of category 1",
        "status": "show",
        "parent_id": "parent_category_id"
      },
      ...
    ]
  },
  "error": false,
  "message": "Success"
}

If an error occurs, the output JSON will contain an error field set to true, a descriptive message, and possibly additional details under response.

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 with appropriate headers including the access token.
  • No additional external dependencies beyond standard HTTP client libraries bundled with n8n.

Troubleshooting

  • Common issues:

    • Invalid or expired access token leading to authentication errors.
    • Exceeding the maximum allowed count (the API caps it at 50).
    • Network connectivity problems or incorrect API endpoint configuration.
    • Insufficient permissions granted to the access token for reading category data.
  • Error messages:

    • "Error getting category list: <error message>": Indicates failure in calling the API; check token validity and permissions.
    • Response status codes like 401 Unauthorized or 403 Forbidden suggest authentication or permission issues.
    • If the response contains an error object, review the message and suggested actions.
  • Resolutions:

    • Ensure the API access token is valid and has required scopes.
    • Verify the offset and count parameters are within acceptable ranges.
    • Check network connectivity and proxy settings if applicable.
    • Review Zalo OA API documentation for any recent changes in endpoints or required permissions.

Links and References

Discussion