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, and store products. Specifically, the "Tạo Sản Phẩm" (Create Product) operation allows users to create new products in their Zalo OA store by providing product details like name, price, description, code, images, and display status.

Common scenarios for this node include:

  • Automating product creation in a Zalo OA store from external systems or workflows.
  • Managing product catalogs programmatically without manual entry.
  • Integrating Zalo OA product management into broader marketing or sales automation pipelines.

Practical example:

  • An e-commerce platform automatically pushes new product listings to a Zalo OA store whenever a new item is added to its inventory system, using this node to create the product with all relevant details.

Properties

Name Meaning
Tên Sản Phẩm The name/title of the product to be created.
Giá Sản Phẩm The price of the product in Vietnamese Dong (VND).
Mô Tả Sản Phẩm A textual description of the product.
Mã Sản Phẩm The product code or SKU identifier.
URL Hình Ảnh Sản Phẩm URLs of product images, multiple URLs separated by commas.
Trạng Thái Sản Phẩm Display status of the product; options are "Hiển Thị" (show) or "Ẩn" (hide).

Note: The property photos is internally handled as an array of objects with photo_url fields parsed from the input URLs.

Output

The node outputs JSON data representing the response from the Zalo OA API after attempting to create the product. This typically includes:

  • Confirmation of product creation with product ID and details.
  • Status messages indicating success or failure.
  • In case of errors, an error object with message, response details, and suggestions.

No binary data output is involved in this operation.

Example output structure (simplified):

{
  "data": {
    "id": "product_id",
    "name": "Product Name",
    "price": 100000,
    "description": "Product description",
    "code": "SKU123",
    "photos": [
      {"photo_url": "https://example.com/image1.jpg"},
      {"photo_url": "https://example.com/image2.jpg"}
    ],
    "status": "show"
  },
  "message": "Success"
}

Or on error:

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

Dependencies

  • Requires an active Zalo Official Account API access token credential configured in n8n.
  • Uses the Zalo OA API endpoint at https://openapi.zalo.me/v2.0/oa/store/product/create.
  • HTTP requests are made via Axios library.
  • Content-Type for requests is application/json.
  • Proper permissions and valid access token are necessary to create products successfully.

Troubleshooting

Common Issues

  • Invalid or expired access token: The API will reject requests if the access token is invalid or expired.
  • Incorrect product parameters: Missing required fields or invalid data types can cause API errors.
  • Image URLs inaccessible: If provided image URLs are not publicly accessible, the API may fail to associate images.
  • API permission issues: The Zalo OA app must have appropriate permissions to manage store products.

Error Messages and Resolutions

  • "Error creating product: <message>": Check that all required properties (name, price) are correctly set and valid.
  • API response errors often include HTTP status codes and messages; review these to identify issues such as permission denied or bad request.
  • Suggestions usually recommend verifying access token validity, permissions, and parameter correctness.
  • Network or connectivity issues may also cause failures; ensure stable internet connection.

Links and References

Discussion