Oleh
Oleh

Reputation: 23

Can't send a message to Twitch chat via API

Can't send a message to Twitch chat via API

I want to send a message to Twitch chat using their API, but I get the error:

The sender must have authorized the app with the user:write:chat and user:bot scopes.

When I received the token, I specified the parameter --data-urlencode 'scope=user:write:chat user:bot' but it still doesn't work.

In the API responses https://id.twitch.tv/oauth2/token and https://id.twitch.tv/oauth2/validate scopes is present, but this error occurs when sending messages.

To send messages, I will use the example from the documentation. Of course, I replaced the test data with real data.

curl -X POST 'https://api.twitch.tv/helix/chat/messages' \
-H 'Authorization: Bearer 2gbdx6oar67tqtcmt49t3wpcgycthx' \
-H 'Client-Id: wbmytr93xzw8zbg0p1izqyzzc5mbiz' \
-H 'Content-Type: application/json' \
-d '{
  "broadcaster_id": "12826",
  "sender_id": "141981764",
  "message": "Hello, world! twitchdevHype"
}'

Upvotes: 0

Views: 50

Answers (0)

Related Questions