Flow Functions

twitch_message()

If the Twitch integration is enabled by the user in the Flow settings, chat messages will come through "twitch_message". If the user specified a command via the script settings, this will only execute if the command is found within the message. Otherwise, every message will come through.

twitch_message((message) => {
  const example_message = {
    "tags": {
      "badge-info": {
        "founder": "51"
      },
      "badges": {
        "moderator": "1",
        "founder": "0",
        "bits": "1000"
      },
      "color": "#65C47F",
      "display-name": "runshotgun",
      "emotes": null,
      "first-msg": "0",
      "id": "9dcf58b7-e6a8-484d-9c16-280f2d384c4f",
      "mod": "1",
      "returning-chatter": "0",
      "room-id": "91420958",
      "subscriber": "1",
      "tmi-sent-ts": "1666907326935",
      "turbo": "0",
      "user-id": "84610723",
      "user-type": "mod"
    },
    "source": {
      "nick": "runshotgun",
      "host": "runshotgun@runshotgun.tmi.twitch.tv"
    },
    "command": {
      "command": "PRIVMSG",
      "channel": "#theskyloungetv"
    },
    "parameters": "Looking good!"
  }
});

message: Message coming from Twitch chat. See above example for a structure example.

Note that the tags structure is where the magic happens. Tags are defined or not depending on the type of message that went through. Here are a few examples:

// Bits
"bits": "10"

// Resub
"msg-id": "resub",
"msg-param-cumulative-months": "8",
"msg-param-months": "0",
"msg-param-multimonth-duration": "0",
"msg-param-multimonth-tenure": "0",
"msg-param-should-share-streak": "0",
"msg-param-sub-plan-name": "Channel\\sSubscription\\s(oohcando)",
"msg-param-sub-plan": "Prime",
"msg-param-was-gifted": "false",
"subscriber": "1",
"system-msg": "runshotgun\\ssubscribed\\swith\\sPrime.\\sThey've\\ssubscribed\\sfor\\s8\\smonths!"

// Highlighted message
"msg-id": "highlighted-message"

Fore more info on the Twitch integration, please refer to the official api documentation here: https://dev.twitch.tv/docs/irc/example-bot

APIs

The following APIs are also available:

Community of Makers

Our Discord has evolved into a vibrant hub for widget creators. Seek answers to your questions, and showcase your innovative widgets to a community of passionate makers.