ZaloOA icon

ZaloOA

Consume ZaloOA API

Overview

This n8n node allows you to upload an image or GIF file to the Zalo Official Account (OA) platform using its API. It is designed for workflows that need to send media files—such as images or GIFs—to Zalo users, typically as part of automated messaging or content delivery processes.

Common scenarios:

  • Automating the upload of promotional images to Zalo OA.
  • Sending user-generated images from another system directly to Zalo.
  • Integrating Zalo OA with other platforms where images are processed and then uploaded.

Practical example:
A business could use this node in a workflow to automatically upload a new product image to their Zalo OA whenever a new product is added to their inventory management system.

Properties

Name Meaning
Authentication Select the authentication method. Options: "Parameter Credentials" (enter credentials manually), "Predefined Credentials" (use stored credentials).
Base URL The base URL that serves the API. Default: https://openapi.zalo.me/v3.0/oa. Only shown if "Parameter Credentials" is selected.
Access Token OA access token. Required for authenticating API requests. Only shown if "Parameter Credentials" is selected.
Property Name Name of the binary property which contains the data for the file to be uploaded. This should match the name of the binary field in your input.

Output

The output will contain a json field with the response from the Zalo OA API after uploading the image or GIF. The structure of this output typically includes:

{
  "data": {
    "attachment_id": "string", // Unique ID of the uploaded file
    "type": "image"            // Type of the uploaded file (e.g., "image")
  },
  "message": "Success",
  "error": 0
}
  • data.attachment_id: The unique identifier for the uploaded image/GIF, which can be used in subsequent API calls (e.g., sending messages with the image).
  • data.type: The type of file uploaded.
  • message: Status message from the API.
  • error: Error code (0 means success).

If the node is configured to output binary data, it represents the file that was uploaded.

Dependencies

  • Zalo Official Account API: Requires a valid OA access token.
  • n8n Credentials: If using "Predefined Credentials," you must configure the zaloOAApi credential in n8n.
  • Environment Variables: None required unless specified by your credential setup.

Troubleshooting

Common issues:

  • Invalid Access Token: If the access token is missing or incorrect, the API will reject the request. Ensure the token is current and has the necessary permissions.
  • Missing Binary Data: If the specified "Property Name" does not match any binary property in the input, the node will fail to find the file to upload.
  • API Errors: Non-zero error codes in the output indicate problems such as invalid file format, size limits exceeded, or permission issues.

Error messages and resolutions:

  • "error": 201, "message": "Invalid access token": Check and update your OA access token.
  • "error": 202, "message": "File not found": Ensure the binary property name matches the actual input.
  • "error": 203, "message": "Unsupported file type": Only images and GIFs are supported; check your file format.

Links and References

Discussion