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 various features of a Zalo OA. Specifically, the operation "Lấy Danh Sách Cuộc Trò Chuyện Gần Đây" (Get Recent Chat List) retrieves a list of recent conversations from the Zalo OA.

Typical use cases include:

  • Monitoring recent user interactions on your Zalo OA.
  • Automating responses or analytics based on recent chat activity.
  • Integrating Zalo chat data into other workflows or CRM systems.

For example, you might use this node to fetch the last 10 recent chats starting from an offset of 0, then process or analyze these conversations in subsequent workflow steps.

Properties

Name Meaning
Vị Trí Bắt Đầu (offset) The starting position index from which to retrieve the recent chat list. Default is 0.
Số Lượng (count) The number of recent conversations to retrieve, with a maximum limit of 50. Default is 10.

Output

The output is a JSON object containing the response from the Zalo OA API endpoint for recent chats. It typically includes:

  • A list of recent chat entries, each representing a conversation.
  • Metadata such as total count, pagination info, or status codes depending on the API response.

If an error occurs during the API call, the output JSON will contain fields like:

  • error: true
  • message: Description of the error encountered.
  • note and suggestion: Additional guidance to resolve common issues.

No binary data is output by this operation.

Dependencies

  • Requires an API authentication token (access token) for the Zalo Official Account API.
  • Uses the Zalo OA API base URL: https://openapi.zalo.me/v2.0/oa.
  • The node depends on the axios library for HTTP requests.
  • Proper permissions must be granted to the access token, specifically the permission to manage and read messages ("Quyền quản lý tin nhắn người quan tâm").

Troubleshooting

Common Issues

  • Invalid or expired access token: The API call will fail if the access token is missing, invalid, or expired.
  • Insufficient permissions: If the access token lacks the required message management permission, the API will reject the request.
  • Exceeding count limits: The count parameter has a maximum allowed value (50). Requests exceeding this may cause errors or be truncated.
  • Network or API downtime: Temporary network issues or Zalo API outages can cause failures.

Error Messages and Resolutions

  • Error when calling listrecentchat:
    Message example: "Lỗi khi gọi API lấy danh sách cuộc trò chuyện gần đây: <error details>"
    Resolution:

    • Verify that the access token is valid and has the necessary permissions.
    • Ensure the "Quyền quản lý tin nhắn người quan tâm" permission is granted to the app.
    • Check network connectivity and retry later if the API service is down.
  • Parameter validation errors:
    If parameters like offset or count are invalid (e.g., negative numbers), the API may return errors. Use valid numeric values within allowed ranges.

Links and References


Note: This summary focuses exclusively on the "Lấy Danh Sách Cuộc Trò Chuyện Gần Đây" operation under the "Zalo OA" resource, as requested.

Discussion