Zalo Poll icon

Zalo Poll

Quản bình chọn Zalo

Overview

This node enables users to create and manage polls within Zalo group chats. It is particularly useful for gathering opinions, making decisions, or conducting surveys among group members in a collaborative environment. For example, a team leader can quickly create a poll to decide on meeting times or project priorities, allowing participants to vote directly within the chat.

The "Tạo bình chọn" (Create Poll) operation allows creating a new poll with customizable questions, options, and settings such as multi-choice voting, anonymity, and pinning the poll message to the top of the chat.

Properties

Name Meaning
ID Nhóm The ID of the group where the poll will be created (only works with groups).
Chủ đề bình chọn The question or topic of the poll.
Kiểu nhập lựa chọn How to input poll options: either as a list of separate choices or as a single text field separated by commas. Options: "Danh sách" (list), "Văn bản" (text).
Các lựa chọn (list) When using "list" input type, add multiple individual poll options.
Các lựa chọn (text) When using "text" input type, enter all options in one text box separated by commas.
Thời hạn bình chọn Optional expiration date/time for the poll; leave empty if no expiration is needed.
Ghim lên đầu trò chuyện Whether to pin the poll message at the top of the chat (boolean).
Chọn nhiều phương án Allow participants to select multiple options when voting (boolean).
Có thể thêm phương án Allow participants to add new options to the poll (boolean).
Ẩn kết quả khi chưa bình chọn Hide poll results from participants until they have voted (boolean).
Ẩn người bình chọn Make votes anonymous so participants cannot see who voted for which option (boolean).

Output

The node outputs JSON data containing:

  • success: Boolean indicating if the poll creation was successful.
  • response: The raw response object returned from the Zalo API after creating the poll.
  • groupId: The ID of the group where the poll was created.
  • createPollData: An object summarizing the poll parameters used for creation, including question, options, expiration time, and various flags.

No binary data output is produced by this node.

Example output JSON structure:

{
  "success": true,
  "response": { /* Zalo API poll creation response */ },
  "groupId": "123456789",
  "createPollData": {
    "question": "Your poll question",
    "options": ["Option 1", "Option 2"],
    "expiredTime": 0,
    "pinAct": false,
    "allowMultiChoices": true,
    "allowAddNewOption": true,
    "hideVotePreview": false,
    "isAnonymous": false
  }
}

Dependencies

  • Requires an API key credential to authenticate with the Zalo platform.
  • Uses the zca-js library internally to interact with the Zalo API.
  • Requires valid cookie, IMEI, and user agent information for authentication, which are retrieved from credentials or input data.
  • Must be configured with appropriate Zalo API credentials in n8n.

Troubleshooting

  • Missing or invalid credentials: The node throws an error if the Zalo API instance cannot be initialized due to missing or invalid authentication details. Ensure that the API key credential is correctly set up and contains valid cookie, IMEI, and user agent values.
  • Empty poll options: If no poll options are provided, the node will throw an error requesting at least one option. Verify that options are entered correctly according to the selected input type.
  • Invalid expiration time: If the expiration time is provided but invalid, it may cause unexpected behavior. Use a proper date-time format or leave empty if not needed.
  • API errors: Any errors returned from the Zalo API during poll creation will be surfaced. Check the error message for details and verify network connectivity and API limits.
  • Continue on Fail: If enabled, the node will continue processing subsequent items even if one fails, returning error messages in the output JSON.

Links and References

Discussion