Current version of SAMMI Bridge . Download the latest release. This version will NOT work with any previous non SAMMI versions.
Find more about SAMMI at sammi.solutions
Twitch Triggers allow you to test all available Twitch triggers by sending fake payload that mimics real triggers to SAMMI.
YouTube Triggers allow you to test all available YouTube triggers by sending fake payload that mimics real triggers to SAMMI.
SAMMI Bridge uses SAMMI websocket library to make sending and receiving data easier: https://github.com/SAMMISolutions/SAMMI-Websocket. You can use promises for sending data to SAMMI. Message ids are generated automatically.
sammiclient.send(command, data).then(response=>console.log(response))
You can call all helper functions with SAMMI.method(arguments)
.
To use promises, you can call them with SAMMI.method(arguments).then(response=>console.log(response))
.
All methods are documented inside SAMMI Bridge via JSDoc.
SAMMI.getVariable(name, buttonId = 'global')
- Get a variable
- specify its button id or leave empty for global variables
- example:
SAMMI.getVariable('myVariable', 'ID1')
SAMMI.setVariable(name, value, buttonId = 'global')
- Set a variable
- specify its button id or leave empty to create a global variable
- example:
SAMMI.setVariable('myVariable', 'Hello World', 'ID1')
SAMMI.deleteVariable(name, buttonId = 'global')
- Delete a variable
- specify its button id or leave empty to delete a global variable
- example:
SAMMI.deleteVariable('myVariable', 'ID1')
SAMMI.insertArray(arrayName, index, value, buttonId = 'global')
- Inserts an item to a specified index in an array, shifting the other items
arrayName
- name of the arrayindex
- index to insert the new item atvalue
- item valuebuttonId
- button id, default is global- example:
SAMMI.insertArray('myArray',0,'Hello','ID1')
SAMMI.deleteArray(arrayName, slot, buttonId = 'global')
- Deletes an item in a specified index in an array, shifting the other items
arrayName
- name of the arrayindex
- index to delete the item atbuttonId
- button id, default is global- example:
SAMMI.deleteArray('myArray',1,'ID1')
SAMMI.extCommand(name, color = 3355443, height = 52, boxes, sendAsExtensionTrigger = false)
- Send an extension command (to create extension boxes) to SAMMI
name
- name of the extension commandcolor
- box color, accepts dec colorsheight
- height of the box in pixels, you can use 52 for regular box or 80 for resiable boxboxes
- an object containing box objects (its key is box variable and value is an array of box params)-
boxVariable: [boxName, boxType, defaultValue, (optional)sizeModifier, (optional)selectOptions]
-
boxVariable
string - variable to save the box value under- ! the following values are reserved variables and cannot be used as
boxVariable
: cmd, dis, ext, extcmd, ms, obsid, pos, sef, vis, xpan
- ! the following values are reserved variables and cannot be used as
-
boxName
string - name of the box shown in the user interface -
boxType
intboxType Description 0 Resizable text box that allows for newline, defaultValue can be anything 2 Check box, defaultValue should be set to true or false, will always return true or false when triggered 4 OBS Scenes box 5 OBS Sources box 6 OBS Filters box 7 Keyboard button, defaultValue should be 0, returns the select key code 8 Compare box, defaultValue should be ==
, returns a string from the compare box, such as `=9 Math box, defaultValue should be =
, returns a string from the compare box, such as `10 Sound path box, defaultValue should be ""
, returns its path11 Slider 0 to 100%, defaultValue should be 0-1, returns a float 0 to 1 14 Normal white box, defaultValue can be anything 15 Variable box (yellow box), defaultValue should be a string, returns whatever variable is in the yellow box 17 Color box, defaultValue should be a number, returns the selected color 18 Select box value, defaultValue should be 0
, shows a list of all the options you provided when clicked and returns a numeric value of the selected option19 Select box string, defaultValue should be a string, returns a string the user selected 20 Select box string typeable, defaultValue should be a string, returns a string the user selected or typed in the box 22 File path, defaultValue should be a string 23 Image path, defaultValue should be a string 24 Twitch reward redeem ID, defaultValue should be a number 30 No box at all, only label is present 32 OBS Pull Box 33 Select Deck Box, defaultValue should be a number 34 Password Box, same as 14, except the string is displayed as ***** 35 Twitch Account Box, select box with all linked Twitch accounts, returns the entered / selected text ***** -
defaultValue
- default value of the variable -
(optional) int
sizeModifier
- horizontal box size, 1 is normal -
(optional) []
selectOptions
- array of options for the user to select (when using Select box type) -
(optional) boolean
sendAsExtensionTrigger
- will fire an extension trigger within SAMMI instead of sending the data to Bridge, useful for relaying information between buttons while providing your users with a friendly interface. Works the same as Trigger Extension Trigger command, except you can have custom boxes. (THIS FEATURE ONLY WORKS IN SAMMI 2022.5.1 AND BRIDGE 7.11 or newer)
-
- example:
will create an extension command named Lucky Wheel with 2 text boxes. Will send its data as an Extension Trigger within SAMMI instead of sending it to Bridge.
SAMMI.extCommand('Lucky Wheel', 3355443, 52, { rewardName: ['Reward Name', 14, 'Some Reward name'], rewardName2: ['Reward Name 2', 14, 'And another reward name'] }, true)
- example2:
will create an extension command named Lucky wheel with one select box with options, one regular text box and one box to select an image file. Will send its data to Bridge.
SAMMI.extCommand('Lucky Wheel', 3355443, 52, { color: ['Wheel Color', 18, 0, null, ['blue', 'yellow', 'green']], rewardName: ['Reward Name', 14, 'Your Reward name'], rewardImage: ['Reward Image', 23, 'image.png'] })
SAMMI.triggerExt(trigger, pullData)
trigger
- name of the triggerdata
- object containing all trigger pull data (can contain objects, arrays etc.)- example:
SAMMI.triggerExt('Test Trigger', {users:['cyanidesugar', 'Silverlink'], color: 'blue', number: 5})
SAMMI.triggerButton(id)
- Triggers a button
id
- button ID to trigger- example:
SAMMI.triggerButton('ID1')
SAMMI.modifyButton(id, color, text, image, border)
- Modifies a button appearance temporarily
id
- button ID to modifycolor
- decimal button color (BGR)text
- button textimage
- button image file nameborder
- border size, 0-7- leave parameters empty to reset button back to default values
- example:
SAMMI.modifyButton('ID1', 4934525, 'Hello', 'buttonImage.png', 5)
SAMMI.popUp(message)
- Send a popup message to SAMMI
- example:
SAMMI.popUp('Hello World!')
SAMMI.alert(message)
- Send an alert message to SAMMI
- example:
SAMMI.alert('Hello World!')
SAMMI.notification(message)
- Sends a notification (tray icon bubble) message to SAMMI
- example:
SAMMI.notification('Hello World!')
SAMMI.getDeckList()
- Request an array of all decks
- Replies with an array
["Deck1 Name","Unique ID",crc32,"Deck2 Name","Unique ID",crc32,...]
SAMMI.getDeck(id)
- Request a deck params
- provide
id
of the specified deck (retrieved from getDeckList command) - example:
SAMMI.getDeck('20211221163402196200595')
SAMMI.getDeckStatus(id)
- Request current deck status (enabled/disabled)
- provide
id
of the specified deck (retrieved from getDeckList command) - replies with either 0 (deck is disabled) or 1 (deck is enabled)
- example:
SAMMI.getDeckStatus('20211221163402196200595')
SAMMI.changeDeckStatus(id, status)
- Change deck status
- provide
id
of the specified deck (retrieved from getDeckList command) - provide new
status
of the deck - 1 = enable, 0 = disable, 2 = toggle - example:
SAMMI.changeDeckStatus('20211221163402196200595', 2)
SAMMI.getImage(fileName)
- Retrieve an image in base64
fileName
= image file without the path- example:
SAMMI.getImage('test.png')
SAMMI.getSum(fileName)
- Retrieves CRC32 of a file
fileName
- file name without the path- example:
SAMMI.getSum('test.png')
SAMMI.stayInformed(enabled)
- Set
enabled
to true to start receiving all deck and button updates and false to stop receiving them - example:
SAMMI.stayInformed(true)
SAMMI.getActiveButtons()
- Retrieves all currently active buttons
SAMMI.getModifiedButtons()
- Retrieves all currently modified buttons
SAMMI.getTwitchList()
- Retrieves information for all linked Twitch accounts, including username, id, token etc.
SAMMI.trigger(type, data)
- type - trigger number
- 0 Twitch chat, 1 Twitch Sub, 2 Twitch Gift, 3 Twitch redeem, 4 Twitch Raid, 5 Twitch Bits, 6 Twitch Follower, 7 Hotkey, 8 Timer, 9 OBS Trigger, 10 SAMMI, 11 twitch moderation, 12 extension trigger
- data - whatever data is required for the trigger
- example for chat message trigger:
SAMMI.trigger(0, { message : 'Hello World', broadcaster: 1, moderator: 0, sub: 0, vip: 0, founder: 0, trigger_data: { user_name: 'silverlink', display_name: 'Silverlink', user_id: 123456789, message : 'Hello World!', emote_list: '304822798:0-9/304682444:11-19', badge_list: 'broadcaster/1', channel : 123456789, name_color: '#189A8D', first_time: 0 } })
- this is a very complex command and not recommended to use unless you know the exact payload you need to send
SAMMI.close()
- Closes SAMMI connection to Bridge
SAMMI.generateMessage()
- Generates a random message (used for test triggers)
In addition to hooks, you can also directly listen to a specified extension command coming from SAMMI.
This way you can receive all extension data directly in your functions.
Use sammiclient.on()
or sammiclient.addListener()
and sammiclient.removeListener()
.
For example, let's say your extension command is called Lucky Wheel:
sammiclient.on('Lucky Wheel', (payload) => {
// DO SOMETHING WITH THE EXTENSION PAYLOAD
console.log(payload)
});
You can also do:
sammiclient.addListener('Lucky Wheel', functionToExecute)
Note: These methods will not be available until after your Bridge connects to SAMMI. Make sure to wrap them in a function which you call in your Extension Commands section (which is initalized as soon as Bridge connects to SAMMI).
SAMMI Bridge is generated by Jekyll. Each section is a separate file generated from _includes
folder. If you wish to propose changes, please do so by editing these files.
Any changes will immediately reflect at https://sammi.solutions/SAMMI-Bridge/bridge.html. We also manually generate the Bridge file for each release, which can be found in download
folder.
Fixed bad auth token error for PubSub which happened when debug logging was enabled.
Debug Logging
- fixed undefined request names and ids shown in the log
- Twitch tokens will show as *** for GetTwitchList replies to prevent accidentally exposing them
Fixed incorrect trigger type for Channel Points test trigger.
Cleaned up the code and fixed an array helper function.
A lot has changed since the initial 5.00 version. Websocket protocol is now completely different and supports helper functions and promises. Testing buttons now work again too.