Skip to content

Class: Appli ​

Execution of an app (game or tool installed on a Channel). Specialization of App that adds the services specific to apps: preferences, dynamic triggers, rewards, data storages and plugins.

Remarks ​

Available everywhere via k / kapp when the current execution is an app (which you can check with k.isApp()). Instantiated by the SDK; you never construct it yourself.

Example ​

ts
// Read a streamer preference and persist a value specific to the app
const color = k.preferences.get('color');
await k.dataStorageV2.set({lastColor: color});

Extends ​

Properties ​

ai ​

ts
ai: AiService;

The AI service: calls to artificial intelligence models (text generation, etc.). See AiService.

Inherited from ​

App.ai


Announce ​

ts
Announce: typeof AnnounceModel = AnnounceModel;

Reference to the AnnounceModel model class (shortcut k.Announce).

Inherited from ​

App.Announce


announces ​

ts
announces: AnnounceService;

The announces service: displaying visual announcements on the overlay. See AnnounceService.

Inherited from ​

App.announces


api ​

ts
api: ApiService;

The API service: authenticated HTTP calls to the Kappapps backend. See ApiService.

Inherited from ​

App.api


app_type ​

ts
app_type: AppType;

Inherited from ​

App.app_type


appHistorics ​

ts
appHistorics: LogsDataStorageService;

Deprecated ​

Use logsStorageV2.


appli ​

ts
appli: AppliAppliData;

Data of the app installed on the Channel (ChannelAppli instance).


apps ​

ts
apps: AppsService;

The apps service: launch another installed app (by slug) or a widget (by id) and await the data it returns when it finishes. Use runApp / runWidget, or the generic run(target). See AppsService.

Inherited from ​

App.apps


appUsersData ​

ts
appUsersData: UserDataStorageService;

Deprecated ​

Use userDataStorageV2.


arguments ​

ts
arguments: Record<string, any>;

Configuration arguments passed to the app/widget at launch (values entered by the streamer for this trigger). Arguments of type Player are automatically converted into User instances.

Inherited from ​

App.arguments


channel ​

ts
channel: ChannelService;

The channel service: information about the installed Twitch Channel (streamer, preferences, theme). See ChannelService.

Inherited from ​

App.channel


chat ​

ts
chat: ChatService;

The Twitch chat service: sending messages and announcements, listening to viewers' messages and commands. See ChatService.

Inherited from ​

App.chat


dashboard ​

ts
dashboard: DashboardService;

The dashboard service: integration with the streamer dashboard. See DashboardService.

Inherited from ​

App.dashboard


dataStorage ​

ts
dataStorage: DataStorageService;

Generic data storage service for the app (persistent key/value state). See DataStorageService.

Deprecated ​

Use dataStorageV2.


dataStorageV2 ​

ts
dataStorageV2: DataStorageV2Service;

Global JSON document with preserved object/array shapes.


discord ​

ts
discord: DiscordService;

The Discord service: sending messages/notifications to Discord. See DiscordService.

Inherited from ​

App.discord


dom ​

ts
dom: DomService;

The DOM service: manipulating the app's document (loading scripts, DOM helpers). See DomService.

Inherited from ​

App.dom


DOMPurify ​

ts
DOMPurify: DOMPurify;

Reference to the DOMPurify HTML sanitization library (shortcut k.DOMPurify).

Inherited from ​

App.DOMPurify


dynamicTriggers ​

ts
dynamicTriggers: DynamicTriggerService;

Service for dynamic triggers: register/react to triggers defined at runtime. See DynamicTriggerService.


emotes ​

ts
emotes: EmoteService;

The emotes service: fetching and rendering Twitch/third-party emotes. See EmoteService.

Inherited from ​

App.emotes


gameEngines ​

ts
gameEngines: GameEngineService;

The game engine service: Phaser integration for game-type apps. See GameEngineService.

Inherited from ​

App.gameEngines


globals ​

ts
globals: AppliGlobalsData;

App global variables, shared across executions.


ImageAtlas ​

ts
ImageAtlas: typeof KappappsImageAtlas = KappappsImageAtlas;

Standalone-compatible image atlas loader (shortcut k.ImageAtlas). Use k.ImageAtlas.load(url) to load atlases generated by the DEV HUB.

Inherited from ​

App.ImageAtlas


infos ​

ts
infos: AppliInfosData;

App metadata (descriptive catalog info).


items ​

ts
items: ItemService;

The items service: rewards/objects purchasable with the Players' currency. See ItemService.

Inherited from ​

App.items


KAudio ​

ts
KAudio: typeof KAudio;

Reference to the KAudio audio media class (shortcut k.KAudio).

Inherited from ​

App.KAudio


KImage ​

ts
KImage: typeof KImage;

Reference to the KImage image media class (shortcut k.KImage).

Inherited from ​

App.KImage


KMedia ​

ts
KMedia: typeof KMedia;

Reference to the KMedia generic media class (shortcut k.KMedia).

Inherited from ​

App.KMedia


KVideo ​

ts
KVideo: typeof KVideo;

Reference to the KVideo video media class (shortcut k.KVideo).

Inherited from ​

App.KVideo


localFiles ​

ts
localFiles: LocalFilesService;

Read files and directory indexes from the streamer's local HUB folder.

Inherited from ​

App.localFiles


logsStorage ​

ts
logsStorage: LogsDataStorageService;

Service for logs/history storage of the app. See LogsDataStorageService.

Deprecated ​

Use logsStorageV2.


logsStorageV2 ​

ts
logsStorageV2: LogsStorageV2Service;

JSON history entries with preserved object/array shapes.


medias ​

ts
medias: MediaService;

The medias service: playback of images, sounds and videos on the overlay. See MediaService.

Inherited from ​

App.medias


name ​

ts
name: string;

Name of the app/widget currently running.

Inherited from ​

App.name


overlay ​

ts
overlay: OverlayService;

The overlay service: controls the display (position, dimensions, OBS scenes) and communication with the display layer. See OverlayService.

Inherited from ​

App.overlay


plugin ​

ts
plugin: PluginService;

Service for plugins: extensions hooked into the app. See PluginService.


poll ​

ts
poll: PollService;

The Kappapps polls service: platform-independent polls with chat and in-app voting. See PollService.

Inherited from ​

App.poll


PQueue ​

ts
PQueue: typeof default;

Reference to the PQueue queue class (shortcut k.PQueue).

Inherited from ​

App.PQueue


prediction ​

ts
prediction: PredictionService;

The Kappapps predictions service: viewers bet the channel currency on an outcome, winners share the pot. See PredictionService.

Inherited from ​

App.prediction


preferences ​

ts
preferences: PreferenceService;

Service for the app's preferences: values configured by the streamer for this installation. See PreferenceService.


rcon ​

ts
rcon: RconService;

The RCON service: remote control of a game server via the RCON protocol. See RconService.

Inherited from ​

App.rcon


rewards ​

ts
rewards: RewardService;

Service for rewards: granting winnings/currency to Players, sent at the end of execution. See RewardService.


services ​

ts
services: AppServiceService;

The app services API: implement named functions and call services exposed by running apps or widgets on the same Channel. See AppServiceService.

Inherited from ​

App.services


statuses ​

ts
statuses: StatusService;

The stream statuses service: runtime state shared between apps during a live. See StatusService.

Inherited from ​

App.statuses


stream ​

ts
stream: StreamService;

The current stream service: identifier and start time of the live. See StreamService.

Inherited from ​

App.stream


streamlabs ​

ts
streamlabs: StreamlabsService;

The Streamlabs service: integration with Streamlabs events. See StreamlabsService.

Inherited from ​

App.streamlabs


teams ​

ts
teams: TeamsService;

The channel's Kappapps teams and their members. See TeamsService.

Inherited from ​

App.teams


textset ​

ts
textset: Textset;

Set of texts / translations specific to the app (filled when the textset loads). See Textset.


textToSpeech ​

ts
textToSpeech: TextToSpeechService;

The text-to-speech service: have a text read aloud. See TextToSpeechService.

Inherited from ​

App.textToSpeech


triggerRequest ​

ts
triggerRequest: TriggerRequest;

The trigger request that started this execution: who (the setter) and which event launched the app/widget.

Inherited from ​

App.triggerRequest


triggers ​

ts
triggers: TriggerPreferenceService;

Persistent callbacks configured through trigger preferences.


twitch ​

ts
twitch: TwitchService;

The Twitch service: stream information (title, category…) and Twitch interactions. See TwitchService.

Inherited from ​

App.twitch


User ​

ts
User: typeof User;

Reference to the User model class (shortcut k.User).

Inherited from ​

App.User


userDataStorage ​

ts
userDataStorage: UserDataStorageService;

Service for per-user data storage: persists state specific to each viewer. See UserDataStorageService.

Deprecated ​

Use userDataStorageV2; read through userDataStorageV2.get(userId).


userDataStorageV2 ​

ts
userDataStorageV2: UserDataStorageV2Service;

Per-viewer JSON objects with explicit, fresh reads.


users ​

ts
users: UserService;

The viewers / Players service: fetching and managing the channel's users (currency, ranking, inventory). See UserService.

Inherited from ​

App.users


Utils ​

ts
Utils: typeof Utils;

Reference to the Utils utility collection (shortcut k.Utils).

Inherited from ​

App.Utils


uuid ​

ts
uuid: string;

Unique identifier of this app/widget execution.

Inherited from ​

App.uuid


variables ​

ts
variables: AppVariablesService;

Read channel variables selected by the streamer; use dataStorageV2 for app-owned data.


version ​

ts
version: AppliVersionData;

Data of the app version currently running.


youtube ​

ts
youtube: YoutubeService;

The YouTube service: playback/embedding of YouTube content. See YoutubeService.

Inherited from ​

App.youtube

Methods ​

_setGlobalVariables() ​

ts
protected _setGlobalVariables(): void;

Returns ​

void

Overrides ​

App._setGlobalVariables


abort() ​

ts
abort(reason?): Promise<void>;

Interrupts the app/widget execution (abnormal or forced end): runs the exit hooks registered for an abort, then signals the abort to the overlay.

Parameters ​

reason? ​

string = null

Reason for the interruption, forwarded to the overlay (for logging/diagnostic purposes).

Returns ​

Promise<void>

A promise resolved once all asynchronous onBeforeAbort / onBeforeExit hooks have completed.

Default Value ​

null

Remarks ​

Unlike finish, abort does not explicitly hide the display before notifying the end. Reserve it for error cases or manual stops.

Example ​

ts
try {
    await playTheGame();
    k.finish();
} catch (err) {
    k.abort(String(err));
}

See ​

Inherited from ​

App.abort


display() ​

ts
display(): void;

Displays the app/widget on the overlay (makes its display window visible).

Returns ​

void

Example ​

ts
k.display();

See ​

undisplay to hide it.

Inherited from ​

App.display


finish() ​

ts
finish(result?): Promise<void>;

Finishes the app by first sending the accumulated rewards (RewardService.sendRewards), then delegating to the standard App.finish.

Parameters ​

result? ​

any = undefined

Optional data returned to the app that launched this one via AppsService.run | `k.apps.run`. Can be any JSON-serializable value.

Returns ​

Promise<void>

A promise that resolves once the rewards have been sent and the finish handled.

Example ​

ts
k.rewards.winner(winner);
await k.finish(); // the accumulated rewards are sent before closing

// Return data to the caller (when launched via k.apps.run)
await k.finish({ winner: winner.id });

See ​

App.finish

Overrides ​

App.finish


isApp() ​

ts
isApp(): boolean;

Indicates whether this execution is an app (as opposed to a widget).

Returns ​

boolean

true if it is an app.

See ​

isWidget

Inherited from ​

App.isApp


isWidget() ​

ts
isWidget(): boolean;

Indicates whether this execution is a widget (as opposed to an app).

Returns ​

boolean

true if it is a widget.

See ​

isApp

Inherited from ​

App.isWidget


onBeforeAbort() ​

ts
onBeforeAbort(handler): void;

Registers a hook run only on an abort (abort).

Parameters ​

handler ​

BeforeExitHandler

Cleanup function (synchronous or asynchronous) to run before the abort.

Returns ​

void

See ​

Inherited from ​

App.onBeforeAbort


onBeforeExit() ​

ts
onBeforeExit(status?, handler): void;

Registers an exit hook called just before the execution ends, triggered according to the exit type (normal finish, abort, or both).

Parameters ​

status? ​

BeforeExitStatus = App.BEFORE_EXIT_STATUS_ALL

Exit type that triggers the hook: 'finish' (normal finish), 'abort' (interruption) or '*' (both).

handler ​

BeforeExitHandler

Cleanup function to run. Can be synchronous or asynchronous; asynchronous handlers are awaited before the exit completes.

Returns ​

void

Default Value ​

'*'

Remarks ​

To target a single exit type, prefer the shortcuts onBeforeFinish and onBeforeAbort.

Example ​

ts
// Save some state before any exit (finish or abort)
k.onBeforeExit('*', async () => {
    await k.dataStorage.set('lastRun', Date.now());
});

Inherited from ​

App.onBeforeExit


onBeforeFinish() ​

ts
onBeforeFinish(handler): void;

Registers a hook run only on a normal finish (finish).

Parameters ​

handler ​

BeforeExitHandler

Cleanup function (synchronous or asynchronous) to run before the finish.

Returns ​

void

See ​

Inherited from ​

App.onBeforeFinish


undisplay() ​

ts
undisplay(): void;

Hides the app/widget on the overlay (makes its display window invisible) without ending the execution.

Returns ​

void

Remarks ​

Called automatically by finish before closing the execution.

See ​

display to show it again.

Inherited from ​

App.undisplay