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 to upload images. It supports uploading images either by providing a direct URL or by sending binary image data from the workflow. This functionality is useful for automating content management, marketing campaigns, or customer engagement on Zalo OA by programmatically adding images to messages or posts.

Typical use cases include:

  • Uploading an image from a URL to be used in a Zalo OA message.
  • Uploading an image stored as binary data within the n8n workflow (e.g., after downloading or generating it).
  • Automating media uploads as part of larger workflows involving Zalo OA messaging or content publishing.

Properties

Name Meaning
Binary Data Boolean flag indicating if the image is provided as binary data (true) or as a URL (false).
Binary Property The name of the binary property containing the image data when Binary Data is true.
URL Hình Ảnh The URL of the image to upload when Binary Data is false.

Output

The node outputs the JSON response returned by the Zalo OA API after attempting to upload the image. This typically includes information about the uploaded image such as its ID, URL, or any error messages if the upload failed.

If the upload is successful, the output JSON contains details confirming the upload and metadata about the image. If there is an error, the output JSON includes an error field set to true, a descriptive message, the raw API response data, and a suggestion for troubleshooting.

The node does not output binary data itself; it only returns the API response in JSON format.

Dependencies

  • Requires an active connection to the Zalo Official Account API with a valid access token.
  • The node expects credentials that provide an API authentication token for Zalo OA.
  • Uses the axios HTTP client and form-data package internally to send requests.
  • For binary uploads, the node uses n8n's helper methods to retrieve binary data buffers from input items.

Troubleshooting

Common Issues

  • Missing or invalid access token: The node requires a valid access token for the Zalo OA API. Ensure your credentials are correctly configured and tokens are refreshed as needed.
  • Invalid binary property name: When using binary data, specifying a non-existent binary property will cause an error.
  • Invalid or inaccessible image URL: If the URL is incorrect or the image cannot be accessed publicly, the upload will fail.
  • Unsupported file formats or sizes: The Zalo OA API may reject files that do not meet format or size requirements.

Error Messages and Resolutions

  • "No binary data property \"<name>\" exists on item."
    Check that the specified binary property name matches exactly the binary data property in the input item.

  • "Error uploading file: <message>"
    Review the error message and check network connectivity, file format, and permissions.

  • API response errors with status codes and messages:
    Inspect the detailed API response included in the output JSON to understand the failure reason. Common causes include expired tokens, insufficient permissions, or invalid parameters.

  • "Please check the file format and OA access permissions."
    Verify that the image format is supported by Zalo OA and that your account has the necessary permissions.

Links and References


This summary is based solely on static analysis of the provided source code and property definitions.

Discussion