All Articles

Twitch IRC event message layout (sub example)

Here is an example of the message string (with breakpoints to read it easier) received from twitch irc chat when a user subscribes to a channel.

 @badge-info=subscriber/0
 badges=moderator/1,subscriber/0,premium/1
 color=#2226B2
 display-name=burago18
 emotes=
 flags=
 id=229ecd51-1ec2-4dda-ae43-6ac4058a25a3
 login=burago18
 mod=1
 msg-id=sub
 msg-param-cumulative-months=1
 msg-param-months=0
 msg-param-should-share-streak=0
 msg-param-sub-plan-name=Channel\sSubscription\s(yourchannel)
 msg-param-sub-plan=1000
 room-id=36476430
 subscriber=1
 system-msg=burago18\ssubscribed\sat\sTier\s1.
 tmi-sent-ts=1574904233310
 user-id=44812924
 user-type=mod :tmi.twitch.tv USERNOTICE #yourchannel

Useful information to parse from there are the msg-param-* parts, where you can get the subscription level selected, how many months and other stuff that they use to display the event in the chat properly.

I’m using this to display notifications in a html5 canvas, which is rendered over the video stream in OBS, and also for a loyalty points system within a chat bot for that channel.

Similar to this layout theres one for twitch points, twitch bits, raids, and other events with a custom style in the chat.

I will post the example in a future post, I would like to document how I solved many features requested for chatbots, loyalty systems, discord integration, etc.