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 various aspects of their Zalo OA such as messaging, followers, tags, articles, products, categories, and orders. Specifically, the "Tạo Danh Mục" (Create Category) operation allows users to create a new product category within their Zalo OA store.

Typical use cases include:

  • Organizing products into categories for better management and display in the Zalo OA store.
  • Automating category creation as part of an e-commerce workflow.
  • Managing product catalogs dynamically based on external data sources.

Example: Automatically creating a new product category named "Summer Collection" with a description and status set to visible, so that newly added products can be grouped under this category in the Zalo OA store.

Properties

Name Meaning
Tên Danh Mục The name of the product category to be created.
Mô Tả Danh Mục A description of the product category.
URL Hình Ảnh Danh Mục URL of the image representing the category (not explicitly used in the createCategory operation but may be relevant elsewhere).
Trạng Thái Danh Mục Display status of the category; options are "Hiển Thị" (show) or "Ẩn" (hide).

Note: The operation also supports an optional parentId parameter (not listed in your provided properties but present in the code) to specify a parent category ID for hierarchical categorization.

Output

The output is a JSON object containing the response from the Zalo OA API after attempting to create the category. This typically includes:

  • Confirmation of the created category details.
  • Status codes or messages indicating success or failure.
  • In case of error, an error object with message and possibly response details.

Example output structure (simplified):

{
  "id": "123456",
  "name": "Tên Danh Mục",
  "description": "Mô tả danh mục sản phẩm",
  "status": "show",
  "parent_id": "optional_parent_id"
}

If an error occurs, the output JSON will contain fields like:

{
  "error": true,
  "message": "Error creating category: <error message>",
  "response": { /* detailed API error response */ },
  "suggestion": "Please check the category parameters and OA access permissions."
}

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 Zalo OA API endpoint at https://openapi.zalo.me/v3.0/oa/store/category/create.
  • Requires proper OAuth credentials configured in n8n to obtain the access token.
  • Depends on the axios HTTP client library for making API requests.

Troubleshooting

Common Issues

  • Invalid or expired access token: The API call will fail if the access token is missing, invalid, or expired.
  • Insufficient permissions: The token must have the necessary rights to create categories in the Zalo OA.
  • Incorrect parameters: Missing required fields like category name or invalid status values can cause errors.
  • Network issues: Connectivity problems can prevent successful API calls.

Error Messages and Resolutions

  • "Error creating category: <message>": Indicates failure returned by the API. Check the message for specifics.
  • Response status codes like 401 or 403 suggest authentication or permission issues.
  • Suggestions included in error responses advise verifying category parameters and OA access permissions.

To resolve errors:

  • Ensure the API credential is correctly set up and valid.
  • Verify all required input fields are provided and correctly formatted.
  • Confirm the Zalo OA has granted the necessary permissions to the application.
  • Review network connectivity and retry if transient errors occur.

Links and References

Discussion