Need help with backend to send message in chat from panel extension

So I’ve tried to make an panel extension that sends different messages to the chat, depending on the button that was pressed in the panel. I’m not really a programmer and I know some basic html, css and js.

I have a question before I get into my problem:
Do I even need to set up a server for this kind of extension and do I have to host this server all the time from my personal computer? (if so I consider making the buttons just save the text to clipboard so the watchers have to send the text themselves.)

I have never set up a server before but tried it for this extension. I set up my frontend and then followed some text tutorials to set up the server but I didn’t really understand what I was doing. I got stuck at the OAuth token that I was supposed to generate and today I read that the PubSub service will be shut down in April 2025. At this point I’m just very confused.

So if I do need a server: does anyone know a tutorial for dummies on how to set up a server to send chat messages from a panel extension?

As the docs for Send Extension Chat Message state:

Requires a signed JSON Web Token (JWT) created by an Extension Backend Service (EBS).

So you would need a server to send Extension Chat Messages, as you can’t sign a JWT client-side without exposing your Client Secret.

Twitch host the frontend, but you’re responsible for any backend. So if your server isn’t running all the time, your Extension would lose all functionality that requires it when it’s not running. It doesn’t have to be your personal computer, and I’d recommend it NOT being your personal computer or otherwise you’re exposing your IP to everyone who uses your Extension, including any malicious actors, but where you host it in the end is entirely up to you as long as it all meets the Extension Guidelines (such as any connection between frontend and backend being secure).

Do you need an OAuth token on your EBS? To send Extension Chat Messages you need a signed JWT. If you still need an OAuth token for other things, what issues are you having?

That doesn’t impact Extension PubSub, and there are more suitable alternative to regular PubSub these days such as EventSub which has largely replaced it.

Okay thank you!

What options do I have to host the server or what would you recommend? (I’m sorry for the dumb questions but I really have no experience with backend programming)

As for the OAuth token: I’m not sure if I need it (nor do I really understand it). To clarify: my extension is like a menu card with drinks (buttons) on it. Each button is supposed to send the according Name in the chat. That’s it. If you say a signed JWT is all I need for that then I’ll try to read up on how to set that up.

If you button is in the Extension Config panel

The JWT in the configuration panel can be used to send chat, just need to make a fetch call.

No need to self construct a JWT or need a relay server as dist describes

So the question is: where are these menu buttons?

Okay so I made the extension work by just making the buttons copy the commands to clipboard. That’s the solution for the moment. Here’s the link to the github: GitHub - CelestialInsomniac/Coffee-Talk-Extension and the testing link: Coffee Talk Menu. Instead of copying the command to clipboard, the button should send it directly to the chat (if that’s even possible).

I assume that the config panel is a separate menu for the streamer configuring the extension? If so, I didn’t make one because the extension is for a friend of mine and I will be handling everything related to the extension.

Yes: example:

You could put the buttons in question here. And then do code/function like this

if it’s only for one guy then, in my opinion it’s fine for the code you give to them to contain the extension JWT secret, as it’s just for them, the security risks are lesser. So you can sign the JWT locally to send to chat. As then you are running the same as my “extension test tools (not an #ad just linking for exampleness)” do where you enter your Secrets into the app and construct/send locally. So the secret isn’t in the code but provided.

or run as a proper chat bot using Helix Send instead of Extension Send, and oAuth in the bot/streamer account with chat:write permission