Published: Last updated:

Switching a PNGTuber's expression on Twitch notifications

5 min read

How to make a PNGTuber built with Peraravatar+ automatically switch to a chosen custom expression when you get a Twitch follow notification.

An OBS stream screen. A follow notification with a heart animation in the center, and the avatar cheering with both hands up at the bottom right
The expression switched along with the follow notification

What you need

Set the Hold mode

Set the “Hold mode” of the expression to show on a follow notification to “For a set time”. Once that time has passed, the avatar returns to its previous expression.

Check the “Hold mode” of that expression under custom expressions in Peraravatar+. If it isn’t “For a set time”, set it up in one of these two ways.

  • Change the current expression: change its “Hold mode” to “For a set time”
  • Add it as a separate expression: use ”+ Add expression” to add an expression for follow notifications, and set its “Hold mode” to “For a set time”

We recommend matching the time to how long the follow notification is shown. You can check that length in Twitch’s Creator Dashboard: open “Alerts”, open your alert set (choose “Create Alert Set” if you don’t have one), and check “Duration” (in seconds, up to 99) under “General Settings” for the follow alert.

General Settings of a Twitch follow alert, in Japanese. The variation name is New follow, the alert condition is new channel followers, and Duration is 5 seconds
General Settings of the follow alert

If you changed or added an expression, apply it to OBS.

  1. On the “Export” tab, press “Export avatar as HTML” and overwrite the HTML loaded in OBS
  2. If you added an expression, press “Export OBS hotkey script” and overwrite the .lua. Then press reload (↻) in OBS under “Tools → Scripts”
  3. In OBS, open the properties of the avatar’s browser source and press “Refresh cache of current page”

Enable the OBS WebSocket server

Streamer.bot connects to OBS over WebSocket, so enable the OBS WebSocket server.

  1. In OBS, open “Tools → WebSocket Server Settings”
  2. Check “Enable WebSocket server”
  3. Press “Show Connect Info” and check the port and password
The OBS WebSocket Server Settings window, in Japanese. Enable WebSocket server is checked, the server port is 4455, and the Show Connect Info button is below
Tools → WebSocket Server Settings

Connect Streamer.bot to OBS

  1. Download Streamer.bot from the official site, extract it, and run Streamer.bot.exe in the folder
  2. In the left menu, open “OBS Studio” under “Stream Apps”, right-click an empty part of the list, and choose “Add”
The OBS Studio screen in Streamer.bot. Right-clicking an empty part of the list opens a menu with Add at the top
Right-click an empty part of the list and choose “Add”
  1. Enter a name you’ll recognize in Name, 127.0.0.1 in Host, and the port and password you checked in OBS in Port and Password
  2. Turn on “Auto Connect on Startup” and “Reconnect on Disconnect”, then press “Ok”
The OBS connection settings in Streamer.bot. Name, Version, Host set to 127.0.0.1, Port set to 4455, a masked Password, and Auto Connect on Startup and Reconnect on Disconnect turned on
OBS connection settings
  1. Right-click the row you added and choose “Connect”
The OBS Studio screen in Streamer.bot. Right-clicking the added row opens a menu with Connect at the bottom
Right-click the row you added and choose “Connect”

Once connected, the status of OBS appears under “OBS Information” on the right.

The OBS Studio screen in Streamer.bot. OBS Information on the right shows the current scene, the stream and recording status, and the list of sources
Connected

“Auto Connect on Startup” only takes effect from the next launch, so right after adding the connection you need to Connect manually. From then on, it connects automatically when you start Streamer.bot.

Connect Streamer.bot to Twitch

  1. In the left menu, open “Twitch” under “Platforms”, and press “Login” for “Broadcaster Account” under “Accounts”
The Twitch screen in Streamer.bot. A Login button is at the right of the Broadcaster Account row under Accounts
Press “Login” for “Broadcaster Account”
  1. When your browser opens, authorize the connection with the account you stream on

Create an action that switches the expression on a follow

  1. In the left menu, open “Actions” under “Actions & Queues”, right-click an empty part of the list, and choose “Add”
The Actions screen in Streamer.bot. Right-clicking an empty part of the list on the left opens a menu with Add at the top. The Triggers and Sub-Actions areas are on the right
Right-click an empty part of the list and choose “Add”
  1. Enter a name you’ll recognize in Name, then press “Ok”
The Edit Action window in Streamer.bot, with a name entered in Name
Enter a name for the action
  1. Right-click an empty part of “Triggers” at the top right, and choose “Add → Twitch → Channel → Follow”
The Actions screen in Streamer.bot. Right-clicking an empty part of Triggers and opening Add, Twitch and Channel, with Follow at the top selected
Choose “Add → Twitch → Channel → Follow”
  1. Open the “Export” tab in Peraravatar+, and in the list below “Export OBS hotkey script”, press “Copy” for that expression
The Export tab in Peraravatar+, in Japanese. Below the Export OBS hotkey script button, a name and a Copy button are listed for each expression
Press “Copy” for that expression
  1. Back in Streamer.bot, right-click an empty part of “Sub-Actions” at the bottom right, and choose “Add → OBS Studio → Raw”
The Actions screen in Streamer.bot. Right-clicking an empty part of Sub-Actions and opening Add and OBS Studio, with Raw selected
Choose “Add → OBS Studio → Raw”
  1. Choose the connected OBS in Connection, and paste the following line into the “Raw” field
{"requestType":"TriggerHotkeyByName","requestData":{"hotkeyName":"PASTE_THE_COPIED_NAME_HERE"}}
  1. Replace PASTE_THE_COPIED_NAME_HERE with the name you copied in step 4, then press “Ok”
The OBS Studio Raw settings in Streamer.bot. The connected OBS is chosen in Connection, and the Raw field holds the TriggerHotkeyByName line
The line pasted into the “Raw” field

As it stands, the expression switches before the follow notification appears, so delay the switch.

  1. Right-click an empty part of “Sub-Actions”, and choose “Add → Core → Delay”
The Actions screen in Streamer.bot. Right-clicking an empty part of Sub-Actions and opening Add and Core, with Delay at the top selected
Choose “Add → Core → Delay”
  1. Enter the wait time in milliseconds in Delay, then press “Ok”
The Delay settings in Streamer.bot, with 2000 entered in Delay
Enter the wait time in milliseconds
  1. Drag the “Delay” you added above “OBS Raw"
The Sub-Actions area in Streamer.bot. Delay for 2000ms is on top, with OBS Raw below it
"Delay” moved above “OBS Raw”
When I tested with real follows, the gap felt like 1 to 2 seconds, so adjusting between 1000 and 2000 should work well. The gap also depends on your connection, so it seems hard to match it exactly.

Test it

Right-click the “Follow” row you added and choose “Test Trigger”. If the avatar’s expression switches in OBS, it’s working.

The Actions screen in Streamer.bot. Right-clicking the Follow row in Triggers opens a menu with Test Trigger at the top
Right-click the “Follow” row and choose “Test Trigger"
"Test Trigger” doesn’t show the follow notification, so you can only check the timing gap with a real follow. A test alert from the Twitch dashboard doesn’t reach Streamer.bot, so the expression won’t switch.

Keep Streamer.bot running while you stream

Streamer.bot is what receives the follow notifications, so it needs to be running while you stream. If it’s closed, the expression won’t switch when someone follows you. Once it’s set up, it connects to OBS and Twitch as soon as you start it.

Summary

  • Set the “Hold mode” of the expression for follow notifications to “For a set time”. We recommend matching the time to how long the follow notification is shown
  • Enable the OBS WebSocket server before connecting Streamer.bot
  • In a Streamer.bot action, combine the Follow trigger with OBS Studio’s Raw
  • The expression switches before the follow notification appears, so add a “Delay”
  • Test with “Test Trigger”. A Twitch test alert won’t switch the expression
  • Keep Streamer.bot running while you stream

Contact

Bug reports & Feature requests

Use the form for "it doesn't work" or "I wish it could…". Easiest channel for me to triage.

Contact form ▶

Business & Other inquiries

For work requests and other inquiries, please email me.

Email ▶

Feedback & Cheers

An anonymous one-liner channel. Even just "I'm using it" makes me happy.

Marshmallow ▶

Support development

Help cover server / domain costs. Tips fuel new releases. OFUSE for Japan, Ko-fi for international.