voteAnonymously()
voteAnonymously(anonymousPollToken: string, optionIds: EntryIdType[], userId?: string): Promise<boolean>
Submit an anonymous vote for a poll.
Parameters:
anonymousPollToken(string): The anonymous voting token for the target poll.optionIds(EntryIdType[]): An array of option IDs representing the user's vote.userId(string, optional): An optional unique user identifier.
Returns:
A
Promiseresolving to a boolean indicating whether the vote was successfully submitted.
Example:
const voteResult = await pollz.anonymous.voteAnonymously('your-anonymous-token', [1, 2], 'user-123');
console.log('Anonymous Vote Submitted:', voteResult);The voteAnonymously method enables users to anonymously cast their votes for a specific poll using the provided anonymous voting token. Users can select multiple options (optionIds) and may optionally provide a unique user identifier (userId).
This method returns a boolean value indicating the success of the vote submission. A true value means the vote was successfully recorded, while false indicates an unsuccessful attempt.
Note: Ensure that the provided anonymousPollToken is valid and corresponds to an existing anonymous voting session.
Last updated