"Content" extension for twitch

A trivial question: what is the minimum set of necessary “files” (or components) to guarantee the extension to work on twitch? (in other words: what is the minimum structure of a “working” extension).
In the examples I found (they can be found in the twitch manual or on github) in the file hierarchy there are files describing functions, objects, their methods, etc., but there are also files (usually in the Json format) whose purpose is to me not clear (I know the Json format is a string representation an object).
Due to the fact that I see files with this format in each example, it seemed to me that such a file (one or more?) should be present even in the minimal assembly of the extension for twitch, but it is not clear to whom and where a certain Json file sends its data for Parsing.

A Twitch extension is just a Website.

So you need

  • a html file, which includes the JS Helper
  • a script file, that includes onAuthorised
  • a css file if you wast any CSS

That’s it.

You may then provide addition HTML/JS/CSS to power other views/integration slots, or only have one view

Not sure what this JSON file is that you refer to, can you link to one that you are looking at?

This example: twitch_profile_extension/extension at main · BarryCarlyon/twitch_profile_extension · GitHub

Provides only a single view.

  • index.html provides the HTML Structure and loads the JS Helper nad my JS
  • script.js provides the control logic and onAuthorised calls
  • style.css provides the theme/CSS

(config.js is just to avoid committing a “real URL” to the repository for this example’s backend/EBS)

The other files in this repo/example proivides the EBS or backend server for the Extension in order to make calls to the Twitch API

1 Like

For example here:

In this example of yours, you have three files of this format. I understand the assignment config_sample.json, but the other two do not.

This example is a nodeJS example.

nodeJS uses package.json to define the “program” and it’s dependancies
and package-lock.json to lock to specific versions of those dependancies (and sub dependancies)

For further reading:

This example, demonstrates how to make a curl type call to the Extension config and pubsub services to update the config of an extension and push that new config to running instances of an extension.

This would be used as part of your EBS/Extension backend Service, but it not uploaded to Twitch. You handle the hosting and running of Backend services.

The example itself is not an Extension.

1 Like

That is, if you just need to run a function or method contained in the extension ( for example by sending a command to start the function - timer() ), you need to do it via EBS using “update config”?

No. This example covers how to use the config service. You (probably) wouldn’t use the config service to do that

You can use whatever method you want to send a control signal to an extension.

Twitch provides the “Extension PubSub Message” system to make it eaiser to do this, but you don’t have to use it.

I don’t have an example that just sends a PubSub message since thats only a single call, and the config_service example describes a set of steps/proceedure to perform a config service update and push that to running instances (since config service updating doesn’t call the config service onChanged JS function)

You can however use the example to extract just the pubsub send call from it, or use the docs linked above to construct your own call.

1 Like