Store Configuration Data¶
Configuration stores long-lived, developer-defined JSON. Use state for frequently changing live data and configuration for settings that should survive sessions.
Configuration scopes¶
| Store | Scope | Read | Write |
|---|---|---|---|
| Extension configuration | Every installation of the extension | Any authorized role | Trusted backend or configured extension owner |
| Channel configuration | One broadcaster's channel | Any authorized role on that channel | Broadcaster for that channel |
Initialize MEDKit¶
Muxy.setup({ clientID: "your-extension-client-id" });
const medkit = new Muxy.SDK();
await medkit.loaded();
Read configuration¶
getConfig() returns both scopes. Use the scoped methods when you need only one object.
const config = await medkit.getConfig();
const extensionConfig = await medkit.getExtensionConfig();
const channelConfig = await medkit.getChannelConfig();
console.log({ config, extensionConfig, channelConfig });
Example combined response:
{
"extension": { "purchasesEnabled": true },
"channel": { "difficulty": "hard" }
}
Write configuration¶
await medkit.setExtensionConfig({
purchasesEnabled: true,
});
await medkit.setChannelConfig({
difficulty: "hard",
});
Each setter replaces that scope's complete configuration object. Use the generated JSON Patch endpoints for atomic partial updates.
Never expose an extension secret to make an extension-level write from browser code. Perform secret-authorized operations on a trusted backend using a production JWT.
For raw endpoints, required roles, and JSON Patch examples, see the configuration API.