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

Retrieve a list of polls

Copy link

You can retrieve a list of polls in a channel using either the createPollListQuery() method or the sb.createPollListQuery() method.

JavaScriptTypeScript
// One way to retrieve a list of polls in a channel.
const query = channel.createPollListQuery();
const polls = await query.next();

// Another way to retrieve a list of polls in a channel.
const params = {
  channelUrl: channel.url,
  channelType: ChannelType.GROUP,
};
const query = sb.createPollListQuery(params);
const polls = await query.next();

PollListQueryParams

Copy link
Parameter nameTypeDescription

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 20, inclusive. (Default: 10)