Channel Points Redemption PubSub Example Message Is Missing topic/message type

The Twitch PubSub documentation (PubSub | Twitch Developers) has an incorrect example for Channel Points Redemption. As can be seen from every other example, the real message sent by Twitch contains the message type (“MESSAGE”) and topic (like “channel-subscribe-events-v1”). However, the example for Channel Points Redemption omits this which makes it hard to debug/troubleshoot.

As a side question, this makes me wonder if the formatting of Channel Points Redemption is any different from other examples (such as “Channel Subscriptions Event Message”). For Channel Points Redemption, I’ve noticed that the message is doubly JSON encoded. For example, the following code does NOT work (although it would seem like it should based on the examples provided by Twitch).

onmessage(event) {
   display_name = JSON.parse(;

Instead, you need to do the following

onmessage(event) {
   display_name = JSON.parse(JSON.parse(;

It would be helpful if all the examples described this nesting correctly; which would dictate that the nested JSON objects should be interpreted as strings.

– EDIT –
I just noticed that other examples (like Bits) actually does include the full nested examples. Channel Redemptions and Channel Subscriptions examples opted to show it more visually elegant but in a misleading (and inconsistent) way. Channel Subscriptions examples includes the topic/message in the print as where Channel Redemptions does not.

With that in mind, let me make my suggestions more clear:

  • Add a raw example for Channel Points & Channel Subscriptions messages (similar to the raw examples provided for “Bits Event v1 Message”).
  • Either include topic/message type in both Channel Points & Channel Subscriptions visually elegant example OR don’t show it in either. Currently, one has it (subscriptions) and one does not (channel points).

As a long time PubSub user, never noticed that the docs were wrong but I moved to live examples rather than check the docs meself.

Documentation issues will want to be filed to Issues · twitchdev/issues · GitHub

Additionaly it is advised to move to EventSub over WebSockets from PubSub.

EventSub is the future and in my opinion it’s possible PubSub gets closed from third party use in favour of eventsub

Thanks for the reply! Even more, thanks for the multiple replies and great examples I followed (like your implicit auth example; super helpful!). By the way, how do you do live examples / tests for subscriptions or bits redemption? Do you / your broadcaster pay for them to test them?

I noticed something even more devious about the examples… The bits redemption example claims “is_anonymous” field is in the message (same scope as “message_type”) but it is actually in the “data” field :man_facepalming:

I’ll close this and post in the correct section; thanks for the tip!

Ironically, you can no longer cheer anonomously so this will always be false.

You know what’s even better about it? It is marked “is_anonymous: true” but has a user_name :joy:

“message”: “{"data":{"user_name":"jwp","channel_name":"bontakun","user_id":"95546976","channel_id":"46024993","time":"2017-02-09T13:23:58.168Z","chat_message":"cheer10000 New badge hype!","bits_used":10000,"total_bits_used":25000,"context":"cheer","badge_entitlement":{"new_version":25000,"previous_version":10000}},"version":"1.0","message_type":"bits_event","message_id":"8145728a4-35f0-4cf7-9dc0-f2ef24de1eb6","is_anonymous":true}”

Thats sorta correct.

Since there is an anonomous user ID and username, it’s just the wrong name in this example

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.