PubSub Resubscriber Payload


#1

I’m hoping you can help us track down an issue we’re facing; unfortunately we don’t see enough resub events currently to conclusively go “this is it”.

The documentation says that for a resub PubSub event, we should expect to receive cumulative-months and streak-months. Copying the payload from the docs and running it from frontend all the way through to our API handles the data correctly - we extract the username, months, message and plan as expected.

Despite this then, we are seeing that we always store months = null, suggesting that we’re not receiving a cumulative-months field. Does anyone know what gives?


#2

You should always get cumulative_months butstreak_months` can be ommited.

Resubscribers can choose to not share their streak so you should always get cumulative_months

I’ve not seen any missing cumulative_months today.

You should be processing only cumulative_months and streak_months

You may still receive a months key but that is deprecated in favor of cumulative and streak.

You may receive a payload that doesn’t have streak_months present as it is optional for a viewer to share their streak.

TLDR: cumulative_months is always on

Also looks like a Typo in the docs

{
   "type": "MESSAGE",
   "data": {
      "topic": "channel-subscribe-events-v1.44322889",
      "message": {
         "user_name": "dallas",
         "display_name": "dallas",
         "channel_name": "twitch",
         "user_id": "44322889",
         "channel_id": "12826",
         "time": "2015-12-19T16:39:57-08:00",
         "sub_plan": "Prime"/"1000"/"2000"/"3000",
         "sub_plan_name": "Channel Subscription (mr_woodchuck)",
         "cumulative-months": 9;
         "streak-months": 3,
         "context": "sub"/"resub",
         "sub_message": {
            "message": "A Twitch baby is born! KappaHD",
            "emotes": [
            {
               "start": 23,
               "end": 7,
               "id": 2867
            }]
         }
     }
   }
}

Should be

{
   "type": "MESSAGE",
   "data": {
      "topic": "channel-subscribe-events-v1.44322889",
      "message": {
         "user_name": "dallas",
         "display_name": "dallas",
         "channel_name": "twitch",
         "user_id": "44322889",
         "channel_id": "12826",
         "time": "2015-12-19T16:39:57-08:00",
         "sub_plan": "Prime"/"1000"/"2000"/"3000",
         "sub_plan_name": "Channel Subscription (mr_woodchuck)",
         "cumulative_months": 9;
         "streak_months": 3,
         "context": "sub"/"resub",
         "sub_message": {
            "message": "A Twitch baby is born! KappaHD",
            "emotes": [
            {
               "start": 23,
               "end": 7,
               "id": 2867
            }]
         }
     }
   }
}