Wondering if anyone more knowlegable than myself could provide something i might be missing.
I am trying to build a feature into my application backend that will send a Chat message to broadcaster channel, when a db item is created.
So far i have thought about asking the broadcaster to make a specific twitch user (branded as my application) a Moderator. And then using the send chat announcement API to send a Chat message.
But i see a problem in that it requires a User Access Token, which will obviosly expire etc. And to obtain initially or renew, the specific twitch user would need to Authorize in the browser. For my use as a kind of backend service user, this obviously wont work.
I have also checked out the send extension chat message, this would get around the problem, but it would only send a message when an action has happened in the ext panel, which is not good if something is created in the web app.
The service is seeded with a user token and the service uses the refresh token to refresh and get a new token when the token expires.
If the refresh token dies and cannot be used then you’ll need to give you service a new token.
If the broadcaster controls the bot account then they can go to your website/tool and provide a new token without your involvement.
Extension chat is not tied to doing an action in the extension. But of course here the channel will need to have installed and keep active the extension which doesn’t seem to fit with your described use case.
This is how oAuth works.
Even if you were on google you’d be utilising a token of type/scope offline which allows refreshing the user token, and have to deal with dead refresh tokens needing to reauth all over again