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 interact programmatically with Zalo OA features. Specifically, the "Gửi Tin Nhắn Hình Ảnh" (Send Image Message) operation allows sending image messages to a specified user on Zalo via the OA.

Typical use cases include:

  • Sending promotional or informational images directly to users who follow the OA.
  • Automating customer support by sending product images or visual instructions.
  • Broadcasting media-rich content in marketing campaigns.

For example, a business can automatically send a product image to a user after they inquire about it, improving engagement and response time.

Properties

Name Meaning
User ID The unique identifier of the recipient user on Zalo who will receive the image message.
Loại Hình Ảnh The type of image source: either a direct URL to an image or an already uploaded image ID.
URL Hình Ảnh The URL of the image to be sent (required if "Loại Hình Ảnh" is set to "URL Hình Ảnh").
ID Hình Ảnh The ID of an image previously uploaded to Zalo OA (required if "Loại Hình Ảnh" is "ID Hình Ảnh (Đã Upload)").

Output

The node outputs JSON data representing the response from the Zalo OA API after attempting to send the image message. This typically includes status information such as success confirmation or error details.

The output structure contains at least:

{
  "json": {
    // API response fields, e.g.:
    "message_id": "string",
    "error": false,
    "message": "string"
  }
}

No binary data output is produced by this operation.

Dependencies

  • Requires an active Zalo Official Account API access token credential configured in n8n.
  • Uses the Zalo OA API endpoint https://openapi.zalo.me/v2.0/oa/message.
  • Relies on HTTP POST requests with appropriate headers including the access token.
  • No additional external services are required beyond the Zalo OA API.

Troubleshooting

Common Issues

  • Invalid or expired access token: The API call will fail if the access token is missing, invalid, or expired.
  • Incorrect user ID: If the user ID does not correspond to a valid follower of the OA, the message will not be delivered.
  • Image URL inaccessible: When using an image URL, ensure the URL is publicly accessible and points directly to an image file.
  • Invalid image ID: When using an uploaded image ID, ensure the image has been successfully uploaded and the ID is correct.

Error Messages and Resolutions

  • Authentication errors: Check that the API key credential is correctly set up and has not expired.
  • 400 Bad Request: Usually indicates missing or malformed parameters; verify all required fields are provided and correctly formatted.
  • 403 Forbidden: May indicate insufficient permissions for the OA or the access token scope; ensure the OA has granted necessary rights.
  • Network errors: Confirm network connectivity and that the Zalo API endpoint is reachable.

If errors occur, review the detailed error message returned in the JSON output for guidance.

Links and References

Discussion