Zalo OA icon

Zalo OA

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

Overview

This node operation allows users to upload GIF images to a Zalo Official Account (OA) via the Zalo OA API. It supports uploading GIFs either by providing a direct URL or by sending the GIF as binary data within the workflow. This functionality is useful for automating the management of media content on Zalo OA, such as updating promotional materials, stickers, or animated images used in messages or posts.

Practical examples include:

  • Automatically uploading a new GIF from a URL to update an OA's media library.
  • Uploading a GIF file received earlier in the workflow as binary data to the OA.
  • Integrating with other systems that generate GIFs dynamically and pushing them to Zalo OA without manual intervention.

Properties

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

Output

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

If the upload is successful, the output JSON contains details confirming the upload. If there is an error, the output JSON includes an error field set to true, a descriptive message, the raw API response if available, and a suggestion to help resolve the issue.

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

Dependencies

  • Requires an active Zalo Official Account API access token credential configured in n8n.
  • Uses the Zalo OA API endpoint https://openapi.zalo.me/v3.0/oa/upload/gif.
  • Requires internet access to reach the Zalo OA API and, if uploading via URL, to fetch the GIF from the provided URL.
  • Uses the axios HTTP client and form-data package internally to handle HTTP requests and multipart form uploads.

Troubleshooting

Common Issues

  • Invalid or expired access token: The API call will fail if the access token is missing, invalid, or expired. Ensure the credential is correctly configured and refreshed.
  • Incorrect binary property name: When using binary data, specifying a non-existent binary property will cause an error. Verify the binary property name matches the actual binary data key in the input item.
  • Invalid GIF format or inaccessible URL: The GIF must be a valid GIF file. If uploading via URL, ensure the URL is publicly accessible and points directly to a GIF image.
  • API permission errors: The OA must have the necessary permissions to upload media. Check the OA configuration and granted scopes.

Error Messages and Resolutions

  • "No binary data property \"<name>\" exists on item."
    Means the specified binary property was not found in the input item. Fix by selecting the correct binary property name.
  • "Error uploading GIF: <error message>"
    General upload failure. Check the detailed API response included in the output for specifics. Common causes include invalid token, bad file format, or network issues.
  • "Please check the GIF format and OA access permissions."
    Suggests the GIF file might be corrupted or the OA lacks upload rights. Validate the GIF and OA permissions.

Links and References

Discussion