Inspiration

ViewerPolls was originally built for my wife's Twitch channel (@LostInSideQuests). The goal was to build new, unique revenue sources for Affiliates and Partners while boosting viewer engagement.

What it does

ViewerPolls allows a viewer to exchange Bits to create a poll on a participating channel. The initial version of the extension (launched before the hackathon started) allowed the streamer to control the duration of any created poll and the minimum number of Bits.

For the hackathon the following was added to the extension:

For moderation

The streamer settings view now contains a new moderation section. In this section, There is a new callout reaffirming that banned users and blocked terms are defended against.

A new cooldown setting is available. This represents the amount of time that must pass between polls before a new one can be started. This should allow popular streamers to control how often polls can run.
Finally, the streamer can choose if ViewerPolls is enabled or disabled when Shield Mode is activated.

To support the above moderation improvements, the following permissions are now requested. moderation:read moderator:read:shield_mode

Existing users will be prompted to reauthorize the extension to grant these new permissions. If they choose to not grant these permissions, the extension will still function as it did before. In short, the newer feature won’t be enabled.

For Bits

If you are running a Bits goal, the extension will show a new callout that explains Bits used in the extension do count towards any running Bit goals. This aims to entice viewers to use the extension to help a streamer complete their goals.

To support this feature, the following permissions are now requested: channel:read:goals

Existing users will be prompted to reauthorize the extension to grant these new permissions. If they choose to not grant these permissions, the callout will not be added even if they have a running Bits goal.

How we built it

The extension panel is a Vite/React application that heavily uses the extension Javascript library provided by Twitch. This front-end talks to various lamba-like APIs hosted through Google Firebase. These functions proxy many final actions through Twitch's Helix APIs including polls, moderation, goals, and more.

Challenges we ran into

For the Bits goal integration, the Helix API does not currently return the type correctly for Cheerer and Bits goals. This means I needed to guess if a given goal was a Bits goal or not. For now, if the target is >= 1000, I assume it's a Bits goal.

During the hackathon, I've had a hard time using Bits on my own channel. I was getting graphQL errors that prevented the extension from showing the Bits confirm screen. Thankfully, I had my wife's channel to test with if needed.

It would be ideal if I could submit a Poll with a dry run flag through the actual Polls API. This would really let me confirm that all user entered information is good to go before asking for Bits.

Accomplishments that we're proud of

This was a labor of love for my wife's Twitch channel as I also have a full time job. I'm very pleased with the UI and prided myself on making it as user friendly as possible.

What we learned

I learned a ton about GCP including functions and task queues. It was my first time using these features and I think leads to a very scalable design that can handle Twitch-level traffic if the extension becomes very popular.

What's next for ViewerPolls Enhancements

I'm considering adding support for predictions as well. I think there is a lot of value in giving more control to viewers in exchange for Bits.

Built With

Share this project:

Updates