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 their Zalo OA. Specifically, the "Gửi Tin Nhắn File" (Send File Message) operation allows sending file messages to a specified user who follows the OA.

Typical use cases include:

  • Sending important documents or files directly to customers or followers via Zalo.
  • Automating customer service workflows by delivering files such as invoices, contracts, or brochures.
  • Enhancing marketing campaigns by sharing downloadable content through personalized messages.

Example: A business can automatically send a PDF brochure to a user after they request product information on Zalo.

Properties

Name Meaning
Message Type Type of message to send. Options:
- Tin Tư Vấn (Customer Service): for consultation messages
- Tin Giao Dịch (Transaction): for transactional messages
- Tin Truyền Thông Cá Nhân (Promotion): for personal promotional messages
User ID The unique identifier of the recipient user who will receive the file message
ID File The identifier of the file that has been previously uploaded to the Zalo OA

Output

The node outputs a JSON object containing the response from the Zalo OA API after attempting to send the file message. This typically includes status information about the message delivery, any error codes, and descriptive messages.

If the operation is successful, the output confirms the message was sent; if not, it contains error details to help diagnose issues.

The node does not output binary data for 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/v3.0/oa/message/{messageType} to send messages.
  • Relies on the Axios HTTP client library for making API requests.
  • For file messages, the file must be uploaded beforehand to Zalo OA to obtain a valid file ID.

Troubleshooting

  • Common Issues:

    • Invalid or expired access token: Ensure the API key credential is valid and refreshed if necessary.
    • Incorrect user ID: Verify the recipient's user ID is correct and that the user follows the OA.
    • Invalid file ID: Confirm the file has been successfully uploaded to Zalo OA and the file ID is accurate.
    • Insufficient permissions: The OA must have the required permissions to send messages to users.
  • Error Messages:

    • Errors returned from the API are included in the output JSON under error fields.
    • Typical errors include authentication failures, invalid parameters, or permission denials.
    • To resolve, check the access token validity, parameter correctness, and OA configuration.

Links and References

Discussion