Private messages

Hi. How can I get a private message sent to me?

Do you mean on this forum? It goes through user profiles (like and then a button labeled “Message” in the top right-hand corner when signed in.

If you’re looking for help on a specific subject, feel free to post about it. If you’re looking for private consultation or discussion, you’ll probably need to at least mention why you need help so that an applicable person can attempt to help.

If you’re looking for help on Twitch whispers, try searching the forum or the documentation for where to get started.

Twitch whispers. But I cant find it in documentation

If you’re trying to receive whispers via the IRC system, you need to connect, send the CAP REQ for at least commands, send a valid OAuth token, and then listen for WHISPER commands.

The important line:


The response:


And then so on…

< PASS oauth:token_here
< NICK username_here
> 001 username_here :Welcome, GLHF! 002 username_here :Your host is 003 username_here :This server is rather new 004 username_here :- 375 username_here :- 372 username_here :You are in a maze of twisty passages, all alike. 376 username_here :>

Then send a whisper to username_here:

> :alca! WHISPER username_here :Hello bot!

And then reply from the bot

< PRIVMSG #jtv :/w alca Hello back!
1 Like

A WHISPER and a PRIVMSG are very similar, except for the tags that are passed with each IRC message.

The following is what is received through the IRC when RokuHodo_ sends a WHISPER to RokuBotto:

// -- WHISPER Example --
// @badges=premium/1;
// color=#FF0000;
// display-name=RokuHodo_;
// emotes=;
// message-id=561;
// thread-id=45947671_51012150;
// turbo=1;
// user-id=45947671;
// user-type= 
// :rokuhodo_! WHISPER rokubotto :test

The following is what is received when a user sends a standard PRIVMSG:

// -- PRIVMSG Example --
// @badges=broadcaster/1,premium/1;
// bits=1000;
// color=#FF0000;
// display-name=RokuHodo_;
// emotes=;
// id=37607eff-1761-4dc7-99ea-b476277497e6;
// mod=1;
// room-id=45947671;
// sent-ts=1497390276217;
// subscriber=0;
// tmi-sent-ts=1497390277408;
// turbo=0;
// user-id=45947671;
// user-type=mod 
// :rokuhodo_! PRIVMSG #rokuhodo_ :cheer1000

Essentially, they are both just IRC messages that need to be parsed based on whether the IRC command is WHISPER or PRIVMSG. Also, like @Alca mentioned, you need to request the commands after signing into the IRC to receive WHISPERs.

Back before API v5, these used to be received through different hosts, but are now both received through

I’d first recommend you parse the IRC message based on the RFC 1459 Message Spec like I do in my parser. Then after that it should be very easy to parse it even further once you have all the information sorted.

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