Skip to content

Build your own widgets

Jlerts has a lot built in, but a custom widget can be anything a web page can be. In these two tutorials you'll build widgets the app's own editors can't make: a spooky chat box with chibi badges and messages that take turns left and right, and a slime goal that wobbles, fills with fizzing green goo and turns greener as it fills. Both are free to download, use and change.

You'll need Jlerts, a text editor (Notepad works; VS Code is nicer), and for drawing your own art, any drawing program: Inkscape (free) for SVG like these examples, or anything that saves PNG, GIF or WebP. Widgets can use any picture type a browser can show (videos and sounds too). No coding experience? Download the finished widgets and change the colours in the app; then read along to see how each part works.

🤖 Too complicated to make your own? Let an AI (ChatGPT, Claude…) make one for you: Make one with AI →

How custom widgets work

A custom widget is a folder with a small web page in it:

FileWhat it's for
index.htmlThe page. The app shows it on your overlay at the widget's size, see-through wherever you don't draw.
style.cssThe look: colours, shapes, fonts, animations.
script.jsWhat it does: reacts to chat and events, and draws.
fields.jsonIts settings. The app turns this list into a normal settings panel, so anyone can change colours and options without touching code.
widget.jsonIts name, size and type, e.g. { "name": "Spooky chat", "type": "chat", "width": 480, "height": 700 }. The type says which tab it goes in (see Alerts, widgets and chats).
art/…Pictures, sounds, fonts: anything else the page uses.

The page runs sealed off: it can't touch the app, your other widgets or your logins. It hears what happens through one script the app provides, /custom-api.js, which gives your code a widget object:

CodeWhat it does
widget.on("load", fn)The page is ready and its settings have arrived: a good place to start (read widget.store, draw).
widget.on("settings", fn)Your fields.json values, when the page starts and whenever they change in the app.
widget.on("chat", fn)Every chat message: user, login, text, color, badges, roles, fragments (text and emotes), and bot: true for bots on the streamer's Bots list (usually skip those) and firstTime: true for someone's first message ever.
vars.avatarEvents about someone carry their profile picture's address: their Twitch or Kick picture, or a round first-letter picture when there's none. Use it as an <img>'s src.
widget.users.picture("name")Anyone's picture address the same way ("kick:name" for Kick), for leaderboards and top lists
widget.on("event", fn)Every event: { kind, vars, amount, test }. Kinds include follow, sub, resub, giftsub, cheer, raid, donation, redeem. Or listen to one: widget.on("follow", fn). All the event kinds.
widget.on("play", fn)Custom alerts: the alert starts playing (once). fn(vars, { kind, durationMs, test, resumed, muted }) gets the event's variables (vars.user, vars.message, vars.amount…), which event it plays for, how long it shows, resumed: true when OBS reloaded the page and Jlerts put the alert back, and muted: true when this copy should play no sound of its own (the alert is on another overlay too, and that one is heard).
widget.done()Custom alerts: finished early (otherwise it ends after its length, and the next alert plays).
widget.store.get(key) / .set(key, value)Small things saved between streams (a count, a list of names). Saved safely by the app: reloading the overlay never loses them.
widget.settingsThe current settings, any time.
widget.mutedtrue when the widget is on more than one overlay and another copy is the one heard: check it before playing a sound of your own, so it isn't heard twice.
widget.points, widget.teamsLoyalty points and teams: see Points and teams.
widget.subathon, widget.supportersThe Subathon clock and your top supporters: see Subathon and top supporters.
widget.ttsSpeak with Jlerts' voices: see Talking widgets.
msg.firstTime, msg.firstThisStreamTheir first message ever in your channel (Twitch's own first-time flag; Jlerts' own list on Kick), and their first message this stream: greet them, or make their message stand out.
widget.on("effect", fn)A redeem effect started (your emotes over the overlay): { user, redeem, kind }, kind float, drift, pop, explosion, rain or stamp.
widget.on("chatflag", fn)Twitch flagged a message as someone's first a moment after it came: { id, firstTime }. Mark the message with that id.
widget.on("delete", fn)Chat messages taken away: { id } one message (a mod deleted it), { userId } all of someone's (timed out or banned), { all: true } chat was cleared. Remove them from your page too.
widget.goals, widget.on("goal", fn)The streamer's Jlerts goals: see Goals.
widget.vaultThe Vault, the jackpot pot: see The Vault.
widget.chat.say(text)Write in chat (when the streamer allows it): see Writing in chat.

Widgets made for StreamElements also get its onWidgetLoad and onEventReceived window events, in StreamElements' shape (detail.fieldData, detail.listener, detail.event), so many of them work with few changes.

All the event kinds

KindWhen
follow, sub, resub, giftsubA follow, a sub, a resub, gifted subs (vars.count)
cheer, bits_other, bitsbadgeBits, Bits spent another way, a new Bits badge
powerup_custom, modiversary, gifteddropsOne of your own Bits Power-ups (vars.powerup), a mod's anniversary (vars.duration), gifted Drops (vars.count)
watchstreakA viewer shared their Twitch watch streak in chat (vars.streamstreak: streams in a row)
raid, shoutoutA raid; a Twitch shoutout
donationA tip (Streamlabs, StreamElements, Ko-fi)
redeemA channel point redeem
hypetrain_start, hypetrain_level, hypetrain_endA hype train starts, goes up a level, ends
hypetrain_progressMore hype on the same level (its end time moved later). It only updates pages, never starts an alert.
Hype train valuesvars.level, progress, goal, percent, left, total, user (top contributor), top_bits_user, top_bits, top_sub_user, train_type (regular, golden kappa…), ends_at (when it ends), started_at (when it started; both in milliseconds, like Date.now()) and train_id (the same for the whole train).
adbreakAn ad break starts
powerup_gigantify, powerup_effect, powerup_celebrationBits power-ups (Gigantify and On-screen Celebration: emote, and emote_url its picture)
firstchat, newchatterSomeone's first message this stream; someone new to your chat
commandA chat command that plays an alert
gamble, slots, duel, shop, gamePoints games and the shop (Community Hub → Games & shop)
banned, timeout, unbannedSomeone was banned, timed out (vars.duration, e.g. "10 minutes") or unbanned, on Twitch or Kick: user, moderator, reason
newmod, modremoved, newvip, vipremoved, warnedMods and VIPs added or removed; a Twitch warning (reason)
shieldon, shieldoffTwitch Shield Mode switched on or off (moderator)
automod, suspiciousAutoMod held a message; a suspicious user (e.g. a likely ban evader) chatted: user, message, reason
chatmodeChat modes changed: modes ("emote-only, slow (30s)" or "normal"), and emote_mode, slow_mode… as "yes" / "no"
unbanrequestSomeone asked to be unbanned: user, message
topsupporterSomeone took the top gifter, cheerer or tipper spot this stream: user, what, amount, previous

Each comes with test: true when it's a test from the app, so you can tell.

What events carry

widget.on("follow", fn) gets the event's variables; widget.on("event", fn) gets them as ev.vars, next to ev.kind, ev.amount and ev.test. Not every event has every variable and their values are usually text, so always have a fallback: vars.user || "Someone" and Number(vars.amount) || 0.

GroupVariables
Whouser (their name as shown in chat), login (lowercase username), message (what they wrote), avatar (their profile picture, when known), platform (see Twitch and Kick)
How muchamount (the tip, bits, gift count…), amount_raw (a tip as a plain number), currency, bits, kicks (Kick), count (gifted subs), viewers (raid size), months, streak, tier, duration (months bought at once), total_gifts
Ko-fi and first chatsmembership and first ("yes" on a membership payment, and on someone's first one), new ("yes" on someone's first message ever)
Bits badgestier_text (the tier with commas, like 1,000)
Redeemsreward, cost, prompt
Chat commandscommand (like !hug), target (the first word after it, without the @)
Loyalty pointspoints (what this gave), points_name, points_total
Timetime, time12, date, time_left (ad breaks, hype trains)
Subathonsubathon_added (like 5 min; blank when none)
Goalsgoal_name, goal_current, goal_target, goal_left, goal_percent, goal_progress, goal_current_text, goal_target_text, goal_left_text

What chat messages carry

In msgWhat it is
user, loginTheir display name and lowercase login
textThe message as plain text
fragmentsThe message in pieces, for drawing emotes: [{ t, text, url }]. t is "text", "emote", "mention" or "cheer"; an emote's url is its picture (Twitch, Kick, 7TV, BetterTTV or FrankerFaceZ)
colorTheir name colour, or null
roles{ broadcaster, mod, vip, sub }, each true or false. Use this for "only mods can…": it works on Twitch and Kick
badgesTwitch badges, like ["subscriber/12", "moderator/1"]
platform"twitch" or "kick"
bitsBits in the message, or null
highlighted, gigantified, effectA highlighted message, and Bits power-ups on it
id, userIdThe message's id and the viewer's id
replyTo, replyTextWho it replies to and what they said, or empty
nickname, team, squad, pronouns, avatarWhen they're on and known: their nickname, team and squad badges ({ name, colour, icon, image }), pronouns and profile picture. Check they're there before using them

Keep it safe: viewers write these messages, so never put msg.text or a name into innerHTML. Use textContent, or build the message from fragments.

script.js: a message with its emotes, safely
widget.on("chat", (msg) => {
  const row = document.createElement("div");
  for (const f of msg.fragments) {
    if (f.t === "emote" && f.url) {
      const img = document.createElement("img");
      img.src = f.url;
      img.alt = f.text;
      row.append(img);
    } else row.append(f.text);
  }
  document.body.append(row);
});

Twitch and Kick

Jlerts sends your widget both platforms' chat and events, so most widgets work on Kick with no extra code. Where it matters:

  • Which platform: msg.platform on chat, vars.platform on events. It's "kick" on Kick. On anything else, treat it as Twitch.
  • Viewers are kept separate: a Kick viewer's login starts with kick:, so someone with the same name on both is two people, with their own points. Pass login as it is to widget.points.
  • Who's a mod: Kick messages have no Twitch badges, so use msg.roles.
  • KICKs are Kick's Bits: they arrive as a cheer, with vars.bits, vars.kicks and vars.amount all set. Check the platform if you want to show the word KICKs.
  • Twitch only: hype trains, ad breaks, Bits power-ups and Bits badges don't happen on Kick.
script.js: a goal that can count one platform
widget.on("event", (ev) => {
  if (ev.kind !== "follow") return;
  const from = ev.vars.platform === "kick" ? "Kick" : "Twitch";
  const wanted = widget.settings.countFrom; // "Both", "Twitch" or "Kick", from a select in fields.json
  if (wanted === "Both" || wanted === from || ev.test) addOne();
});

widget.json: every option

OptionWhat it does
"name"The name shown in the app
"type""widget" (the default), "alert" or "chat": see Alerts, widgets and chats
"width", "height"Its size in pixels on a 1920 × 1080 stream. Draw at this size: stretching it later can look blurry in OBS
"duration"Alerts only: how many seconds it shows, from 0.5 to 600
"speaks"true gives it a Voice section in its settings: see Talking widgets

Settings (fields.json)

fields.json is a list, and the app turns each item into a setting. Every item has a key (the name your code uses), a label (what people see), a type and a default (used until someone changes it). Your code reads the value as widget.settings.yourKey. Give everything a sensible default, so the widget works the moment it's imported.

TypeWhat people seeWhat your code gets
textA one-line boxText
textareaA big box, the full widthText, with line breaks
numberA number box. Add "min" and "max" to limit itA number
colour or colorA colour pickerA colour, like "#8b5cf6"
checkboxA tick boxtrue or false
selectA drop-down. Add "options": a list of wordsThe chosen word
fontThe font pickerThe font's name, for font-family
goalA drop-down of the streamer's Jlerts goals, and "None"The goal's id ("" = none): use it with widget.goals
previewA ▶ Play preview button for a sound in your folder. Add "file", and optionally "volumeKey"Nothing: it's only a button. How it works
fields.json: one of each
[
  { "key": "title", "label": "Title", "type": "text", "default": "Thanks for the support!" },
  { "key": "note", "label": "Long text", "type": "textarea", "default": "" },
  { "key": "max", "label": "Names to show", "type": "number", "default": 5, "min": 1, "max": 20 },
  { "key": "colour", "label": "Accent colour", "type": "colour", "default": "#8b5cf6" },
  { "key": "wave", "label": "Wave at chat", "type": "checkbox", "default": true },
  { "key": "style", "label": "Card style", "type": "select", "default": "Glass", "options": ["Glass", "Solid"] },
  { "key": "font", "label": "Font", "type": "font", "default": "Segoe UI" },
  { "key": "volume", "label": "Volume (%)", "type": "number", "default": 80, "min": 0, "max": 100 },
  { "key": "cheerPreview", "label": "Hear the cheer", "type": "preview", "file": "sounds/cheer.mp3", "volumeKey": "volume", "default": "" }
]

Listen for changes, so the widget updates as people adjust it:

script.js
function applySettings(s) {
  title.textContent = s.title;
  title.style.color = s.colour;
  title.style.fontFamily = `"${s.font}", sans-serif`;
}
widget.on("settings", applySettings); // when it starts, and on every change

Changed fields.json while you're building? Click Reload fields in the widget's settings.

Sounds

Put your sounds in the widget's folder (.mp3, .wav or .ogg) and play them from your script. In OBS, the sound comes through the browser source: tick Control audio via OBS on that source to give it its own volume slider. Add a volume setting, and always let people turn sounds off.

script.js: play a sound, at the volume setting
function play(file) {
  if (widget.settings.sounds === false) return;
  const a = new Audio(`sounds/${file}`);
  a.volume = (Number(widget.settings.volume) || 0) / 100;
  a.play().catch(() => {}); // a missing file just stays silent
}
widget.on("follow", () => play("cheer.mp3"));

Timing a sound with an animation? Create the Audio ahead of time with a.preload = "auto", so it's ready to start the moment you need it.

Letting people hear it first: a preview setting (above) adds a ▶ Play preview button to your widget's settings. It plays in the app only, so the stream never hears it, and it doesn't run your script. "file" is the sound's path inside your folder. "volumeKey" is the key of a number setting from 0 to 100 that sets how loud it plays; without one, it plays at full volume. If it can't play, the app asks them to save the widget and try again. Keep "default": "" on it.

New: the Play preview button needs Jlerts build 2026.11.04.0434 or newer. Older copies show an empty text box in its place, which does nothing.

What a widget can and can't do

Every custom widget runs sealed off, so anyone can safely try one. That means:

  • It can load its own files, emotes (from Twitch, Kick, 7TV, BetterTTV and FrankerFaceZ) and Google Fonts.
  • Anything else from the web is blocked, like pictures, sounds or scripts from other websites. The streamer can allow these by ticking Let it load pictures, sounds and scripts from any website in the widget's settings, then saving and refreshing it in OBS, but a downloaded widget can't tick that for them. So keep your files in your folder: that also means it works offline.
  • It can never send anything out: no fetch, XMLHttpRequest, WebSockets or beacons, even with that box ticked. Everything comes through the widget object, so a widget can't call Twitch or any other website.
  • No iframes, workers, forms, pop-ups, downloads or opening links.
  • Saving: localStorage and cookies aren't available. Use widget.store.
LimitWhat to know
widget.store64 KB in total, as JSON-friendly values. Anything bigger than that isn't saved. Read it from widget.on("load", …) or later: it's empty before that, and so is widget.settings
Asking the appAnything that returns a Promise fails with "The app didn't answer." if there's no reply in 10 seconds. Catch errors, except where this page says a call never throws
Program filesA folder or .zip with program files (.exe, .dll, .bat, .cmd, .ps1, Office macro files and the like) isn't imported. Widgets never need them
.zip sizeUp to 2,000 files and 300 MB unpacked
PermissionsWeb loading and the "Allow this widget to change points, the Subathon, try for the Vault or write in chat" ticks are never brought in by an import: the streamer has to tick them. If your widget needs one, say so in its README
Browser versionOBS's browser is based on Chrome 127, so newer browser features can work in your browser but fail in OBS. Test in OBS before sharing
SpeedIt runs on a streaming PC next to a game. Prefer CSS animations, use one requestAnimationFrame loop at most, and remove old elements

Points and teams

Widgets can use the Community Hub's loyalty points and teams: a fishing game, a team scoreboard, a "top 5" board. Each of these returns a Promise; if it can't (points are off, say), it fails with an error whose message says why, in plain words you can show.

In your scriptWhat it gives
await widget.points.info(){ enabled, name, icon, notEnough }: whether points are on, what the streamer calls them, and their reply when someone hasn't got enough ({user} {have} {need} {points_name}; empty = none). Use it when your widget checks points itself; when widget.points.take fails for that reason, the app already says it in chat.
await widget.points.get("name"){ user, points, rank, team }
await widget.points.top(10)[{ user, points }, …], the leaderboard
await widget.points.add("name", 50, "caught a fish")Gives points, with a reason for their history
await widget.points.take("name", 50, "fishing bait")Takes points (never below 0)
await widget.points.take("name", 50, "bet", 3500)The same, and its share goes into the Vault only after 3.5 seconds, so the Vault's amount can't give away a result before your animation shows it
widget.on("points", fn)Points changed (not routine earning): { user, change, total, reason }
await widget.teams.list(){ enabled, locked, teams: [{ name, colour, icon, image, score, members, points }] }; locked is "open", "locked" or "closed"
Chat messagesAlso carry msg.nickname and msg.team ({ name, colour, icon, image }) when those are on

Reading is always allowed. Changing points is up to the streamer: they tick Allow this widget to change points in the widget's settings, with a limit per viewer (500 to start with). Points can only be taken from someone who used the widget's command in the last minute (its Command setting; if that's empty, any !command), so a widget can't drain anyone. Every change shows in the viewer's history with the widget's name, and the streamer can undo them all at once.

A game where viewers take from each other (!mug @Ann) needs one more tick from the streamer: Also allow it to take points from viewers named in its command. Then widget.points.take also works on someone named in the command (the first three words after it) within a minute, never on the person who typed it, and the per-viewer limit still applies.

Viewer values (chat games and RPGs)

Each viewer can have their own named values, kept between streams: hp, xp, level, class, gold… for a pet game, a fishing log or a full role-playing game. They're shared with the streamer's custom commands ("Also change their values", and {stat:hp} in replies), so a simple !stats command and your widget see the same numbers. Names are letters, numbers and _ (up to 24); values are a number or text (up to 100 characters); at most 40 per viewer.

In your scriptWhat it does
await widget.values.get("name"){ login, values: { hp: 20, xp: 150, class: "Rogue" } } ({} if none)
await widget.values.top("xp", 10)[{ user, login, value }, …], highest first
await widget.values.set("name", { hp: 20, quest: null })Changes some (null takes one away); gives back all their values
await widget.values.add("name", "xp", 10)Adds to a number (a missing one counts as 0; negative takes away): { value }
await widget.values.clear("name")Takes all of that viewer's values away
widget.on("values", fn)Someone's values changed: { login, user, values }; or { all: true } when the streamer cleared everyone's

Reading is always allowed. Changing needs the streamer's tick: Allow this widget to change viewer values. Roll dice with Math.random in your own code.

script.js: !attack, a tiny role-playing fight
widget.on("chat", async (msg) => {
  if (msg.text.trim().toLowerCase() !== "!attack") return;
  const me = (await widget.values.get(msg.login)).values;
  if (!me.hp) await widget.values.set(msg.login, { hp: 20, xp: 0 });   // a new adventurer
  const roll = 1 + Math.floor(Math.random() * 20);                     // a d20
  if (roll >= 10) {
    const { value } = await widget.values.add(msg.login, "xp", 10);
    show(`${msg.user} rolled ${roll} and hit the goblin! XP: ${value}`);
  } else {
    const { value } = await widget.values.add(msg.login, "hp", -3);
    show(`${msg.user} rolled ${roll} and got hit. HP: ${value}`);
  }
});
script.js: a !fish game
widget.on("chat", async (msg) => {
  if (msg.text.trim().toLowerCase() !== "!fish") return;
  try {
    await widget.points.take(msg.login, 10, "fishing bait");
    const prize = Math.random() < 0.3 ? 50 : 0;
    if (prize) await widget.points.add(msg.login, prize, "caught a fish");
    show(prize ? `${msg.user} caught a fish! +${prize}` : `${msg.user} got nothing...`);
  } catch (err) {
    show(`No fishing: ${err.message}`);
  }
});

Goals

A goal widget (a bunny being stuffed, a tree being decorated) can show one of the streamer's Jlerts goals instead of counting by itself. The app does the counting: live events, events missed while it was shut (catch-up), the goal's resets and its reached alert. Every scene shows the same numbers, even after OBS was shut or a scene was hidden. Add a setting of type goal to fields.json; the streamer picks a goal there.

CodeWhat it does
await widget.goals.get(widget.settings.goal)The goal: { id, name, kind, current, target, left, percent, reached, enabled, currentText, targetText, leftText, progress } (the texts with units: "$10.50", "100 bits"), or null
await widget.goals.list()Every goal, the same shape
widget.twitchGoals.get()Your Twitch Goals running now (set on Twitch): [{ id, type, description, current, target, reached, startedAt }]. type: follower, subscription (sub points), subscription_count (subs), new_subscription, new_subscription_count, new_bit, new_cheerer.
widget.twitchGoals.pick(which)The goals for a "twitchgoal" setting in fields.json ("all", "newest" or a type): let the streamer pick, then show widget.twitchGoals.pick(widget.settings.goal).
widget.playSound("chat-bloop", 80)Plays one of Jlerts' own sounds by name, at a volume (0–100, default 80): the 30 little chat sounds (chat-bloop, chat-kalimba, chat-c64-arp…) or the alert sets (retro-follow, chime-sub…). It stays quiet by itself on a copy that isn't the one heard, so a sound never plays twice.
widget.playSound(widget.settings.ding)Plays a "sound" setting: whatever the streamer picked, at their volume (nothing if they picked No sound).
widget.sounds()Every sound, in groups: [{ group, sounds: [{ name, label }] }], e.g. "Chat: 8-bit bloops", "Chat: Gentle", "Alerts: Retro". Handy for your own list.
fields.json "sound"Gives the streamer a sound picker (a group, then a sound, or their own file, and a volume): { "key": "ding", "label": "Sound for each message", "type": "sound", "sounds": "chat" }. "sounds": "chat" shows only the chat sounds; leave it out for all of them. The value is { src, volume }.
widget.on("twitchgoal", fn)Your Twitch Goals changed (one started, moved on or ended): { goals }. A reached one stays a few seconds with reached: true.
widget.on("goal", fn)A goal changed: fn(goal). Check goal.id === widget.settings.goal.
await widget.goals.add(id, 5), .subtract(id, 5), .set(id, 20), .reset(id)Changes it, e.g. for a mod's !bunny add 5. Only a goal picked in this widget's own settings. Reaching the target plays the goal's alert.
fields.json and script.js: show a Jlerts goal, or count by yourself
{ "key": "goal", "label": "Show one of your Jlerts goals", "type": "goal", "default": "" }

let goal = null;
async function applySettings(s) {
  goal = s.goal ? await widget.goals.get(s.goal) : null;
  draw();
}
widget.on("settings", applySettings);
widget.on("goal", (g) => {
  if (g.id === widget.settings.goal) (goal = g), draw();
});
widget.on("event", (ev) => {
  if (widget.settings.goal) return; // the app counts it
  // ...count by yourself (widget.store), as before
});
function draw() {
  bar.style.width = (goal ? goal.percent : 0) + "%";
  label.textContent = goal ? goal.progress : "";
}

Subathon and top supporters

Widgets can show the Community Hub → Subathon clock in any look you like (a candle burning down, a rocket's fuel, a big digital clock), its challenge checklist and totals, and your top gifters, cheerers and tippers. The app keeps the clock (it never misses a sub, even with OBS closed); your widget only shows it.

In your scriptWhat it gives
await widget.subathon.get()The clock: { enabled, on, running, paused, ended, leftMs, runMs, addedMs, capMs, at, totals, topGifter, topCheerer, topTipper, challenges, boost, boostUntil, currency }
widget.subathon.timeLeft(clock)Milliseconds left right now (it counts down from at while running): call it as often as you redraw
widget.on("subathon", (clock, change) => …)Every change: the new clock, and what changed: { kind, user, amount, seconds, note } (e.g. a sub that added 300 seconds). Great for a "+5:00" pop.
await widget.songRequests.get()The song requests: { enabled, open, player, mode, mixSongs, requestBy, playing, line, played }. player is "pear" (YouTube Music) or "spotify". playing is the request playing now (or null while the streamer's own playlist plays), line what's waiting (line[0] is next), played Played this stream. Each song: { id, videoId, title, artist, seconds, user, platform, status, thumbnail }; videoId is a YouTube video's id (11 letters) or a Spotify track's (22); thumbnail works as an <img> src.
widget.on("songrequests", fn)The same, whenever anything changes: a request added, starting, skipped, removed or cleared.
await widget.songRequests.skip()
await widget.songRequests.remove(id)
Skip the song playing, or take a request out of the line. Only with Allow this widget to skip and remove song requests ticked in its settings.
await widget.hypetrain.get()The hype train going on now: { id, level, startedAt, expiresAt, test, vars }, or null. expiresAt moves later with each contribution; id and startedAt stay the same for the whole train.
clock.totals{ subs, gifts, bits, money, follows, raids, redeems } this subathon
clock.challenges[{ text, goal, target, progress, reached }]: the checklist, in order; goal is "subs", "bits", "money", "hours" or "manual"
clock.topGifter (and topCheerer, topTipper){ user, amount }, or null
await widget.subathon.add(300, "won the raffle")Adds (or, below 0, takes) time in seconds, up to an hour at a time
await widget.subathon.pause() / .resume()Pauses or resumes the clock
await widget.supporters.top("gifts", "stream", 5)[{ user, amount }, …], biggest first. Measures: "gifts", "bits", "tips", "all". Time: "stream", "today", "week", "month", "all".
await widget.credits.get()Everyone who supported this stream, for your own ending credits: { raiders, subscribers, gifts, bits, tips, followers, redeems, chatters, rolling }. Each list is [{ user, amount, text }], biggest first. amount is viewers, months, gifts, bits, money or messages (0 for followers and redeems); text is only for tips ("£12.50"). Starts fresh when you go live; tests don't count.
widget.on("credits", fn)Someone was added, or the built-in End credits started or stopped (rolling): fn(credits), the same shape.

Reading is always allowed. Changing the clock is up to the streamer: they tick Allow this widget to change the Subathon in the widget's settings. Every change shows in the Subathon's history with the widget's name, and can be undone there. When the Subathon is off, enabled is false; when none is running, on is false. The topsupporter event also reaches widgets when someone takes the top spot this stream.

script.js: a subathon clock with a "+5:00" pop
const time = document.getElementById("time");
const pop = document.getElementById("pop");
let clock = null;

const two = (n) => String(n).padStart(2, "0");
function draw() {
  const left = Math.ceil(widget.subathon.timeLeft(clock) / 1000);
  time.textContent = clock && clock.on
    ? `${Math.floor(left / 3600)}:${two(Math.floor(left / 60) % 60)}:${two(left % 60)}`
    : "No subathon";
  time.classList.toggle("paused", !!(clock && clock.paused));
  requestAnimationFrame(draw);
}

widget.on("load", async () => {
  clock = await widget.subathon.get();
  draw();
});

widget.on("subathon", (next, change) => {
  clock = next;
  if (change && change.seconds > 0) {
    const m = Math.floor(change.seconds / 60), s = Math.round(change.seconds % 60);
    pop.textContent = `+${m}:${two(s)}${change.user ? " " + change.user : ""}`;
    pop.classList.remove("show");
    void pop.offsetWidth; // restarts the animation
    pop.classList.add("show");
  }
});

The Vault (jackpot)

The Vault (Community Hub → Games & shop) is a pot of points that a share of every loss goes into, and the jackpot of games, built to be extremely hard to win. A game widget can show it and try for it, but Jlerts rolls the dice, never the widget, with the streamer's odds (1 in 50,000 to start with).

In your scriptWhat it does
await widget.vault.get(){ enabled, amount, locked, canWin, odds, minBet, minVault, lastWin }; lastWin is { user, amount, game, at } or null
widget.on("vault", (vault) => …)It changed: it grew, was won, or was changed by hand. Great for a "VAULT 48,250" sign.
widget.on("heist", (h) => …)A heist (Heist the Vault) just ran: { user, guess, right, won, amount, line }. guess is the four numbers they typed (or null for a lucky break), right how many were right in a row, line the fail line. The real combination is never sent.
await widget.vault.tryWin("ann_birch", "Ann_Birch")A try for it: { won: true, amount } (the app has already paid them) or { won: false }
await widget.vault.tryWin("ann_birch", "Ann_Birch", 3500)The same, and the win's chat line and alert wait 3.5 seconds (up to 60), for example until your reels land

So nobody can make a widget that cheats, the app only allows a try when:

  • the streamer ticked Allow this widget to try for the Vault (never brought in by an import);
  • the viewer has just typed the widget's command in chat (a widget can't make that up);
  • it's the first try in that play: one try per play;
  • the widget really took a bet from them in that play with widget.points.take, at least the Vault's smallest bet. The bet that counts is what was taken (less anything given back), never what the widget says;
  • that viewer hasn't tried in the last 10 seconds (in any game);
  • the Vault is on, not locked, holds enough, and (if the streamer chose) hasn't been won this stream.

Points your widget takes also feed the Vault (if the streamer allows it). Every win is in the Vault's history with your widget's name, and the streamer can undo it.

script.js: take the bet, then try for the Vault
widget.on("chat", async (msg) => {
  if (!msg.text.startsWith("!spin ")) return;
  const bet = Number(msg.text.split(" ")[1]) || 0;
  await widget.points.take(msg.login, bet, "spin");          // the real bet first
  const jackpot = await widget.vault.tryWin(msg.login, msg.user);
  if (jackpot.won) showJackpot(msg.user, jackpot.amount);   // already paid by the app
  else playNormalGame(msg.user, bet);
});

Writing in chat

A custom widget can write in the streamer's chat, from their account: a game's result, a winner, a reply to a command. It's off until the streamer ticks Allow this widget to write in chat in the widget's settings (it needs the latest Jlerts; older copies answer "unknown request").

In your scriptWhat it does
await widget.chat.say("@Ann won 450 points!")Sends it, and gives { sent: true }, or { sent: false, reason } when it can't. It never throws.

So nobody's account can be misused, the app checks every message:

  • One message every 2 seconds and 20 a minute per widget (reason "too fast…" / "too many…"). Space your messages out, or keep a little list and send one every 2 seconds.
  • 300 characters at most, on one line ("too long…").
  • Never the streamer's blocked words ("blocked word").
  • Nothing starting with /, . or !: no Twitch commands, and no setting off a chat command ("it can't start with / . or !…"). Start with @name to reply to someone.
  • Nothing while Shield Mode is on ("Shield Mode is on"), and nothing unless allowed ("not allowed…").
  • The same message again within 2 seconds is sent once, so two copies of the overlay don't post twice.
script.js: answer !hello
widget.on("chat", async (msg) => {
  if (msg.text.trim().toLowerCase() !== "!hello") return;
  const r = await widget.chat.say(`@${msg.user} hello there!`);
  if (!r.sent) console.warn("Couldn't say hello:", r.reason);
});

Alerts, widgets and chats

The same kind of folder can be one of three things. Put "type" in its widget.json so the app knows which:

TypeWhere it goesHow it works
"alert"Alerts tabPlays when an event happens, like any alert: it waits its turn, has When it plays rules, and shows for its length ("duration" in seconds, in widget.json). Your page gets widget.on("play", vars => …) each time. You can still add sounds and Read aloud on top in the alert builder.
"widget"Widgets tabStays on screen and changes live: goals, lists, counters. No type means a widget.
"chat"Chat tabA chat overlay: widget.on("chat", fn) gets every message.

New: custom alerts and chats need Jlerts build 2026.10.21 or newer (the app updates itself; older copies import everything as a widget).

A custom alert's widget.json and the part of script.js that plays it:

widget.json
{
  "name": "My custom alert",
  "type": "alert",
  "width": 800,
  "height": 300,
  "duration": 6
}
script.js
widget.on("play", (vars, alert) => {
  document.getElementById("name").textContent = vars.user || "Someone";
  document.getElementById("message").textContent = vars.message || "";
  card.className = "card show";
  // Leave half a second before the end.
  setTimeout(() => (card.className = "card hide"), alert.durationMs - 500);
});

How a custom alert starts, updates and ends

  • A zip can't pick its own trigger. After importing it, link it to an event in the alert's When it plays (or the Triggers tab).
  • play fires once, when it starts. While it's on screen your page keeps hearing every event, so update it from those (widget.on("hypetrain_level", …)): play doesn't fire again.
  • It ends after its "duration", or sooner when your page calls widget.done().
  • Last until it ends (a tick in the alert's length settings, for hype trains and ad breaks): it stays on screen until the train or the ads end. Every newer end time keeps it up longer, and hypetrain_end finishes it, with 5 seconds for an outro (call widget.done() when yours is over).
  • If OBS reloads the page during a hype train, Jlerts puts the alert back: play fires with resumed: true and the latest values, without the sound again.

A hype train alert that stays up for the whole train: link it to Hype train started only, tick Last until it ends, and update it from the page:

script.js
widget.on("play", (vars, alert) => {
  draw(vars);
  if (!alert.resumed) train.classList.add("arrive"); // the entrance only the first time
});
widget.on("hypetrain_level", (v) => { draw(v); train.classList.add("level-up"); });
widget.on("hypetrain_progress", draw); // same level, more time (vars.ends_at)
widget.on("hypetrain_end", (v) => {
  draw(v);
  train.classList.add("leave");
  setTimeout(() => widget.done(), 1500); // after the outro
});

Test run: a custom alert's settings have a Test run button: for a hype train it sends a whole train (start, level-ups, more time, the end), and Reload halfway refreshes the overlay partway through to check it comes back. Custom widgets get one that sends a mix of events. Needs the next Jlerts update.

Talking widgets

A widget can talk with Jlerts' own read-aloud voices: a stream pet greeting followers, a mascot reacting to chat. Add "speaks": true to its widget.json; Jlerts then gives the widget a Voice section in its settings, where the streamer ticks Allow this widget to speak and picks one of the voices installed on their PC (or "Same as read aloud"), its speed and volume. Your page never needs to know voice names.

widget.json
{ "name": "Stream pet", "width": 400, "height": 400, "speaks": true }
In your scriptWhat it does
await widget.tts.speak("Hello!")Reads it aloud in the widget's voice and finishes once it's been read: { spoken: true, voice }, or { spoken: false, reason } ("not allowed", "off", "empty", "too long", "too many", "blocked word", "stopped", "skipped", "failed"). It never throws.
widget.tts.speak(text, { voice, speed, volume })Optional per line: a voice name from voices(), speed −10 to 10 (0 = normal), volume 0 to 1.
widget.tts.stop()Stops this widget's own lines (waiting and playing), never alerts or chat.
widget.tts.isSpeaking()True while one of its lines is being read.
await widget.tts.voices()The voices on this PC: [{ name, label, engine, language, gender }].
widget.on("tts", e => …)A line started, ended or was skipped: e.type, e.text, e.voice, e.reason.
widget.on("speech", s => …)About 30 times a second while its own line plays: s.talking, s.level (0–1, how loud), s.beats (one per syllable), s.progress. Great for a mouth.

Jlerts keeps it safe: lines take turns with read aloud (never over alerts or chat), go through the word filter, and are limited to 300 characters, 6 a minute and 5 waiting per widget. Skip TTS skips one; Shield Mode and Chat TTS off silence it.

script.js
widget.on("follow", async (vars) => {
  const r = await widget.tts.speak(`Yay! Thanks for the follow, ${vars.user}!`);
  if (!r.spoken) console.log("Didn't speak:", r.reason);
});

// The mouth opens with the voice.
widget.on("speech", (s) => {
  mouth.style.height = `${4 + (s.talking ? s.level * 18 : 0)}%`;
});

New: talking widgets need Jlerts build 2026.10.28 or newer.

Make one with AI

Can't code? Ask an AI assistant (ChatGPT, Claude, Gemini, Copilot…) to make one. We wrote a guide just for AI with everything it needs to know about Jlerts widgets. Pick what you're making, describe it, copy the message, and paste it into the AI:

What are you making?
Try one:
  1. Paste the message into the AI and send it. It gives you the files (widget.json, index.html, style.css, script.js, fields.json).
  2. Save each one into a new folder with exactly those names (in Notepad: Save as, "All files").
  3. Check widget.json: "type" should be "alert" for an alert, "chat" for a chat overlay or "widget" for anything that stays on screen. It decides which tab it goes in.
  4. Zip the folder (right-click → Send to → Compressed (zipped) folder) and import the zip in Jlerts.
  5. Something not right? Tell the AI what's wrong (a screenshot helps) and ask it to fix it.

AI-made widgets are safe to try: like every custom widget, they run sealed off and can't reach your logins, files or the internet. But AI makes mistakes, so expect to ask for a fix or two. If the AI can't open links, press Copy the guide for AI and paste that in first (or open the guide and copy it).

Add one to the app

The quick way: import the .zip as it is, no unzipping. It goes to the tab its widget.json type says, wherever you import it from, and a note tells you where it went:

  • Alerts → the ▾ next to + New alert → Import (.zip)…
  • Widgets → + New widget → Import a widget (.zip)…
  • Chat → + New chat overlay → Import a chat (.zip)…
  • or Settings → Import / Export → Import from .zip…

From a folder (handy while you're building one):

  1. Keep the folder somewhere it can stay (for example Documents\Jlerts widgets\).
  2. Make a custom one in its tab: Alerts → ▾ → Custom alert (HTML / CSS / JS), Widgets → + New widget → Custom widget (HTML / CSS / JS), or Chat → + New chat overlay → Custom chat (HTML / CSS / JS).
  3. In its settings, Choose folder… and pick the folder. Its own settings (from fields.json) appear underneath. (Starting from nothing? Make a starter alert / widget / chat writes a small working example into an empty folder.)
  4. Widgets and chats: Look sets the size; drag it onto your overlay. Alerts: press Play in the alert builder to see it, and set When it plays.

Changed a file? Refresh the overlay to see it: in OBS, right-click the overlay source → Refresh. Changed fields.json? Click Reload fields in the widget's settings too.

1. Spooky chat box

Chat as name plates over bubbles, taking turns left and right. Everyone gets a little skull or ghost by their name, and there are chibi badges for VIPs, tier 1, 2 and 3 subs, mods (a Frankenstein's monster) and you, plus cobwebs and ghosts drifting up behind the chat.

Try it Download the spooky chat (.zip) This is the real widget running, with pretend chat.

Step 1: Draw the badges

This example's art is SVG (PNG, JPG, GIF and WebP work too: just change the file names in the script): drawings described as shapes, so they stay sharp at any size and are tiny files. You can draw them in Inkscape (save as Plain SVG), but they're also just text you can read and change. Here's the skull every sub badge is built on:

skull.svg
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
  <!-- A chibi skull: a big round head, a small jaw, huge eyes. Thick outline so it reads at badge size. -->
  <path d="M32 5C18 5 8 14 8 27c0 7 3 12 8 15v8c0 3.3 2.7 6 6 6h20c3.3 0 6-2.7 6-6v-8c5-3 8-8 8-15C56 14 46 5 32 5z"
        fill="#f7f2ff" stroke="#2b1d3a" stroke-width="4" stroke-linejoin="round"/>
  <ellipse cx="22.5" cy="28" rx="6.5" ry="7.5" fill="#2b1d3a"/>
  <ellipse cx="41.5" cy="28" rx="6.5" ry="7.5" fill="#2b1d3a"/>
  <circle cx="20.5" cy="25.5" r="2.4" fill="#fff"/>
  <circle cx="39.5" cy="25.5" r="2.4" fill="#fff"/>
  <ellipse cx="15" cy="37" rx="4" ry="2.4" fill="#ff9fcf" opacity=".8"/>
  <ellipse cx="49" cy="37" rx="4" ry="2.4" fill="#ff9fcf" opacity=".8"/>
  <path d="M29.5 39.5l2.5-4 2.5 4z" fill="#2b1d3a" stroke="#2b1d3a" stroke-width="1.5" stroke-linejoin="round"/>
  <path d="M26 46v7M32 46v7M38 46v7" stroke="#2b1d3a" stroke-width="3" stroke-linecap="round"/>
</svg>
  • viewBox="0 0 64 64" is the drawing's own grid: 64 by 64 units, scaled to whatever size the badge is shown at.
  • The path is the head and jaw in one shape. C draws curves, v/h straight lines, z closes it.
  • Ellipses make the big chibi eyes; small white circles are the shine that makes them look alive.
  • One thick dark stroke round everything: at badge size a bold outline is what keeps it readable.

Each badge is that skull (or a ghost) plus an accessory: bat wings for tier 2, a crown for tier 3, a gem for VIPs, a top hat and microphone for you, and a number in a coloured circle so tiers are easy to tell apart. The mod badge is its own drawing:

mod.svg
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
  <!-- Mod: a chibi Frankenstein's monster. A soft square head, jagged hair, neck bolts and a stitched scar. -->
  <!-- Neck bolts (drawn first so the head sits over them) -->
  <rect x="3" y="40" width="10" height="8" rx="2" fill="#b9c2cf" stroke="#2b1d3a" stroke-width="3"/>
  <rect x="51" y="40" width="10" height="8" rx="2" fill="#b9c2cf" stroke="#2b1d3a" stroke-width="3"/>
  <!-- Head -->
  <rect x="10" y="10" width="44" height="48" rx="11" fill="#9fe39a" stroke="#2b1d3a" stroke-width="4"/>
  <!-- Hair: a flat top with a jagged fringe -->
  <path d="M10 22V19c0-5 4-9 9-9h26c5 0 9 4 9 9v3l-5 6-4-5-5 6-4-6-5 6-4-6-5 6-4-6-4 5z"
        fill="#2b1d3a" stroke="#2b1d3a" stroke-width="2" stroke-linejoin="round"/>
  <!-- Stitched scar across the forehead -->
  <path d="M36 31h12" stroke="#2b1d3a" stroke-width="2.2" stroke-linecap="round"/>
  <path d="M39 28.5v5M42.5 28.5v5M46 28.5v5" stroke="#2b1d3a" stroke-width="1.8" stroke-linecap="round"/>
  <!-- Sleepy eyes: big, with heavy lids -->
  <ellipse cx="23" cy="39" rx="5" ry="5.6" fill="#2b1d3a"/>
  <ellipse cx="41" cy="39" rx="5" ry="5.6" fill="#2b1d3a"/>
  <circle cx="21.6" cy="38" r="1.8" fill="#fff"/>
  <circle cx="39.6" cy="38" r="1.8" fill="#fff"/>
  <path d="M17.5 36h11M35.5 36h11" stroke="#9fe39a" stroke-width="3.2" stroke-linecap="round"/>
  <path d="M17.5 35.2h11M35.5 35.2h11" stroke="#2b1d3a" stroke-width="2" stroke-linecap="round"/>
  <!-- Blush and a little stitched smile -->
  <ellipse cx="16" cy="47" rx="3.4" ry="2" fill="#ff9fcf" opacity=".8"/>
  <ellipse cx="48" cy="47" rx="3.4" ry="2" fill="#ff9fcf" opacity=".8"/>
  <path d="M26 50q6 3 12 0" fill="none" stroke="#2b1d3a" stroke-width="2.6" stroke-linecap="round"/>
  <path d="M29 49v3M35 49v3" stroke="#2b1d3a" stroke-width="1.6" stroke-linecap="round"/>
</svg>

Tip: draw things in the order they stack. The neck bolts come first so the head covers their inner ends, and the scar and eyes go on top.

Step 2: Its settings (fields.json)

Every setting you want people to change without code goes in fields.json: a list, each with a key (the name your code uses), a label (what the app shows) and a type: text, number, colour, font, checkbox, select (with options) or textarea. The default is used until someone changes it.

fields.json
[
  { "key": "side", "label": "Messages sit on", "type": "select", "default": "Alternate sides", "options": ["Alternate sides", "Left", "Right"] },
  { "key": "max", "label": "Messages on screen", "type": "number", "default": 7, "min": 1, "max": 30 },
  { "key": "fadeAfter", "label": "Fade out after (seconds, 0 = never)", "type": "number", "default": 0, "min": 0, "max": 600 },
  { "key": "nameFont", "label": "Name font", "type": "font", "default": "Arial Black" },
  { "key": "font", "label": "Message font", "type": "font", "default": "Segoe UI" },
  { "key": "size", "label": "Text size", "type": "number", "default": 18, "min": 10, "max": 48 },
  { "key": "nameColours", "label": "Name colours", "type": "select", "default": "Their Twitch colour", "options": ["Their Twitch colour", "Theme colour"] },
  { "key": "themeName", "label": "Theme name colour", "type": "colour", "default": "#6b3fc4" },
  { "key": "plate", "label": "Name plate colour", "type": "colour", "default": "#efe6ff" },
  { "key": "bubble", "label": "Message bubble colour", "type": "colour", "default": "#ffffff" },
  { "key": "text", "label": "Message text colour", "type": "colour", "default": "#3b2a55" },
  { "key": "outline", "label": "Outline colour", "type": "colour", "default": "#2b1d3a" },
  { "key": "faces", "label": "A little skull or ghost by each name", "type": "checkbox", "default": true },
  { "key": "cobwebs", "label": "Cobwebs on the bubbles", "type": "checkbox", "default": true },
  { "key": "ghosts", "label": "Ghosts drift up behind the chat", "type": "checkbox", "default": true },
  { "key": "hideCommands", "label": "Hide !commands", "type": "checkbox", "default": true },
  { "key": "ignore", "label": "Never show (bots, comma separated)", "type": "text", "default": "nightbot, streamelements, streamlabs, moobot, fossabot" }
]

Step 3: The page

The page is almost empty: a box for the drifting ghosts and one for the chat. The script fills it in. Note the order at the bottom: /custom-api.js first (it makes widget), then your script.

index.html
<html>
  <head>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div id="ghosts"></div>
    <div id="chat"></div>
    <script src="/custom-api.js"></script>
    <script src="script.js"></script>
  </body>
</html>

Step 4: The look (style.css)

CSS variables carry the settings into the styles. The script sets --plate, --outline and the rest from fields.json, and every rule uses them, so changing a colour in the app changes the whole look:

style.css
:root {
  --plate: #efe6ff;
  --bubble: #ffffff;
  --text: #3b2a55;
  --outline: #2b1d3a;
  --size: 18px;
  --font: "Segoe UI", sans-serif;
  --name-font: "Arial Black", sans-serif;
}

The chat is a column that stacks from the bottom, so the newest message is always at the bottom and old ones get pushed up:

style.css
#chat {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: calc(var(--size) * 0.55);
  padding: 14px 16px 18px;
}

The name row sits a little over the bubble's top edge (a negative bottom margin) and above it (z-index), like a tag on a parcel. For messages on the right, row-reverse mirrors the row, so badges end up on the outside:

style.css
/* The name row: name plate, the little face, the badges. On the right it's mirrored (row-reverse). */
.head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  /* Overlaps the bubble's top edge a little, like a tag on a parcel. */
  margin-bottom: calc(var(--size) * -0.35);
  position: relative;
  z-index: 1;
}
.right .head {
  flex-direction: row-reverse;
}

The name plate: a pill shape (border-radius: 999px), the chunky outline, and a hard shadow straight down for a sticker look. Long names end in "…" instead of spilling out:

style.css
.plate {
  background: var(--plate);
  border: 3px solid var(--outline);
  border-radius: 999px;
  padding: 1px 16px 2px;
  font: 900 calc(var(--size) * 0.82) / 1.35 var(--name-font);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  /* A chunky "sticker" edge: a hard shadow straight down. */
  box-shadow: 0 3px 0 var(--outline);
  max-width: 70vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

The cobweb is a pseudo-element (::after): an extra box CSS adds to every bubble, so the script never has to. The bubble gets a little extra padding on that side so the web never covers words:

style.css
/* A cobweb in the top corner away from the name (switched off with the "Cobwebs" setting). The bubble gets a little
   more room on that side so the web never sits over the text. */
.cobwebs .bubble {
  padding-right: calc(var(--size) * 1.45);
}
.cobwebs .right .bubble {
  padding-right: calc(var(--size) * 0.95);
  padding-left: calc(var(--size) * 1.45);
}
.cobwebs .bubble::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: calc(var(--size) * 1.6);
  height: calc(var(--size) * 1.6);
  background: url("art/web.svg") no-repeat top right / contain;
  border-top-right-radius: 15px;
  pointer-events: none;
}

The pop-in is a keyframe animation. The cubic-bezier(0.2, 1.5, 0.4, 1) timing goes past 1, so the message overshoots its size and settles back: that's the bounce.

style.css
@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.55) translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

Step 5: The messages (script.js)

The settings' defaults are written into the script too (the same as fields.json). The widget draws straight away with them, and they cover any setting that's missing, so it never starts with everything switched off:

script.js
// The settings' defaults (the same as fields.json): used until the real settings arrive, and for any that are
// missing, so the widget never starts with everything switched off.
const DEFAULTS = {
  firstTag: false,
  side: "Alternate sides",
  max: 7,
  fadeAfter: 0,
  nameFont: "Arial Black",
  font: "Segoe UI",
  size: 18,
  nameColours: "Their Twitch colour",
  themeName: "#6b3fc4",
  plate: "#efe6ff",
  bubble: "#ffffff",
  text: "#3b2a55",
  outline: "#2b1d3a",
  faces: true,
  cobwebs: true,
  ghosts: true,
  hideCommands: true,
  ignore: "nightbot, streamelements, streamlabs, moobot, fossabot",
};
let s = { ...DEFAULTS }; // the settings (fields.json)

When the settings arrive (and whenever they change), they go on top of the defaults and become the CSS variables from Step 4:

script.js
function applySettings(settings) {
  s = { ...DEFAULTS, ...settings };
  const root = document.documentElement.style;
  root.setProperty("--plate", s.plate);
  root.setProperty("--bubble", s.bubble);
  root.setProperty("--text", s.text);
  root.setProperty("--outline", s.outline);
  root.setProperty("--size", `${Number(s.size) || 18}px`);
  root.setProperty("--font", `"${s.font}", "Segoe UI", sans-serif`);
  root.setProperty("--name-font", `"${s.nameFont}", "Arial Black", sans-serif`);
  document.body.classList.toggle("cobwebs", !!s.cobwebs);
  trim();
}
// When the settings arrive, and whenever you change them in the app.
widget.on("settings", applySettings);
// Draw it straight away (with the settings it already has, else the defaults); the real ones follow.
applySettings(widget.settings);

Badges. Twitch sends badges like "subscriber/3012": the set, then a version. For subs, the version says the tier: 3000 and up is tier 3, 2000 and up tier 2, anything else tier 1. Each badge is just an <img> pointing at one of your SVGs:

script.js
// Twitch badges look like "subscriber/3012": the set, then a version. For subs the version says the tier: 3000 and up
// is tier 3, 2000 and up tier 2, anything else tier 1 (the rest of the number is the months).
function badgesFor(msg) {
  const out = [];
  const sets = new Map((msg.badges || []).map((b) => b.split("/")));
  if (sets.has("broadcaster")) out.push(["broadcaster", "Broadcaster"]);
  if (sets.has("moderator") || msg.roles?.mod) out.push(["mod", "Mod"]);
  if (sets.has("vip") || msg.roles?.vip) out.push(["vip", "VIP"]);
  const sub = sets.get("subscriber") ?? sets.get("founder");
  if (sub !== undefined || msg.roles?.sub) {
    const v = Number(sub) || 0;
    const tier = v >= 3000 ? 3 : v >= 2000 ? 2 : 1;
    out.push([`tier${tier}`, `Tier ${tier} sub`]);
  }
  return out.map(([file, title]) => {
    const img = document.createElement("img");
    img.src = `art/${file}.svg`;
    img.alt = img.title = title;
    return img;
  });
}

The face by each name. To give each viewer the same face every time, it turns their name into a number and picks skull or ghost from that:

script.js
// The same viewer always gets the same face: a number made from their name picks skull or ghost.
function faceFor(login) {
  let h = 0;
  for (const ch of login) h = (h * 31 + ch.charCodeAt(0)) >>> 0;
  const img = document.createElement("img");
  img.className = "face";
  img.src = h % 2 ? "art/skull.svg" : "art/ghost.svg";
  img.alt = "";
  return img;
}

The text, with emotes. Messages arrive in pieces (fragments): text, and emotes with a picture. Always put viewers' text in with textContent or text nodes, never as HTML, so nobody can put their own code on your overlay:

script.js
// The message arrives in pieces ("fragments"): text, emotes (with a picture), @mentions. textContent keeps viewers'
// text as plain text, so nobody can put their own HTML into your overlay.
function textFor(msg) {
  const bubble = document.createElement("div");
  bubble.className = "bubble";
  const parts = msg.fragments?.length ? msg.fragments : [{ t: "text", text: msg.text }];
  for (const f of parts) {
    if (f.t === "emote" && f.url) {
      const img = document.createElement("img");
      img.className = "emote";
      img.src = f.url;
      img.alt = f.text;
      bubble.append(img);
    } else {
      bubble.append(document.createTextNode(f.text));
    }
  }
  return bubble;
}

Building a message. It skips bots and !commands, picks a side (taking turns, or always the same one), builds the name row and bubble, and adds it to the chat:

script.js
function show(msg) {
  const login = (msg.login || msg.user || "").toLowerCase();
  const ignore = String(s.ignore || "").toLowerCase().split(",").map((n) => n.trim()).filter(Boolean);
  if (ignore.includes(login)) return;
  if (s.hideCommands && (msg.text || "").trim().startsWith("!")) return;

  const side = s.side === "Left" ? "left" : s.side === "Right" ? "right" : count % 2 ? "right" : "left";
  count++;

  const el = document.createElement("div");
  el.className = `msg ${side}`;
  el.dataset.id = msg.id || "";

  const head = document.createElement("div");
  head.className = "head";
  const plate = document.createElement("span");
  plate.className = "plate";
  plate.textContent = msg.user;
  plate.style.color = s.nameColours === "Theme colour" || !msg.color ? s.themeName : msg.color;
  const badges = document.createElement("span");
  badges.className = "badges";
  badges.append(...badgesFor(msg));
  head.append(plate);
  if (s.faces) head.append(faceFor(login));
  head.append(badges);
  // Their first message ever in your channel (Twitch's own first-time flag; Jlerts' list on Kick).
  if (s.firstTag && msg.firstTime) head.append(newTag());

  el.append(head, textFor(msg));
  chat.append(el);
  trim();

  // Fade out after a while (0 = stay until pushed out).
  const after = Number(s.fadeAfter) || 0;
  if (after > 0) setTimeout(() => leave(el), after * 1000);
}

Leaving. Old messages don't just vanish: they get a leaving class (the fade-out animation) and are removed when it ends:

script.js
// Too many on screen: the oldest leave.
function trim() {
  const shown = [...chat.querySelectorAll(".msg:not(.leaving)")];
  const max = Math.max(1, Number(s.max) || 7);
  shown.slice(0, Math.max(0, shown.length - max)).forEach(leave);
}

function leave(el) {
  if (el.classList.contains("leaving")) return;
  el.classList.add("leaving");
  el.addEventListener("animationend", () => el.remove(), { once: true });
}

Ghosts in the background. Every few seconds a ghost image is added with a random size, place and speed. CSS floats it up, and it removes itself at the top:

script.js
function drift() {
  if (s.ghosts) {
    const g = document.createElement("img");
    g.className = "drift";
    g.src = "art/ghost.svg";
    const size = 26 + Math.random() * 30;
    g.style.width = `${size}px`;
    g.style.left = `${Math.random() * 90}%`;
    g.style.animationDuration = `${9 + Math.random() * 7}s`;
    g.addEventListener("animationend", () => g.remove());
    ghosts.append(g);
  }
  setTimeout(drift, 2500 + Math.random() * 3500);
}
drift();

Make it yours: draw your own badges (keep the file names, or change them in badgesFor), swap the faces for your mascot, change the bubble shape in .bubble, or add a badge for founders or artists the same way.

2. Slime goal

A goal for anything (follows, subs, bits, tips, raiders, channel points, or every event), shown as a chibi slime filling with goo. It wobbles, the goo's surface rolls, bubbles rise inside, fizz floats up off the surface and pops, and the slime gets greener as it fills. At 100% it closes its eyes happily. It saves its count between streams, and you and your mods can change it from chat.

Try it (a follower goal of 20) Download the slime goal (.zip) The real widget, with pretend follows. "Fill it" and "Reset" use its chat commands.

Step 1: Draw the slime

The slime is one SVG, right in index.html. The trick is that its outline is drawn once (id="body") and reused three times with <use>: as the jelly, as a clip (clipPath) that keeps the goo inside, and as the outline on top. Change that one path and the whole slime changes shape.

index.html
<svg id="slime" viewBox="0 0 400 420" aria-hidden="true">
  <defs>
    <!-- The slime's outline, used three times: its jelly, the clip that keeps the goo inside, and the outline. -->
    <path id="body" d="M200 22c6 36 52 64 96 108 50 50 68 106 56 168-10 54-62 92-152 92s-142-38-152-92C36 236 54 180 104 130c44-44 90-72 96-108z" />
    <clipPath id="inside"><use href="#body" /></clipPath>
    <!-- The goo: lighter at its surface, deeper below. script.js sets both colours. -->
    <linearGradient id="goo-colour" x1="0" y1="0" x2="0" y2="1">
      <stop id="goo-top" offset="0" stop-color="#9be86a" />
      <stop id="goo-deep" offset="1" stop-color="#139a3f" />
    </linearGradient>
    <!-- A soft glow around the slime, stronger as it fills. -->
    <filter id="glow" x="-30%" y="-30%" width="160%" height="160%">
      <feDropShadow id="glow-shadow" dx="0" dy="0" stdDeviation="10" flood-color="#2fe36a" flood-opacity="0" />
    </filter>
  </defs>

  <!-- Shadow on the floor (it squashes with the slime). -->
  <ellipse id="shadow" cx="200" cy="402" rx="140" ry="12" fill="#000" opacity=".22" />

  <!-- Everything that wobbles together. -->
  <g id="creature" filter="url(#glow)">
    <use id="jelly" href="#body" fill="#e9f4ec" />
    <g clip-path="url(#inside)">
      <path id="goo-back" fill="#0e8a37" opacity=".55" />
      <path id="goo" fill="url(#goo-colour)" />
      <path id="goo-shine" fill="none" stroke="#fff" stroke-width="5" stroke-linecap="round" opacity=".45" />
      <g id="bubbles"></g>
    </g>
    <use href="#body" fill="none" class="outline" stroke-width="9" stroke-linejoin="round" />
    <!-- A shine on the jelly, top left. -->
    <path d="M128 168c10-22 28-40 46-52" fill="none" stroke="#fff" stroke-width="12" stroke-linecap="round" opacity=".65" />
    <circle cx="116" cy="196" r="6" fill="#fff" opacity=".65" />
    <!-- The face -->
    <g id="face">
      <g id="eyes">
        <ellipse cx="158" cy="262" rx="17" ry="22" class="ink" />
        <ellipse cx="242" cy="262" rx="17" ry="22" class="ink" />
        <circle cx="151" cy="253" r="7" fill="#fff" />
        <circle cx="235" cy="253" r="7" fill="#fff" />
        <circle cx="163" cy="272" r="3.5" fill="#fff" />
        <circle cx="247" cy="272" r="3.5" fill="#fff" />
      </g>
      <g id="happy-eyes" visibility="hidden">
        <path d="M140 266q18-24 36 0M224 266q18-24 36 0" fill="none" class="ink-line" stroke-width="8" stroke-linecap="round" />
      </g>
      <ellipse cx="124" cy="296" rx="16" ry="8" fill="#ff8fb8" opacity=".7" />
      <ellipse cx="276" cy="296" rx="16" ry="8" fill="#ff8fb8" opacity=".7" />
      <path id="mouth" d="M186 292q14 14 28 0" fill="none" class="ink-line" stroke-width="7" stroke-linecap="round" />
    </g>
    <!-- Fizz: little bubbles that float up off the goo's surface and pop. Not clipped, so they can rise above it. -->
    <g id="fizz"></g>
  </g>
</svg>
  • The goo (#goo) is a path the script redraws every frame. Its colour is a gradient: lighter at the surface, deeper below.
  • #goo-back is a second, darker wave just behind it, so the surface looks deep.
  • The glow is an SVG filter (feDropShadow) whose strength the script raises as it fills.
  • The face sits on top of the goo. #happy-eyes is hidden until the goal's reached.
  • #bubbles and #fizz start empty: the script adds and removes circles in them.

Step 2: Its settings (fields.json)

A select chooses what fills it; the goal, starting point and both slime colours are settings too:

fields.json
[
  { "key": "title", "label": "Title", "type": "text", "default": "Slime goal" },
  { "key": "counts", "label": "What fills it", "type": "select", "default": "Followers", "options": ["Followers", "Subs (each gifted sub counts)", "Bits", "Tips", "Raiders", "Channel point redeems", "Everything (1 per event)"] },
  { "key": "target", "label": "Goal", "type": "number", "default": 50, "min": 1, "max": 1000000 },
  { "key": "start", "label": "Start from", "type": "number", "default": 0, "min": 0, "max": 1000000 },
  { "key": "countTests", "label": "Count Test events too (handy while setting up)", "type": "checkbox", "default": true },
  { "key": "commands", "label": "Chat commands for you and mods (!slime add 5, !slime set 20, !slime reset)", "type": "checkbox", "default": true },
  { "key": "emptyColour", "label": "Slime colour when nearly empty", "type": "colour", "default": "#c8f59a" },
  { "key": "fullColour", "label": "Slime colour when full", "type": "colour", "default": "#13c24f" },
  { "key": "seeThrough", "label": "See-through like a liquid until it's full", "type": "checkbox", "default": true },
  { "key": "outline", "label": "Outline colour", "type": "colour", "default": "#1d3a28" },
  { "key": "showText", "label": "Show the title and numbers", "type": "checkbox", "default": true },
  { "key": "font", "label": "Font", "type": "font", "default": "Arial Black" },
  { "key": "textColour", "label": "Text colour", "type": "colour", "default": "#ffffff" }
]

Step 3: Counting

The app tells every widget about every event; the widget decides what counts. A follow adds 1, a cheer adds its bits, a tip its amount, a raid its viewers. Test events (from the app's Test buttons) carry test: true, so the widget can leave them out once you're live:

script.js
// How much an event adds, by what the goal counts. The app sends each event's kind and its variables.
function amountFor(ev) {
  const v = ev.vars || {};
  const n = (x) => Number(String(x ?? "").replace(/[^0-9.]/g, "")) || 0;
  const amount = n(ev.amount) || n(v.amount);
  switch (s.counts) {
    case "Followers":
      return ev.kind === "follow" ? 1 : 0;
    case "Subs (each gifted sub counts)":
      if (ev.kind === "sub" || ev.kind === "resub") return 1;
      return ev.kind === "giftsub" ? n(v.count) || amount || 1 : 0;
    case "Bits":
      return ev.kind === "cheer" ? amount || n(v.bits) : 0;
    case "Tips":
      return ev.kind === "donation" ? amount : 0;
    case "Raiders":
      return ev.kind === "raid" ? n(v.viewers) || amount : 0;
    case "Channel point redeems":
      return ev.kind === "redeem" ? 1 : 0;
    default: // Everything (1 per event)
      return ["follow", "sub", "resub", "giftsub", "cheer", "raid", "donation", "redeem"].includes(ev.kind) ? 1 : 0;
  }
}
script.js
widget.on("event", (ev) => {
  if (ev.test && !s.countTests) return;
  const add = amountFor(ev);
  if (add > 0) setTotal(total() + add);
});

// Chat commands for you and your mods: !slime add 5, !slime set 20, !slime reset.
widget.on("chat", (msg) => {
  if (!s.commands) return;
  const allowed = msg.roles?.broadcaster || msg.roles?.mod || (msg.badges || []).some((b) => /^(broadcaster|moderator)\//.test(b));
  const m = /^!slime\s+(add|set|reset)\s*(-?[\d.]+)?/i.exec((msg.text || "").trim());
  if (!allowed || !m) return;
  const number = Number(m[2]) || 0;
  const verb = m[1].toLowerCase();
  if (verb === "add") setTotal(total() + number);
  else if (verb === "set") setTotal(number);
  else setTotal(Number(s.start) || 0);
});

The chat command only works for you and your mods: it checks roles and the badges before doing anything. Every change is saved with widget.store, so the count is still there next stream:

script.js
function setTotal(value) {
  const before = total();
  count = Math.max(0, value) - (Number(s.start) || 0);
  widget.store.set("count", count);
  if (total() > before) boing = 1; // a happy wobble when it goes up
  showNumbers(true);
}

Step 4: Making it move

Everything that moves is redrawn in one function, about 60 times a second, using requestAnimationFrame. Each frame it works out how full to draw it, easing towards the real value so the goo glides up instead of jumping:

script.js
function frame(now) {
  const dt = Math.min(0.05, (now - last) / 1000);
  last = now;
  const t = (now - t0) / 1000;
  const goal = Math.min(1, Math.max(0, total() / target()));
  shown += (goal - shown) * Math.min(1, dt * 2.5);
  boing = Math.max(0, boing - dt * 0.9);
  const p = shown;
  const level = BOTTOM - (BOTTOM - TOP) * p; // the goo's surface (SVG y: smaller is higher)

Greener as it fills: the goo's colour is mixed between the "nearly empty" and "full" colours by how full it is, the jelly takes on a green tint, and the glow gets stronger:

script.js
// Colours: the goo goes from pale to rich green, the jelly picks up a green tint, and it glows more as it fills.
const goo = mix(s.emptyColour || "#c8f59a", s.fullColour || "#13c24f", p);
$("goo-top").setAttribute("stop-color", mix(goo, "#ffffff", 0.25));
$("goo-deep").setAttribute("stop-color", mix(goo, "#063a18", 0.45));
$("goo-back").setAttribute("fill", mix(goo, "#063a18", 0.3));
$("jelly").setAttribute("fill", mix("#eef3f0", mix(s.fullColour || "#13c24f", "#ffffff", 0.7), p));
$("glow-shadow").setAttribute("flood-color", s.fullColour || "#13c24f");
$("glow-shadow").setAttribute("flood-opacity", (p * 0.6).toFixed(3));

Mixing two colours is just mixing their red, green and blue numbers:

script.js
// A colour as [red, green, blue], from "#13c24f" (the settings) or "rgb(19,194,79)" (one mix() made).
const rgb = (colour) => {
  const c = String(colour);
  if (c.startsWith("rgb")) return c.match(/\d+/g).slice(0, 3).map(Number);
  const n = parseInt(c.replace("#", "").slice(0, 6), 16) || 0;
  return [(n >> 16) & 255, (n >> 8) & 255, n & 255];
};
const mix = (a, b, t) => {
  const [x, y] = [rgb(a), rgb(b)];
  return `rgb(${x.map((v, i) => Math.round(v + (y[i] - v) * t)).join(",")})`;
};

The wobble: it squashes and stretches from the bottom (where it sits), wider when shorter, like jelly. A slow gentle wobble is always on; after the goal goes up, a fast boing is added that fades away. The floor shadow stretches with it.

script.js
// The wobble: a slow squash and stretch, from the bottom (where it sits), plus a bouncier one after a boing.
const squash = Math.sin(t * 3.1) * 0.018 + Math.sin(t * 15) * 0.07 * boing * boing;
const lean = Math.sin(t * 1.6) * 1.2;
$("creature").setAttribute("transform", `translate(${MID_X} ${BOTTOM}) rotate(${lean}) scale(${1 + squash} ${1 - squash}) translate(${-MID_X} ${-BOTTOM})`);
$("shadow").setAttribute("rx", (140 * (1 + squash * 1.6)).toFixed(1));

The rolling surface: two sine waves added together, moving at different speeds and directions, give a surface that rolls rather than slides. The path joins points along the wave, then goes down round the bottom; the clip keeps it inside the slime.

script.js
// The goo's surface: two waves added together, moving at different speeds, so it rolls rather than slides.
const amp = 5 + 9 * boing;
const wave = (x, phase) => level + Math.sin(x * 0.035 + t * 2.2 + phase) * amp + Math.sin(x * 0.071 - t * 1.4 + phase) * amp * 0.45;
const surface = (phase, lift) => {
  if (p <= 0.002) return "";
  let d = `M0 ${(wave(0, phase) - lift).toFixed(1)}`;
  for (let x = 10; x <= 400; x += 10) d += ` L${x} ${(wave(x, phase) - lift).toFixed(1)}`;
  return `${d} L400 420 L0 420 Z`;
};
$("goo-back").setAttribute("d", surface(1.7, 5));
$("goo").setAttribute("d", surface(0, 0));

Step 5: Bubbles and fizz

Both are tiny particle systems: a list of bubbles, each with a position and speed. Every frame, new ones may be born, every one moves, and finished ones are removed. To start fizz on the goo inside the slime wherever the surface is, the script first measures the slime's shape row by row with isPointInFill, so it works for any shape you draw:

script.js
// Where the slime is, row by row: the left and right edge of its body at each height. Measured once from the SVG
// path itself (isPointInFill), so the fizz always starts on the goo, inside the slime, whatever shape you draw.
const body = $("body");
// An SVGPoint (not new DOMPoint): OBS's browser (Chrome 127) only takes an SVGPoint here.
const point = body.ownerSVGElement.createSVGPoint();
const inside = (x, y) => {
  point.x = x;
  point.y = y;
  return body.isPointInFill(point);
};
const edges = [];
for (let y = 0; y <= 420; y += 2) {
  let left = null;
  let right = null;
  for (let x = 0; x <= 400; x += 2) {
    if (inside(x, y)) {
      if (left === null) left = x;
      right = x;
    }
  }
  edges[y / 2] = left === null ? null : [left, right];
}
const edgesAt = (y) => edges[Math.max(0, Math.min(210, Math.round(y / 2)))];

Each fizz bubble is born on the surface, floats up (fast, then slowing), wiggles, and then pops: for a fifth of a second it becomes a growing, fading ring with two specks flying off.

script.js
// Fizz: tiny bubbles born on the surface (inside the slime) that float up, wiggle, then pop into a ring.
const row = edgesAt(level);
if (p > 0.01 && row && row[1] - row[0] > 30 && Math.random() < dt * (3 + 9 * p)) {
  const x = row[0] + 14 + Math.random() * (row[1] - row[0] - 28);
  fizz.push({ x, y: wave(x, 0), r: 2.5 + Math.random() * 3.5, rise: 18 + Math.random() * 46, life: 0.7 + Math.random() * 0.8, age: 0 });
}
const fizzDrawn = [];
for (const f of fizz) {
  f.age += dt;
  const k = Math.min(1, f.age / f.life); // 0 → 1 while floating up
  const x = f.x + Math.sin(f.age * 9 + f.x) * 2.5;
  const y = f.y - f.rise * (1 - (1 - k) * (1 - k)); // fast at first, slowing near the top
  if (f.age < f.life) {
    fizzDrawn.push(circle(x, y, f.r, mix(goo, "#ffffff", 0.55), 0.9, s.outline, 1.5));
  } else {
    // The pop: a ring that grows and fades in a fifth of a second, with two specks flying off.
    const q = Math.min(1, (f.age - f.life) / 0.2);
    fizzDrawn.push(ring(x, y, f.r * (1 + q * 1.8), mix(goo, "#ffffff", 0.4), 1 - q));
    fizzDrawn.push(circle(x - f.r * (1 + q * 2.5), y - q * 4, 1.2, "#ffffff", 1 - q), circle(x + f.r * (1 + q * 2.5), y - q * 5, 1.2, "#ffffff", 1 - q));
  }
}
for (let i = fizz.length - 1; i >= 0; i--) if (fizz[i].age > fizz[i].life + 0.2) fizz.splice(i, 1);
draw("fizz", fizzDrawn);

Make it yours: draw a new body in Inkscape and paste its path into id="body" (keep it inside 400 × 420): the goo, clip, outline and fizz all follow it. Make a blue slime water goal, or purple goo for a potion. Want more fizz? Raise the 3 + 9 * p in the fizz code.

Testing and sharing

  • Test events: the app's Test buttons (in Recent and on triggers) send events to your widget too, marked test.
  • Fresh look: after changing files, refresh the overlay in OBS (right-click → Refresh). After changing fields.json, click Reload fields in the widget's settings.
  • Seeing errors: OBS hides them. Open your widget's address in a browser while the app is running (the address is in the widget's Copy URL): the browser's developer tools (F12) show what went wrong. Errors are also noted under your widget's name in Jlerts' error log (⚙ Settings → General → Problems).
  • Coming from StreamElements? Its onWidgetLoad and onEventReceived events are sent too, in the same shape, so many custom widgets work with few changes.
  • Sharing: click Export as .zip… in the widget's settings, or zip the folder yourself (with its widget.json, so it lands in the right tab). Others import the .zip as it is, as in Add one to the app.
  • Test run: sends a series of test events (a whole hype train, a mix of events for a widget). Tick Reload halfway to check a long alert comes back after OBS refreshes.

Good habits

  • Long names: make text shrink to fit its box instead of cutting it off with "…". Try a 25-character name, the longest Twitch allows.
  • Chat commands: never show something a viewer typed as a name on stream: only accept people who chatted recently, and show their own name. Add a cooldown for each person and ignore bots.
  • More than one overlay: base random results on the chat message's id so every copy shows the same thing, and before playing a sound of your own, check muted in an alert's play (or widget.muted in a widget) so it's heard once.
  • Sound in time with the picture: keep the animation's timing fixed in seconds; a longer alert just holds the end longer.
  • OBS is an older Chrome (127): stick to well-supported JavaScript and CSS.
  • Small files: resize pictures to the size they're shown and compress them; big files load slowly in OBS.