Delete message API 401 incorrect user authorization

Hello dear devs friends, I’m trying to create a twitch bot that deletes messages that contains “banned” words from my list (the detection works just fine), but when I’m trying to delete a message using the API, I get a {“error”:“Unauthorized”,“status”:401,“message”:“incorrect user authorization”}. I already checked that I have the good type of token, the scopes are good too… Can’t figure out what the problem is.

Below is the code (using node js and I’m not using tmi.js)
botTwitchPassword → token
botTwitchID → client_id
broadcasterTwitchID → 35709149 (“samideau”)
botUserID → 971899362 (“samidana”)
id → id of the message
image

Thank you in advance!

Sounds like you don’t have a user token from ‘ 971899362’ (the bot)

Unless I do not understand something (sorry if that’s the case), the bot has a user token

Then that would suggest that samidana is not a moderator of samideau

Your token appears to be the correct type, for the correct user wit the correct scope.

However in your request you used id the correct parameter is message_id to deleted a single message.

Additionally you omitted the & beteween ${botUserId} and the id so id was being added to your bots/moderator ID.

1 Like

“samidana” is in fact a moderator of “samideau”

but I really did messed up with the “&” and message_id. I don’t know why I just wrote “id” instead of “message_id”.

Thank you so much for your help!

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