Chat / JavaScript
Chat JavaScript v4
Chat JavaScript
Chat
JavaScript
Home
/
Chat
/
JavaScript
/
Message
This is the new Docs for Chat SDK v4 for JavaScript. To see the previous Docs, click here.

Retrieve a list of polls

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

// One way to retrieve a list of polls in a channel.
const query: PollListQuery = channel.createPollListQuery();
const polls: Poll[] = await query.next();

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

PollListQueryParams

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)