# Accessing whispers with bots

**URL:** <https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208>\
**Category:** Chat and IRC\
**Created:** [June 10, 2020, 11:35pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208 "2020-06-10T23:35:01Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![JLN](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@JLN](https://staging-discuss.dev.twitch.com/u/JLN)\
**Post date:** [June 10, 2020, 11:35pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/1 "2020-06-10T23:35:01Z")

</div>

So I read that sending whispers is not easily possible without it being a known bot. But that’s not really what I care about. Is there a way to access whispers while you are connected to a specific channel? Im not using any library

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [June 10, 2020, 11:38pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/2 "2020-06-10T23:38:42Z")

</div>

You need to parse from the “non standard” IRC message sent as WHISPER as apposed to PRIVMSG. Using IRC vernacular, the command is WHISPER instead of PRIVMSG.

And have logged into chat using an oAuth that grants whisper reading, so scope `whispers:read`

---

<div class="post-metadata">

**Author:** ![JLN](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@JLN](https://staging-discuss.dev.twitch.com/u/JLN)\
**Post date:** [June 10, 2020, 11:47pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/3 "2020-06-10T23:47:27Z")

</div>

Im not quite sure what you mean… never worked with scopes or anything just want to check if “…” is in a whisper of user “x”

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [June 10, 2020, 11:49pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/4 "2020-06-10T23:49:11Z")

</div>

> **[Authentication](https://dev.twitch.tv/docs/authentication/)**
>
> Authentication

At the bottom of this page, covers the Authentication scopes for chat.

In order to login and read/send to chat as a bot, you generate a token with `chat:read` and `chat:edit` and receive whispers you need `whispers:read` also on your token

---

<div class="post-metadata">

**Author:** ![JLN](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@JLN](https://staging-discuss.dev.twitch.com/u/JLN)\
**Post date:** [June 11, 2020, 12:41pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/6 "2020-06-11T12:41:05Z")

</div>

Okay, I figured out how to use the scopes, but is there a way to check if the scopes are accessible by the bot? I tried going with whispers:read but that doesnt seem to give me access to see whispers I guess.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [June 11, 2020, 12:41pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/7 "2020-06-11T12:41:57Z")

</div>

You’ll also need to update your parser

> [@BarryCarlyon](#):
>
> You need to parse from the “non standard” IRC message sent as WHISPER as apposed to PRIVMSG. Using IRC vernacular, the command is WHISPER instead of PRIVMSG.

Or just log every incoming raw message before you parse it

---

<div class="post-metadata">

**Author:** ![JLN](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@JLN](https://staging-discuss.dev.twitch.com/u/JLN)\
**Post date:** [June 11, 2020, 1:02pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/8 "2020-06-11T13:02:40Z")

</div>

You said I should change the parser to WHISPER, right? I cant find anything in the doc about it. And as PRIVMSG is used for sending messages, I assume that WHISPER is whispering to a specific person, right? But I just want to check the whispers in that case. I dont want to whisper anything to anyone.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [June 11, 2020, 1:05pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/9 "2020-06-11T13:05:34Z")

</div>

To send a whisper

> PRIVMSG #somechannel :.w target words to be sent

To Recieve a chat message

> TagsAndHostStuff PRIVMSG #channel :chat message

To Recieve a whisper

> TagsAndHostStutff WHISPER yourname :Whisper message

Or if easier use the Whispers PubSub Topic

> **[PubSub](https://dev.twitch.tv/docs/pubsub/)**
>
> PubSub Guide

---

<div class="post-metadata">

**Author:** ![JLN](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@JLN](https://staging-discuss.dev.twitch.com/u/JLN)\
**Post date:** [June 11, 2020, 1:31pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/10 "2020-06-11T13:31:50Z")

</div>

So if I would say `if "WHISPER :tmi.twitch.tv" in line:` would that be executed everytime the person gets a whisper?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [June 11, 2020, 1:32pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/11 "2020-06-11T13:32:40Z")

</div>

That doesn’t look like any language I’m familiar with so I don’t know

---

<div class="post-metadata">

**Author:** ![JLN](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@JLN](https://staging-discuss.dev.twitch.com/u/JLN)\
**Post date:** [June 11, 2020, 1:40pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/12 "2020-06-11T13:40:36Z")

</div>

Other question then. Im logging every line in the socket just for debugging purposes, so if I get a whisper, shouldnt there also be something logged in the socket? Normally if somebody sends a message in a specific channel or the servers send PING it gets logged in there, so why arent whispers getting logged? Is that my problem? This is what I mean, why isnt there something similar with whispers:  
 ![grafik](https://d2spem0quai2ol.cloudfront.net/original/2X/f/fb9c45305f77053713988f6bfd5736e217dfd9c3.png)

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [June 11, 2020, 1:41pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/13 "2020-06-11T13:41:31Z")

</div>

I don’t know, works on my machine.

---

<div class="post-metadata">

**Author:** ![JLN](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@JLN](https://staging-discuss.dev.twitch.com/u/JLN)\
**Post date:** [June 11, 2020, 1:43pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/14 "2020-06-11T13:43:38Z")

</div>

So if whispers are similarly logged on your machine there has to be problems with the scopes right?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [June 11, 2020, 1:45pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/15 "2020-06-11T13:45:58Z")

</div>

if you are logging every message that the server is sneding and your bot is not seeing the whisper, then it could be scopes or something else

---

<div class="post-metadata">

**Author:** ![JLN](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@JLN](https://staging-discuss.dev.twitch.com/u/JLN)\
**Post date:** [June 11, 2020, 1:52pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/16 "2020-06-11T13:52:10Z")

</div>

Is there a step I have to do after clicking the authorizing button on the authorization page?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [June 11, 2020, 2:00pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/17 "2020-06-11T14:00:32Z")

</div>

Depends which authentication flow you are using

---

<div class="post-metadata">

**Author:** ![JLN](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@JLN](https://staging-discuss.dev.twitch.com/u/JLN)\
**Post date:** [June 11, 2020, 2:04pm UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/18 "2020-06-11T14:04:17Z")

</div>

not sure but looking at the options I assume that I use the Authorization code flow

---

<div class="post-metadata">

**Author:** ![Maeglin](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/maeglin/32/1166_2.png) [@Maeglin](https://staging-discuss.dev.twitch.com/u/Maeglin)\
**Post date:** [June 16, 2020, 6:05am UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/19 "2020-06-16T06:05:34Z")

</div>

Getting whispers in the IRC interface might be scope-related, or it might be related to an IRC capability that needs to be requested ([twitch.tv/commands?)](http://twitch.tv/commands?)). Since none of that was documented, I ended up going the PubSub route.

---

<div class="post-metadata">

**Author:** ![system](https://d2spem0quai2ol.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://staging-discuss.dev.twitch.com/u/system)\
**Post date:** [July 16, 2020, 6:05am UTC](https://staging-discuss.dev.twitch.com/t/accessing-whispers-with-bots/26208/20 "2020-07-16T06:05:38Z")

</div>

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