My bot can't start Raids

I currently have a bot that can write into the chat, send whispers, time people out, ban people, clear the chat and pretty much anything else I can think of.

/ban
/clear
/timeout

All work perfectly. However, I want it to also be able to trigger raids. Whenever I type in /raid or .raid nothing happens at all in the chat. If I go to the chat room and type this in myself, it works fine however.

Can anyone think of a reason why my bot is unable to do this?

I note that I am also unable to /host or /unhost.

My bot uses the same account as the channel, so it should have broadcaster access.

It signs in using an Oauth code generated from https://twitchapps.com/tmi/

Is this the problem? Should it be using another Oauth code?

Thanks in advance!

A bot cannot start a raid.

The raid command is not available for Bots

Thanks for your reply, but are you certain about that?

When I have Streamlabs Chatbot automatically send over /raid or when I have my StreamDeck send the message /raid both work perfectly fine.

Are they not essentially bots as well? Why can they do it, but my bot can’t?

Yes

They must be making a call to an undocumented API and not doing it via the bot itself.

Does that suggest that there is a way to get it working? I mean if 2 different companies managed to do it, surely there’s a way to get it working.

I’m not sure how Twitch is detecting whether it’s a bot or not. As I said, it’s signed in as the channel, so I thought it would be seen as the broadcaster.

The only source I’ve been able to find about this is on this site here

Where it seems you state

I’ve not tested it, but logically since it’s a chat command, then calling .raid target over Chat. just like a .timeout or .me should work fine.

Theres no (un)official API end point that I know of for it either. Just chat.

Might I ask where you found out that it is not available?

The Raid command triggers a GraphQL event.

We as third party developers are not supposed to be using the GraphQL API. It is undocumented and unsupport for third party developers.

Currently at this time there is not an official way for a third party developer to trigger a raid event.

The final post in the thread you linked to, where it doesn’t work. And my own tests

I see. Thank you for your help. If I find a way around it, I will share it here.

Looking into it a little more, it seems likely that they are simply using an older version of the Twitch API. Looking at their code, I’m seeing references to Kraken pop up here and there, along with “passport.twitch.tv” instead of “id.twitch.tv”.

I can get Streamlabs Chatbot to trigger a raid by having it post "/raid " when I type in a command, such as "!raid ".

It’s a work around, requiring an external program, and while I’d prefer to do this without it, I think this is the best result I’m going to get.

That would be unlikely. As I said graphQL is where a Raid is performed.

But the raid is triggered by the Chatbot, not using an external program.

As I have previously stated. That is impossible.

It must be an API call to a unsupported API end point

You’re more than welcome to say it’s impossible :smiley:
All I know for a fact is that I create a command in Streamlabs ChatBot that will have the chatbot say whatever I want when I say !bananas, for example.

When the program detects me saying something, it posts a custom message directly into the chat. Perhaps it’s this point that it’s doing something behind the scenes, such as your unsupported API end point.

When it sees "!Bananas ", it posts "/raid " or whatever else I ask it to post. This in turn successfully triggers the raid. Same works for /host and /unhost.

Twitch used to have the ability to trigger raids and follow people using bots, but they removed that feature for new applications, leaving it in place for those that were created before its removal. New applications do not have access to it (found it on the Twitch API documentation).

My theory was that these older programs, that I’ve seen are still using code from 2 years ago, are still able to do it.

In any case, I’ve found a way around it, and it turns out bots indeed can start a raid through a little effort :slight_smile:

So I went and tested it just to cover my bases

It seems it does now work over IRC, and this changed at some point, and no one noticed/commented on it. As it never used to work over IRC.

I tested it on a channel that I am an editor of.

So you just need to make your bot be an channel editor of your channel. Which is done via your channel dashboard

1 Like

See, that’s what I find odd. I’m posting as the broadcaster using:

“PRIVMSG #example :/raid example2”

And it refuses to work. However:

“PRIVMSG #example :/timeout example2” works fine. It’s just /raid, /host and /unhost that don’t work.

No idea why.

/timeout only requires channel moderator permissions, where as /raid, /host and /unhost all require channel editor permissions (through the channel_editor scope, or the user attempting to run those commands being set as an editor by the broadcaster through their dashboard)

1 Like

Yup, the scopes I’m using (to try to get this to work) are:

scope=user:edit+user:read:email+analytics:read:extensions+analytics:read:games+bits:read+channel:read:subscriptions+clips:edit+user:edit:broadcast+user:read:broadcast+channel:moderate+chat:edit+chat:read+whispers:read+whispers:edit+channel_editor

Still not having any luck with it.

I’d have thought that because the bot is posting as the broadcaster, they’d have the same permissions as the broadcaster.

It’s a little hard for me to test right now as my bots use the old chat_login scope, so can start raids in their own channels, and any channel their set as an editor for, despite not having the channel_editor scope.

One question though, why do you have so many scopes? analytics:read:games for example is of no use to you unless you’re a registered game developer. It’s considered bad practice to request excessive scopes that you have no legitimate use for.

This isn’t for the final build. I literally added as many scopes as I could to figure out which one allowed a raid, yet it wasn’t working :frowning:
The actual bot, for most of what I need, doesn’t require any scopes at all, apparently, as it’s posting as the broadcaster.

Interestingly, I’ve been grabbing my Oauth from https://twitchapps.com/tmi/

So I do wonder if that’s where the scope is being requested, and it’s simply not requesting the editor scope.

The channel_editor scope is confusing in this case.

Since you are requesting this scope to make API requests on behalf of another user.

But if the bot is logged in as user “bot” if it can’t use a key scoped to channel “foo” with “channel_editor” since it’s logged into chat as the bot. And there are no related API requests.

Potentially requires more testing, but it might just be preferrable to not initiate a raid progmatically, since you still need to provide the bot, if you want to raise the raid from a bot, with a target to raid, which means you are typing something in somewhere anyway. So it might just be easier to type it into Twitch Chat, rather than to type if to your bot, to make your bot type it into twitch chat.

This is generally considered a concern for a lot of broadcasters, they don’t like to give out chat write privileges, generally speaking.

Eventually this will be an issue as, if they are not already, tokens generated here will expire, and you won’t be able to renew them as your will never have this websites client secret. So you will need to look at implementing your own oAuth loop