Table of Contents
A poll can only be created by a chat admin. It's possible to create a poll and giveaway but the website UI will only show the latest.
To start a poll you must be an admin and send the following command.
{
"method":"createPoll",
"params":{
"channel":"CHANNEL",
"question":"Question to ask",
"choices":[
{
"text":"Answer 1"
},
{
"text":"Answer 2"
},
... Up to ten choices
],
"subscriberOnly":true/false,
"followerOnly":true/false,
"start_time":"20141210T14:53:33.142Z",
"nameColor":"000000"
}
}
You can decide if it's open to only followers or subscribers by toggling the flags.
This will start the poll, add it to the website UI and you will recieve the following message in the channel:
{
"method":"pollMsg",
"params":{
"channel":"CHANNEL",
"question":"Question",
"choices":[
{
"text":"Answer 1",
"votes":12
},
{
"text":"Answer 2",
"votes":40
}
],
"start_time":"20141210T14:53:33.142Z",
"status":"started",
"voters":[
"List of",
"voters"
],
"nameColor":"000000",
"subscriberOnly":false,
"followerOnly":false,
"votes":52
}
}
{
"method":"voteMsg",
"params":{
"name":"USERNAME",
"channel":"CHANNEL",
"choice":"Vote Choice Integer. Starts at 0 for choice 1",
"token":"USERS_AUTH_TOKEN"
}
}
After you send a voteMsg, the server will broadcast a pollMsg to all anon and above users.
To pause a poll you must be an admin and send the following message.
{
"method":"pausePoll",
"params":{
"channel":"CHANNEL",
"token":"USERS_AUTH_TOKEN"
}
}
The server will then broadcast a pollMsg with the status set to paused
. This is the last time to get poll results unless the poll is restarted. To restart the poll send the following message.
{
"method":"startPoll",
"params":{
"channel":"CHANNEL",
"token":"USERS_AUTH_TOKEN"
}
}
To end a poll you need to be an admin and send the following message.
{
"method":"endPoll",
"params":{
"channel":"CHANNEL",
"token":"USERS_AUTH_TOKEN"
}
}
The server will then send the following message:
{
"method":"pollMsg",
"params":{
"channel":"CHANNEL",
"status":"ended"
}
}