I’m writing a program in C# that monitors cheer donations.
I am able to use my program to get an oauth token. The response from https://api.twitch.tv/kraken/oauth2/token is as follows:
{"access_token":<my access token>,
"refresh_token":<my refresh token>,
"scope": ["channel_read"]}
Now if I’m not mistaken, as explained in the pubsub documentation, channel-bits-events-v1
needs to be appended with a channel ID, so I get the channel ID using Get Channel. (The documentation states that the url is supposed to be https://api.twitch.tv/kraken/channels, but this simply gives me 404 errors https://api.twitch.tv/kraken/channel returns a valid response, so I’m trying to use the latter.) Method is GET, Client-ID header is the same as the Client ID I used to retrieve the oauth token, and the Authorization header follows the proper format using the oauth token retrieved above. This returns a proper response in the format outlined in the documentation. I use the _id
parameter to create a Topic for a pubsub websocket message.
I am sending this string to wss://pubsub-edge.twitch.tv:
{"type":"LISTEN","data":{"topics":["channel-bits-events-v1.<ID retrieved from Get Channel>"],"auth_token":<access token retrieved in oauth object and used in Get Channel>}}
It’s connecting, it responds to ping, I send that JSON string in the first 10 seconds, but I only receive a blank error message in return:
{"type":"RESPONSE","error":"","nonce":""}
I am building this for somebody else but testing in my own channel, and as I am not a partner I do not have cheer enabled. Is this the expected behaviour since I can’t have bit events in my own channel or am I missing something here?