Hello everyone,
I’ve been working with Godot to connect to chat, I would like to use the EventSub but I’m hitting a wall in the last step (if that’s where the issue is). I would like to list the things I’ve done:
I have a bot account where I registered a new Private app to get the client_id and the client_secret.
With that I proceed to Godot with the following steps.
- First I ask for the Oauth token for the bot account with the scopes: user:read:chat and user:bot
This is the Body I’m creating
var body = "client_id=%s&client_secret=%s&grant_type=%s&scope=%s" % \
[
bot_client_id,
bot_client_secret,
"client_credentials",
"user:read:chat user:bot"
]
Thanks to this I get the Oauth Token. At this point, I have the Client_Id, the Client_secret and an Oauth Token for my bot account with the scopes to be able to read chat.
- After this, I need the broadcast_id of my channel. So I use the oauth token and client_id I have to get it.
Everything looks OK and I am able to get the Id.
Now I have also my channel’s broadcaster_user_id.
- Now I establish the connection with the EventSub. For this I don’t use any parameter I have up to now, I just connect and I receive the session_welcome message. I keep the session_id from this response.
Now I also got the session_id.
- Finally comes the subscription step. I use this values to make a POST to the subscription endpoint: “https://api.twitch.tv/helix/eventsub/subscriptions”
At the headers I set the authorization with my bot’s Oauth Token, the client with the bot’s Client_id.
At the body I set the scope to channel.chat.message, the broadcaster_user_id and the session_id
var url = "https://api.twitch.tv/helix/eventsub/subscriptions"
var headers = [
"Authorization: Bearer " + bot_oauth_token,
"Client-Id: " + bot_client_id,
"Content-Type: application/json"
]
var body = JSON.stringify({
"type": "channel.chat.message",
"version": "1",
"condition": {
"broadcaster_user_id": broadcaster_id
},
"transport": {
"method": "websocket",
"session_id": event_bus_session_id
}
})
And after all this I receive a 400 error.
I also tried adding the “user_id” at the condition part with the bot’s broadcast_id, that way I get a 403.
{"error":"Forbidden","status":403,"message":"subscription missing proper authorization"}.
I just don’t know what I did wrong. Did I make a wrong turn in one of the steps?
I tried to validate the Oauth token and it says that it’s ok and the scopes appear correctly.
If it helps, the bot account is a moderator in my channel.