Appearance
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
Announce
ts
Announce: typeof AnnounceModel = AnnounceModel;Reference to the AnnounceModel model class (shortcut k.Announce).
Inherited from
announces
ts
announces: AnnounceService;The announces service: displaying visual announcements on the overlay. See AnnounceService.
Inherited from
api
ts
api: ApiService;The API service: authenticated HTTP calls to the Kappapps backend. See ApiService.
Inherited from
app_type
ts
app_type: AppType;Inherited from
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
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
channel
ts
channel: ChannelService;The channel service: information about the installed Twitch Channel (streamer, preferences, theme). See ChannelService.
Inherited from
chat
ts
chat: ChatService;The Twitch chat service: sending messages and announcements, listening to viewers' messages and commands. See ChatService.
Inherited from
dashboard
ts
dashboard: DashboardService;The dashboard service: integration with the streamer dashboard. See DashboardService.
Inherited from
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
dom
ts
dom: DomService;The DOM service: manipulating the app's document (loading scripts, DOM helpers). See DomService.
Inherited from
DOMPurify
ts
DOMPurify: DOMPurify;Reference to the DOMPurify HTML sanitization library (shortcut k.DOMPurify).
Inherited from
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
gameEngines
ts
gameEngines: GameEngineService;The game engine service: Phaser integration for game-type apps. See GameEngineService.
Inherited from
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
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
KAudio
ts
KAudio: typeof KAudio;Reference to the KAudio audio media class (shortcut k.KAudio).
Inherited from
KImage
ts
KImage: typeof KImage;Reference to the KImage image media class (shortcut k.KImage).
Inherited from
KMedia
ts
KMedia: typeof KMedia;Reference to the KMedia generic media class (shortcut k.KMedia).
Inherited from
KVideo
ts
KVideo: typeof KVideo;Reference to the KVideo video media class (shortcut k.KVideo).
Inherited from
localFiles
ts
localFiles: LocalFilesService;Read files and directory indexes from the streamer's local HUB folder.
Inherited from
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
name
ts
name: string;Name of the app/widget currently running.
Inherited from
overlay
ts
overlay: OverlayService;The overlay service: controls the display (position, dimensions, OBS scenes) and communication with the display layer. See OverlayService.
Inherited from
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
PQueue
ts
PQueue: typeof default;Reference to the PQueue queue class (shortcut k.PQueue).
Inherited from
prediction
ts
prediction: PredictionService;The Kappapps predictions service: viewers bet the channel currency on an outcome, winners share the pot. See PredictionService.
Inherited from
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
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
statuses
ts
statuses: StatusService;The stream statuses service: runtime state shared between apps during a live. See StatusService.
Inherited from
stream
ts
stream: StreamService;The current stream service: identifier and start time of the live. See StreamService.
Inherited from
streamlabs
ts
streamlabs: StreamlabsService;The Streamlabs service: integration with Streamlabs events. See StreamlabsService.
Inherited from
teams
ts
teams: TeamsService;The channel's Kappapps teams and their members. See TeamsService.
Inherited from
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
triggerRequest
ts
triggerRequest: TriggerRequest;The trigger request that started this execution: who (the setter) and which event launched the app/widget.
Inherited from
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
User
ts
User: typeof User;Reference to the User model class (shortcut k.User).
Inherited from
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
Utils
ts
Utils: typeof Utils;Reference to the Utils utility collection (shortcut k.Utils).
Inherited from
uuid
ts
uuid: string;Unique identifier of this app/widget execution.
Inherited from
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
Methods
_setGlobalVariables()
ts
protected _setGlobalVariables(): void;Returns
void
Overrides
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
- finish for a normal end.
- onBeforeAbort to hook up cleanup before the abort.
Inherited from
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
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
Overrides
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
Inherited from
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
Inherited from
onBeforeAbort()
ts
onBeforeAbort(handler): void;Registers a hook run only on an abort (abort).
Parameters
handler
Cleanup function (synchronous or asynchronous) to run before the abort.
Returns
void
See
Inherited from
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
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
onBeforeFinish()
ts
onBeforeFinish(handler): void;Registers a hook run only on a normal finish (finish).
Parameters
handler
Cleanup function (synchronous or asynchronous) to run before the finish.
Returns
void
See
Inherited from
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.