Saving Extension Configuration

Hello, I’m creating an extension with React, and I’m having trouble with saving a streamer’s configuration data. I’ve tried following the documentation, and yet it seems my code doesn’t work and I can’t figure out why. For the sake of clarity, I’ll provide a minimal example of what I’d like to do.

Like I mentioned, I want to save a streamer’s configuration. Let’s say I’m trying to save the following:

configData = {
  ign: "Value1",
  color: "Value2"
}

On the click of a button, I want to save this data. I have tried using window.Twitch.ext.configuration.set("broadcaster", "1.0", JSON.Stringify(configData)). The call seems to work when I check the network tab, but I struggle with 3 things.

Firstly, I am unsure how to grab this configuration data when the streamer re-opens the configuration page. If someone could provide a minimal example that would work with React I’d greatly appreciate it.

Second, when exiting out of the configuration page after presumably saving the data, the extension still says it “Needs Configuration”.

The second part leads into the third, I’m not exactly sure my extension configuration settings are correct on my extension dashboard. I have selected the Extension Configuration Service, and put “1.0” into the Broadcaster Writable Channel Segment Version but due to my issues I’m not certain this is correct.

If anyone could provide guidance regarding these it would be greatly appreciated, thank you!

Did you actually enable the Twitch Configuration Service in the Developer Console for the current development version of your Extension?

And/or consider binding a log onto onError

Swap developer for the segement you want to read from.
This only works once per page load.

function configure() {
    window.Twitch.ext.configuration.onChanged(() => {
        try {
            if (window.Twitch.ext.configuration) {
                if (window.Twitch.ext.configuration.developer) {
                    if (window.Twitch.ext.configuration.developer.content) {
                        // do stuff with the config, probably JSON parse it first
                    }
                }
            }
        } catch (e) {
            // self protect and shutdown
        }
    });
}
configure();

This other example

Describes how you could do a live update for the configuration into a running instance

You did set the matching string via the relevant “setting of a version” field in the relevant calls?

That would seem to be correct.

This tool might help you poke around on your configuration/setup and read/write the config service to see whats occuring or not: Releases · BarryCarlyon/twitch_extension_tools · GitHub