/ SDKs / JavaScript
SDKs
Chat SDKs JavaScript v4
Chat SDKs JavaScript
Chat SDKs
JavaScript
Version 4

Retrieve a list of voters

Copy link

You can retrieve a list of voters for a poll option using the createPollVoterListQuery() method or the sb.createPollVoterListQuery() method.

JavaScriptTypeScript
// One way to retrieve a list of voters for a poll.
const query = channel.createPollVoterListQuery(pollId, pollOptionId);
const voters = await query.next();

// Another way to retrieve a list of voters for a poll.
const params = {
  channelUrl: channel.url,
  channelType: ChannelType.GROUP,
  pollId: poll.id,
  pollOptionId: poll.options[0].id,
  limit: 10,
};
const query = sb.createPollVoterListQuery(params);
const voters = await query.next();

PollVoterListQueryParams

Copy link
Parameter nameTypeDescription

pollId

number

Specifies the unique ID of a poll.

pollOptionId

number

Specifies the unique ID of a poll option.

channelType

ChannelType

Specifies the type of the channel.

channelUrl

string

Specifies the URL of the channel.

limit?

number

Specifies the number of results to retrieve per page. Acceptable values are 1 to 100, inclusive. (Default: 20)