Reference / API groups
twitch.polls
Polls: create, read and end them.
Every method of twitch.polls, with its parameters, what it returns and the token it needs.
twitch.polls.get(params?, options?): Paginator<Poll>Lists the polls of a channel, most recent first. Twitch keeps them for 90 days.
Token: user, scope channel:read:polls or channel:manage:polls.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
broadcaster_id | string | Broadcaster whose polls to list. Defaults to the user making the call. |
id | string | readonly string[] | Only these polls. Up to 20 IDs. |
first | number | Items per page, 1 to 20. Twitch defaults to 20. |
after | string | Cursor of the next page. |
options: Request options for this call: as, token, signal, timeout, retries.
Returns
Section titled “Returns”Paginator<Poll>
Fields of Poll
| Name | Type | Description |
|---|---|---|
id | string | ID of the poll. |
broadcaster_id | string | ID of the broadcaster who ran the poll. |
broadcaster_name | string | Display name of the broadcaster. |
broadcaster_login | string | Login name of the broadcaster. |
title | string | Question put to the viewers, 60 characters at most. |
choices | PollChoice[] | Choices of the poll, two to five of them. |
bits_voting_enabled | boolean | Deprecated. Always false. Bits voting no longer exists. |
bits_per_vote | number | Deprecated. Always 0. Bits voting no longer exists. |
channel_points_voting_enabled | boolean | Whether viewers can buy extra votes with Channel Points. |
channel_points_per_vote | number | Price of one extra vote, in Channel Points. |
status | PollStatus | State of the poll: ACTIVE while it runs, COMPLETED when it reached its end, TERMINATED when it was stopped early, ARCHIVED when it is hidden from the channel, MODERATED when it was deleted, INVALID when Twitch could not work it out. |
duration | number | Planned length of the poll, in seconds. |
started_at | string | When the poll started, as an RFC 3339 timestamp. |
ended_at | string | When the poll ended, as an RFC 3339 timestamp. null or absent while it is running. |
Example
Section titled “Example”const latest = await twitch.polls.get().first();create
Section titled “create”twitch.polls.create(params, options?): Promise<Poll>Starts a poll in a channel. It opens at once, and a channel can only run one poll at a time.
Token: user, scope channel:manage:polls.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
broadcaster_id | string | Broadcaster who runs the poll. Defaults to the user making the call. |
title required | string | Question put to the viewers, 60 characters at most. |
choices required | readonly (string | { title: string; })[] | Two to five choices, each 25 characters at most. Plain strings work too. |
duration required | number | Length of the poll in seconds, 15 to 1800. |
channel_points_voting_enabled | boolean | Lets viewers buy extra votes with Channel Points. Twitch defaults to false. |
channel_points_per_vote | number | Price of one extra vote in Channel Points, 1 to 1000000. |
options: Request options for this call: as, token, signal, timeout, retries.
Returns
Section titled “Returns”Promise<Poll>
Fields of Poll
| Name | Type | Description |
|---|---|---|
id | string | ID of the poll. |
broadcaster_id | string | ID of the broadcaster who ran the poll. |
broadcaster_name | string | Display name of the broadcaster. |
broadcaster_login | string | Login name of the broadcaster. |
title | string | Question put to the viewers, 60 characters at most. |
choices | PollChoice[] | Choices of the poll, two to five of them. |
bits_voting_enabled | boolean | Deprecated. Always false. Bits voting no longer exists. |
bits_per_vote | number | Deprecated. Always 0. Bits voting no longer exists. |
channel_points_voting_enabled | boolean | Whether viewers can buy extra votes with Channel Points. |
channel_points_per_vote | number | Price of one extra vote, in Channel Points. |
status | PollStatus | State of the poll: ACTIVE while it runs, COMPLETED when it reached its end, TERMINATED when it was stopped early, ARCHIVED when it is hidden from the channel, MODERATED when it was deleted, INVALID when Twitch could not work it out. |
duration | number | Planned length of the poll, in seconds. |
started_at | string | When the poll started, as an RFC 3339 timestamp. |
ended_at | string | When the poll ended, as an RFC 3339 timestamp. null or absent while it is running. |
Example
Section titled “Example”const poll = await twitch.polls.create({ title: "Which game next?", choices: ["Celeste", "Hades", "Outer Wilds"], duration: 120,});twitch.polls.end(params, options?): Promise<Poll>Ends a running poll before its time is up, and optionally hides it.
Token: user, scope channel:manage:polls.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
broadcaster_id | string | Broadcaster who runs the poll. Defaults to the user making the call. |
id required | string | ID of the poll to end. |
status required | "TERMINATED" | "ARCHIVED" | "TERMINATED" leaves the results on screen, "ARCHIVED" also hides the poll. |
options: Request options for this call: as, token, signal, timeout, retries.
Returns
Section titled “Returns”Promise<Poll>
Fields of Poll
| Name | Type | Description |
|---|---|---|
id | string | ID of the poll. |
broadcaster_id | string | ID of the broadcaster who ran the poll. |
broadcaster_name | string | Display name of the broadcaster. |
broadcaster_login | string | Login name of the broadcaster. |
title | string | Question put to the viewers, 60 characters at most. |
choices | PollChoice[] | Choices of the poll, two to five of them. |
bits_voting_enabled | boolean | Deprecated. Always false. Bits voting no longer exists. |
bits_per_vote | number | Deprecated. Always 0. Bits voting no longer exists. |
channel_points_voting_enabled | boolean | Whether viewers can buy extra votes with Channel Points. |
channel_points_per_vote | number | Price of one extra vote, in Channel Points. |
status | PollStatus | State of the poll: ACTIVE while it runs, COMPLETED when it reached its end, TERMINATED when it was stopped early, ARCHIVED when it is hidden from the channel, MODERATED when it was deleted, INVALID when Twitch could not work it out. |
duration | number | Planned length of the poll, in seconds. |
started_at | string | When the poll started, as an RFC 3339 timestamp. |
ended_at | string | When the poll ended, as an RFC 3339 timestamp. null or absent while it is running. |
Example
Section titled “Example”const poll = await twitch.polls.end({ id: pollId, status: "TERMINATED" });