Zalo OA icon

Zalo OA

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

Overview

The "Zalo OA" node integrates with the Zalo Official Account (OA) API, enabling users to interact programmatically with their Zalo OA. Specifically, the "Gửi Tin Nhắn Hình Ảnh" (Send Image Message) operation allows sending image messages directly to a specified user on Zalo.

This operation supports sending images either by providing a direct URL or by referencing an already uploaded image ID within the Zalo OA system. It also supports different message types such as Customer Service, Transaction, and Promotion messages, which correspond to different categories of communication with followers.

Practical scenarios:

  • Sending promotional images to customers who follow your Zalo OA.
  • Delivering transaction-related images like receipts or invoices.
  • Providing customer service support by sending relevant images during conversations.

Properties

Name Meaning
Message Type The category of the message to send. Options:
- Tin Tư Vấn (Customer Service)
- Tin Giao Dịch (Transaction)
- Tin Truyền Thông Cá Nhân (Promotion)
User ID The unique identifier of the recipient user on Zalo.
Loại Hình Ảnh (Image Type) The source type of the image to send. Options:
- URL Hình Ảnh (Image URL)
- ID Hình Ảnh (Đã Upload) (Uploaded Image ID)
URL Hình Ảnh (Image URL) The direct URL of the image to be sent. Required if Image Type is "URL Hình Ảnh".
ID Hình Ảnh (Image ID) The ID of an image previously uploaded to Zalo OA. Required if Image Type is "ID Hình Ảnh".

Output

The output JSON contains the response from the Zalo OA API after attempting to send the image message. This typically includes:

  • Status information about the message delivery.
  • Any error messages if the request failed.
  • Metadata related to the sent message.

The node does not output binary data for this operation; it only returns the API's JSON response.

Dependencies

  • Requires an API authentication token (access token) for the Zalo Official Account API.
  • Uses the Zalo OA API endpoint at https://openapi.zalo.me/v3.0/oa/message/{messageType}.
  • Requires proper permissions granted to the access token to send messages.
  • The node depends on the axios library for HTTP requests.

Troubleshooting

  • Common issues:

    • Invalid or expired access token leading to authentication errors.
    • Incorrect user ID causing message delivery failure.
    • Using an invalid or inaccessible image URL or image ID.
    • Insufficient permissions for the access token to send messages.
  • Error messages and resolutions:

    • Errors returned from the API will appear in the output JSON under an error field.
    • If the image upload or message sending fails, check:
      • That the access token is valid and has required scopes.
      • The correctness of the user ID.
      • The accessibility and format of the image URL or validity of the image ID.
    • Network or connectivity issues may cause request failures; verify network status.
    • For permission-related errors, ensure the Zalo OA app has the necessary rights enabled.

Links and References

Discussion