I’m trying to get real-time subscription and bits info from a channel.
Kinda stuck with the pubsub topic in that it isn’t accepting my OAuth token. I’m confused about whether this token is supposed to be a user access token or an app access token.
I read here that if I need to consume topics from another channel, then that channel will have to go through my authentication process? How will that work out?
“Also keep in mind that you need a token of the channel you wish to receive events from.”
How do I get a token for any channel to get that channel’s real-time events? Is that even possible?
For channel subscriptions on pubsub, you will need a User Access token with the channel_subscriptions scope. App access tokens aren’t for accessing anything that requires user authorization.
You need the owner of the channel you want to get events for to go through the authentication flow for your app and that will provide you with a User Token that you can use to get subscriber events for their channel. For bits any scope will work, you don’t need a specific one, but it does have to be from the channel owner of the channel you want events for.
Alternatively you can use an IRC or Websocket connection to Twitch Chat and listen to events through that https://dev.twitch.tv/docs/irc/ but again you will need permission from the channel owner to do so or you could be breaking the Developer Agreement.
Will individual chat messages have any information that tells me that they are cheers? I just tried connecting to a channel and got it’s chat stream. I can see that some of these messages have the cheer icon with them but they don’t appear to have anything particular in them that identifies that.
Would I need to fetch my auth token with a specific permission to enable the TAGS capability? I tried passing USERNOTICE command after connecting but I get a 421 message saying it’s an invalid command.
I needed to send s.send("CAP REQ :twitch.tv/tags".encode("utf-8")) before all the other commands. I’ve received the ACK now and I’m getting all the badges. Thank you all for your responses.