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 to send a "List Message" type of message to a specific user. The "Gửi Tin Nhắn Danh Sách" operation allows sending a structured list message containing multiple items, each with a title, subtitle, image, and an action URL. This is useful for scenarios such as promotional campaigns, product catalogs, or any situation where you want to present a list of options or items interactively within a chat on Zalo.

Practical examples:

  • Sending a list of featured products with images and links to purchase.
  • Sharing a menu of services with descriptions and URLs for more details.
  • Delivering personalized promotional content with clickable items.

Properties

Name Meaning
Message Type The category of the message being sent. Options are:
- Tin Tư Vấn (Customer Service): For sending customer service 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 list message.
Tiêu Đề The main title of the list message that will appear at the top of the message.
Danh Sách Mục A collection of list items ("Mục") included in the message. Each item has:
- Tiêu Đề Mục (Title): The item's title.
- Mô Tả (Subtitle): Description of the item.
- URL Hình Ảnh (Image URL): Link to the item's image.
- Default Action URL: URL opened when the item is clicked.

Output

The node outputs JSON data representing the response from the Zalo OA API after attempting to send the list message. The structure typically includes:

  • Status information about the request success or failure.
  • Details of the sent message or error messages if any.
  • No binary data output is involved in this operation.

Example output JSON snippet:

{
  "message_id": "1234567890",
  "status": "success",
  "recipient": {
    "user_id": "user_id_value"
  }
}

Dependencies

  • Requires a valid Zalo Official Account API access token (an API key credential).
  • The node uses HTTP POST requests to the Zalo OA API endpoint https://openapi.zalo.me/v3.0/oa/message/{messageType}.
  • Proper permissions must be granted to the API token for sending messages.
  • The node depends on the axios library for HTTP requests and form-data for file uploads (though not used in this operation).

Troubleshooting

  • Common issues:

    • Invalid or expired access token: Ensure the API token is valid and refreshed as needed.
    • Incorrect user ID: Verify the recipient's user ID is correct and corresponds to a follower of the OA.
    • Improper message format: Make sure the list elements have all required fields and valid URLs.
    • Insufficient permissions: Confirm the OA has permission to send the selected message type.
  • Error messages:

    • "error": true with descriptive messages from the API indicating what went wrong.
    • HTTP status codes like 401 (Unauthorized) suggest token issues.
    • 400-series errors may indicate malformed requests or invalid parameters.
  • Resolution tips:

    • Check and refresh the API token.
    • Validate all input properties carefully.
    • Review OA permissions and scopes.
    • Consult Zalo OA API documentation for message format requirements.

Links and References

Discussion