Question about first Exstention

Hello, I’m developing a desktop app and an exstension and I’ve some question about how to link them. I’m able to login with twitch from my app using Implicit grant flow and got an access token using the extenstion client_id. Since I want to test if this exstension would be good I don’t have and don’t want to use any external server / service other that Twitch systems right now. So the questions are:

  1. Right now I use redirect on localhost:PORT on my desktop app, I’m able to extract the access token and save it on disk. Is this good or for security reason is mandadory to use an external server and doing server-to-server requests to Twitch APIs?
  2. There is an endpoint or a PubSub or an EventSub that can I use to send data from my app to extension or am I obliged to create my own event system (like Kafka)? Example scenario: broadcaster set some data on the app, it should notify all the extension active in that moment for that broadcaster.
  3. Can channel points be used to redeem something in my extension like the bit system?

If you are authenticating a viewer you do not need to use oAuth

see requestIdShare instead - Extensions Reference | Twitch Developers

If you are needing to get a token from the broadcaster for scopes other than the subscriber read scope then you will need an oAuth flow yes, but you’d probably want the code flow not the implict flow so you can get a refreshable token.

See send extension pubsub message - Reference | Twitch Developers

And to listen in the front end - Extensions Reference | Twitch Developers

Depending on what you might doing you might use the helper send function but I imagine most of your messaging will come from your EBS/Server.

So yes Twitch provides a messaging service but you can use your own messaging service.

You can also use the config service to store configuation data

Technically yes.

Please refer to the Channel Points Acceptable Use Policy to ensure you are compliant - Twitch.tv - Channel Points Acceptable Use Policy

Channel Points would require a server/backend in order to consume the chnanel points usage event.

This is generally not good practice since if a user is behind a firewall that only allows SSL traffic on the SSL point you’ll run into issues. Let along localhost to me is my computer not yours. Removed as misread your usecase

Sure you can have the streamer install software on their computer for an extension, but then that software can’t talk to the Twitch API to send extension pubsub messaging as you’d leak your Extension Secret.

And if you want to use channel points, you’ll need a server in order to consume the events via eventsub. (yeah your desktop app could connect to EventSub Websockets to consume but then you can’t talk to your extension)

So you’ll want an EBS/External Server to start with, in my opinion.

Thx for reply. Now I see more clear all the system.
The desktop app is used by the streamer, the viewer will use the extension to interact with it.

The scenario is:

Streamer PC with my desktop App ← WebSocket (Twitch or my own systems) → Extension on Twitch streamer page

I know that the best environment is using my own servers, but I was wondering if I can use what twitch offers me since it is better distributed than what I could do by my self (with low-to-zero budget).
But I see that I need to use Extension Secret to access pubsub, so I definitely need to develop my own system and can’t put that secret on desktop app :pensive:

All this comes from a simple wondering. I can use a server to do server-to-server communication, but that would be my single point of failure. So I need to add more server to distribute the loads and the price to get all this machines goes higher

Well your server will only need to handle the traffic that goes desktop app → server → Twitch PubSub.

So your server wouldn’t take any viewer traffic potentially.

Based on the information presented that is!

desktop app ↔ server ↔ Twitch PubSub ↔ extension

with only the bare minimum application logic information

Well I still have some raspberry somewhere to use as server and test the system :joy:

Thx for helping!

@BarryCarlyon I’ve a question about Channel Points, I understand that there is no way to add product with cost in Channel Point (the API accept only bit amount or free), but I can create a custom channel point reward (that goes wiht all other channel rewards) via Twitch API. Some question about this:

  1. There is a way to hide custom channel reward from the list (so I don’t mess the broadcaster list)?
  2. Can I force redeem a custom channel point through api? A viewer click on a button and with some token I can trigger that reward

No, you can’t hide rewards from the list.

No, there’s no way for you to force users to spend channel points.

All you could do is have the user go through the list of rewards, click on the one created by your extension themselves, and have your extension listen for that redemption so that you can take some action within your Extension.

Channel Point rewards can only use Channel Points.

They cannot be 0 Channel Points
They cannot use bits

See also the guide for creators: Twitch Help Portal

If a channel point rewards is hidden (disabled) then it cannot be used in the “channel point shop” as it is disabled

Channel Point Rewards can only be used in the “channel point shop” below the chat box

You’d consume redemption “purchases” via EventSub or polling the API, not a callback like bits products in extensions do. (But bits productions in extensions also have an API and EventSub to use as well0

Ok thanks a lot. I need to review my idea about using channel points so.
Hope one day Twitch Devs will add something like “Channel Points in Extension”

Hello, I’ve other question about my first extension. Now I’ve a minimum EBS that I use as redirect after login to create an access token with Code so I can store user information like access token and its refresh token.

  1. Right now I’m in local test mode and only my account can see the extension panel, how can I test the extension panel as viewer (logged with another account to test on broadcaster page)?
  2. I see that bit in extension has a limit of 250 product in it, I wonder how sound alerts can manage all the sounds with their own price. As I can think is that they have only a catalogue of generic bit prices (5 -10 - 100) and then they bind a specific user sound to a generic price sku, but the extension.bits_transaction.create EventSub will send only info about generic bit product and not specific user sound :thinking:
  3. Since I’ve access token stored in my EBS, I see that EBS can interact with extension panel through Send Extension Chat Message, Send Extension PubSub Message and extension.bits_transaction.create. Is this the correct way to manage the communications or there is some other endpoints that let my desktop app to interact directly with my extension bypassing EBS?

Add the other user to the testing allow list

You create a basket style flow. Or something that can handle metadata/additional data.

When you pass the trasnaction JWT up to your server you pass the basket/meta data with it as well.

A desktop app cannot bypass the EBS requirement.
A desktop app cannot generate a JWT to call the API with without leaking your extension secret.