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 poll option

You can retrieve a specific poll option by creating and passing the PollOptionRetrievalParams properties in the sb.poll.getOption() method.

const params: PollOptionRetrievalParams = {
  channelUrl: channel.url,
  channelType: channel.channelType,
  pollId: poll.id,
  pollOptionId: option.id,
};
const pollOption: PollOption = await sb.poll.getOption(params);

List of properties for poll option

Property nameTypeDescription

pollId

number

Specifies the unique ID of a poll.

id

number

Specifies the unique ID of a poll option. This value is unique within a poll.

text

string

Specifies the text that describes an option.

createdBy?

string

Specifies the unique ID of the user who created an option.

createdAt

number

Specifies the time when an option is created in Unix seconds.

voteCount

number

Specifies the number of votes casted on an option.

updatedAt

number

Specifies the time when an option is updated in Unix seconds.

PollOptionRetrievalParams

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.