Zalo OA icon

Zalo OA

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

Overview

This node operation updates the menu of a Zalo Official Account (OA). It allows users to define and send a list of menu items to customize the OA's interactive menu that appears to end-users. This is useful for businesses or service providers who want to provide quick access to various actions such as opening URLs, sending messages, making phone calls, or launching apps directly from their Zalo OA menu.

Practical examples include:

  • Adding menu items that link to promotional web pages.
  • Creating menu options that send predefined messages to the OA.
  • Providing direct call buttons for customer support.
  • Launching specific applications related to the business.

Properties

Name Meaning
Menu Items A collection of menu items to be set on the OA menu. Each item includes:
- Tên Menu (title): The display name of the menu item.
- Loại Menu (type): The type of action triggered when the user clicks the menu item.
Options: "Mở URL" (open URL), "Gửi Tin Nhắn" (send message), "Gọi Điện" (make phone call), "Mở Ứng Dụng" (open app).
- Giá Trị (payload): The value corresponding to the selected menu type (e.g., URL, message text, phone number, app identifier).

Output

The node outputs JSON data representing the response from the Zalo OA API after attempting to update the menu. This typically includes success confirmation or error details returned by the API.

No binary data output is involved in this operation.

Dependencies

  • Requires an active and valid API authentication token (access token) for the Zalo Official Account.
  • The node uses the Zalo OpenAPI endpoint https://openapi.zalo.me/v3.0/oa/menu to update the menu.
  • Proper permissions must be granted to the API token to manage the OA menu.
  • The node depends on the axios HTTP client library for making API requests.

Troubleshooting

  • Common Issues:

    • Invalid or expired access token leading to authentication errors.
    • Incorrectly formatted menu items or missing required fields.
    • Insufficient permissions for the API token to update the OA menu.
    • Network connectivity issues preventing API communication.
  • Error Messages and Resolutions:

    • Authentication errors: Ensure the API token is valid and refreshed if expired.
    • Validation errors: Check that each menu item has a valid title, type, and payload matching the expected format.
    • Permission denied: Verify that the API token has the necessary scopes to modify the OA menu.
    • API request failures: Review network settings and retry the operation.

Links and References


Summary of execute() logic for Resource: Zalo OA, Operation: Cập Nhật Menu OA

  • Retrieves the OAuth access token from stored credentials or environment variables.
  • Reads the input parameter "Menu Items", which is a collection of menu item objects.
  • Maps each menu item into the structure expected by the Zalo API, converting the type and payload accordingly.
  • Sends a POST request to the /menu endpoint of the Zalo OA API with the constructed menu items.
  • Returns the API response JSON as output for each input item processed.

Discussion