I have an app, that connects to a channel and listens to chat messages via Websocket.
I can get message and author just fine, however I would like to get more info about who wrote the message - especially badges and name colour, but the more info the better.
Is there any way to do that? Chatbots like Streamlabs are somehow viewing the messages perfectly, with badges and colours, so I would imagine there’s a way to do it… but no matter how much I look, the only piece I found was “https://api.twitch.tv/kraken/users/user_id/chat/channels/channel_id”, but as far as I understand it’s depreciated now.
Any ideas are highly appreciated!
That would be using the tag data that is supplied with the message
@badge-info=<badge-info>;badges=<badges>;color=<color>;display-name=<display-name>;emotes=<emotes>;id=<id-of-msg>;mod=<mod>;room-id=<room-id>;subscriber=<subscriber>;tmi-sent-ts=<timestamp>;turbo=<turbo>;user-id=<user-id>;user-type=<user-type> :<user>!<user>@<user>.tmi.twitch.tv PRIVMSG #<channel> :<message>
So you just need to enable the CAPabilities for Tags (and most people also grab commands) and parse out the tag data for color, displaynane and badges.
It’s there in chat itself no API calls needed
Cap requesting is covered here - IRC Guide | Twitch Developers
Parsing the data, thats up to you to devise but heres a quick JS example - https://github.com/BarryCarlyon/twitch_misc/tree/main/chat
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.