Zalo Poll icon

Zalo Poll

Quản bình chọn Zalo

Overview

This node operation allows users to create a poll within a group chat on the Zalo platform. It is designed for scenarios where group members want to gather opinions or votes on a specific question with multiple options. The node supports flexible input methods for poll options, including entering each option separately or as a comma-separated text string.

Practical examples include:

  • Organizing a team decision by creating a poll in a workgroup.
  • Collecting preferences for event dates or activities among friends.
  • Running quick surveys in community groups.

The node also supports additional features such as setting an expiration time for the poll, pinning the poll message to the top of the chat, allowing multiple choices per participant, enabling participants to add new options, hiding vote results until after voting, and making votes anonymous.

Properties

Name Meaning
ID Nhóm (groupId) The ID of the group where the poll will be created. This only works with group chats.
Chủ đề bình chọn (question) The question or topic of the poll that participants will vote on.
Kiểu nhập lựa chọn (optionInputType) Method to input poll options: "Danh sách" (list) means entering each option separately; "Văn bản" (text) means entering all options in one text field separated by commas.
Các lựa chọn (pollOptionsCollection) When using list input type, this collection holds multiple individual poll options entered separately. Each option is required.
Các lựa chọn (optionsString) When using text input type, this is a single string containing all options separated by commas.
Thời hạn bình chọn (expiredTime) Optional expiration date/time for the poll. Leave empty if no expiration is desired.
Ghim lên đầu trò chuyện (pinAct) Boolean flag to pin the poll message at the top of the chat.
Chọn nhiều phương án (allowMultiChoices) Boolean indicating whether participants can select multiple options when voting.
Có thể thêm phương án (allowAddNewOption) Boolean indicating whether participants are allowed to add new options to the poll.
Ẩn kết quả khi chưa bình chọn (hideVotePreview) Boolean indicating whether vote results are hidden from participants until they have voted.
Ẩn người bình chọn (isAnonymous) Boolean indicating whether the identity of voters is hidden from other participants (anonymous voting).

Output

The node outputs JSON data for each item processed, structured as follows:

  • success: A 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 details sent to the API, including question, options, expiration time, and various flags.

If an error occurs during processing, the output JSON contains an error field describing the issue.

No binary data output is involved in this operation.

Dependencies

  • Requires an API key credential for authenticating with the Zalo platform.
  • Uses an internal client class instantiated with authentication cookies, device IMEI, and user agent strings obtained from credentials.
  • The node depends on the Zalo API endpoint for creating polls in group chats.

Troubleshooting

Common Issues

  • Missing or invalid group ID: The poll cannot be created without a valid group ID.
  • Empty or improperly formatted poll options: Options must be provided either as a non-empty list or a properly comma-separated string.
  • Authentication failure: If the API key or authentication tokens are invalid or expired, the request will fail.
  • API errors returned from Zalo: These may include permission issues, rate limits, or malformed requests.

Error Messages and Resolutions

  • "Missing required parameters": Ensure all required fields like group ID and question are filled.
  • "Invalid poll options": Verify that poll options are correctly entered according to the selected input type.
  • "Authentication failed": Check that the API key credential is correctly configured and has not expired.
  • Unhandled exceptions: Review the error details in the output and consult Zalo API documentation for specific error codes.

Links and References

Discussion