SAMMI Bridge

Current version of SAMMI Bridge. Find more about SAMMI at sammi.solutions

Download

Latest Release

Table of Contents

For Users

Status tab shows the current status of your connection to SAMMI. You can see your Bridge version, and your connection status. You can also enable or disable logging.
Extensions tab allows you to see all your installed extensions, and their versions. You can verify if your extensions are up to date here.
Twitch Triggers tab allows you to test all available Twitch triggers by sending fake payload that mimics real triggers to SAMMI. YouTube Triggers tab allows you to test all available YouTube triggers by sending fake payload that mimics real triggers to SAMMI.

For Extension Devs

SAMMI Bridge uses SAMMI websocket library to make sending and receiving data easier: h. You can use promises for sending data to SAMMI. Message ids are generated automatically.

sammiclient.send(command, data).then(response=>console.log(response))

Helper Functions

Bridge provides native helper functions to make your life easier, without the need to use SAMMI Websocket library directly.
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. For that, please download unminified version of SAMMI Bridge from download folder.

Get Variable

SAMMI.getVariable(name, buttonId = 'global')

Set Variable

SAMMI.setVariable(name, value, buttonId = 'global', instanceID [optional])

Delete Variable

SAMMI.deleteVariable(name, buttonId = 'global')

Insert Array

SAMMI.insertArray(arrayName, index, value, buttonId = 'global')

Delete Array

SAMMI.deleteArray(arrayName, slot, buttonId = 'global')

Extension Command

SAMMI.extCommand(name, color = 3355443, height = 52, boxes, sendAsExtensionTrigger = false, hideCommand = false)

This function is used to send an extension command to SAMMI, e.g. what users see when they add the extension command to their button. Here are the parameters:

Box Types

| boxType | Description | —|— 0 | Resizable text box that allows for newline, defaultValue should be a string 2 | Check box, defaultValue must be set to true or false, will return true or false when triggered 4 | OBS Scenes box - allows user to select an OBS scene from a dropdown 5 | OBS Sources box - allows user to select an OBS source from a dropdown 6 | OBS Filters box - allows user to select an OBS filter from a dropdown 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 =| or >= 9 | Math box, defaultValue should be =, returns a string from the compare box, such as | or += 10 | Sound path box, defaultValue should be "", returns its path 11 | 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 option 19 | 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, returns the selected file path 23 | Image path, defaultValue should be a string, returns the selected image path 24 | Twitch reward redeem ID, defaultValue should be a number, returns the selected reward ID 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 selected option

Example Box Types

Usage Examples

This extension command named Lucky Wheel will create three boxes: a select box with options to select a color, a regular text box, and a box to select an image file. It will send its data to Bridge.

  SAMMI.extCommand('Lucky Wheel', 3355443, 52, {
    color: ['Wheel Color', 19, 'blue', null, ['blue', 'yellow', 'green']],
    rewardName: ['Reward Name', 14, 'Your Reward name'],
    rewardImage: ['Reward Image', 23, 'image.png']
  })

This extension command will create an extension command named Lucky Wheel with two text boxes. It 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)

This extension command will create the same extension command as above, however it will be hidden from the extension menu in SAMMI.

  SAMMI.extCommand('Lucky Wheel', 3355443, 52, {
    rewardName: ['Reward Name', 14, 'Some Reward name'],
    rewardName2: ['Reward Name 2', 14, 'And another reward name']
  }, true, true)

Trigger Extension

SAMMI.triggerExt(trigger, pullData)

Trigger Button

SAMMI.triggerButton(id)

ID to trigger

Modify Button

SAMMI.modifyButton(id, color, text, image, border)

Edit Button

SAMMI.editButton(deckId, buttonId)

Save Ini File

SAMMI.saveIni(fileName, section, key, value, type = "string" | "number")

Load Ini File

SAMMI.loadIni(fileName, section, key, type = "string" | "number")

Open URL

SAMMI.openURL(url)

Http Request

SAMMI.httpRequest(url, method = 'GET', headers [optional], body [optional])

Pop Up Message

SAMMI.popUp(message)

Alert Message

SAMMI.alert(message)

Notification Message

SAMMI.notification(message)

Get Deck List

SAMMI.getDeckList()

Get Deck

SAMMI.getDeck(id)

11221163402196200595’)`

Get Deck Status

SAMMI.getDeckStatus(id)

Change Deck Status

SAMMI.changeDeckStatus(id, status)

Get Image

SAMMI.getImage(fileName)

Get Sum

SAMMI.getSum(fileName)

Stay Informed

NOTE: This function is NO LONGER SUPPORTED and has been REMOVED from SAMMI Core.

SAMMI.stayInformed(enabled)

Get Active Buttons

SAMMI.getActiveButtons()

Get Modified Buttons

SAMMI.getModifiedButtons()

Get Twitch List

SAMMI.getTwitchList()

Trigger

SAMMI.trigger(type, data)

Close

SAMMI.close()

Generate Message

SAMMI.generateMessage()

Listening to Extension Data Received from SAMMI

When a user triggers an extension command, SAMMI will send the data to Bridge (unless the sendAsExtensionTrigger parameter is set to true). You can listen to this data by using sammiclient.on('extension name', (payload) => {}). You can also use sammiclient.addListener('extension name', functionToExecute).

For example, let’s say your extension command is called Lucky Wheel:

  sammiclient.on('Lucky Wheel', (payload) => {
    console.log(payload)
    // DO SOMETHING WITH THE EXTENSION PAYLOAD
    // FromButton - button ID the extension command was triggered in 
    // instanceId - instance ID of a button the extension command was triggered in
    const { FromButton, instanceId }  = payload.Data 
  });

You can also use addListener instead of on:

 sammiclient.addListener('Lucky Wheel', functionToExecute)

Note: These methods are 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 initialized as soon as Bridge connects to SAMMI).

SAMMI Bridge Collaboration

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 the download folder.