Hi there.
I am working on a chatbot, and I expect it to have a lot of users so I wanna move away from IRC and over to the eventsub architecture.
I’m reading the Twitch API docs and I see the following for the Send Chat Message endpoint:
Requires an app access token or user access token that includes the user:write:chat scope. If app access token used, then additionally requires user:bot scope from chatting user, and either channel:bot scope from broadcaster or moderator status.
I use the user access token for the bot with the scope user:bot (and chatting) to chat in channels.
I use the user access token for each user with the scope channel:bot.
But then what do I use the app access token for?
This is all very confusing
I have a decent understanding of all the other aspects, but this is pretty confusing to me.
The Chat Send API also supports using an app access token.
An example:
To connect bot foo to freds channel in read/write mode
Generate a user access token for foo with user:read:chat and user:write:chat and user:bot
Ask fred to authenticate, generating a user access token with channel:bot
Once thats both done foo can read/write to freds channel using the app access token on a webhook or a conduit. And use the same app access token to send on the API
Generally in my opinion Chat Bots will use a conduit where the shard(s) are attached to a websocket.
So a conduit will require an app access token.
The Send Chat Endpoint supports both token types, as it means that your bot doesn’t have to handle multiple tokens, just the app access token to sending messages with and assigning shard to a websocket via the conduit API’s which need an app access token.
Sure you’ll still need the bot’s own user token if your bot is doing moderation actions but thats a different discussion