Hello there,
The App I’m currently working on needs to send messages as a bot. I have gotten a User Access Token and cand send messages directly as that user no problem.
The issue I have is sometimes I want to send the message as a bot and not that user. I am not sure how to get the ID of my App, if you even can, to use as the user_id in my HttpRequest.
The user_id for the User Account I obtain using the User Access Token and call the Get Users endpoint without issue. If I call the same endpoint using my App Access Token token is says I must supply the login or id as a query parameter.
In another post I found I am told:
And if you make a request to the Get Users endpoint https://dev.twitch.tv/docs/api/reference#get-users using your bots name as the login param you will get a result back containing your bots user ID.
I tried to use my Apps Name as the login parameter, but my response was and empty array.
Elsewhere I read that you need to create a new Twitch account to specifically use as a bot, but that doesn’t seem right to me.
I am under the impression that your app itself can act as a bot user just so long as the proper scope is provided (which it is).
How do I figure out what the App / Bot user_id is so I can send messages as a bot?
Thanks for any help you can provide.
An App doesn’t have an ID.
(also The owner of the App is irrelevant)
Then auth the bot account to your ClientID
Then use the user access token for the bot.
Or use App Access token (after authing relevant parties)
Becuase App Access tokens don’t have a userID. (or attachable scopes)
No that is correct. You need to register the bot account just like another other user.
Only if you have authed the bot user to your ClientID
So for example:
I own my ClientID:
I have authed the streamer cohhcarnage (26610234) to my ClientID with channel:bot scopes
I have authed the user cohhilitionbot (45522171) to my ClientID with user:bot (and other scopes for send/recieve chat)
Then I use those two userID’s with my app acess token (which has no scopes) to send chat messages.
All bots on Twitch are created Twitch accounts.
Twitch is not like Discord where a Discord ClientID can have a bot acount generated/attahed to it.
Alright thanks so much, this helped me out a lot.
I was expecting it to be more like Discord like you said.
I guess my best option is to simply send the messages as the user, I don’t want people to have to authorize two separate accounts.
Appreciate the quick response
That is what I do (two accounts) and I feel that is what broadcasters expect.
Or to use your bot account instead. So you auth your bot account to your clientID.