Twitch.FirstWord

WebSocket event schema, payload, and examples

Properties

message
object required
user
object required
messageId
string
meta
object required
anonymous
boolean required
text
string
emotes
Emote[]
parts
TwitchMessagePartBase[]
isReply
boolean required
reply
object required
isTest
boolean required
sharedChatSource
object required
isInSharedChat
boolean required
isSharedChatHost
boolean required
isFromSharedChatGuest
boolean required

Schema

The JSON Schema for the event payload, if available.
schema.json
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "TwitchMessageEvent",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "message": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/definitions/ChatMessage"
        }
      ]
    },
    "user": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/definitions/TwitchUser"
        }
      ]
    },
    "messageId": {
      "type": [
        "null",
        "string"
      ]
    },
    "meta": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/definitions/TwitchMessageMetaData"
        }
      ]
    },
    "anonymous": {
      "type": "boolean"
    },
    "text": {
      "type": [
        "null",
        "string"
      ]
    },
    "emotes": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/definitions/Emote"
      }
    },
    "parts": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/definitions/TwitchMessagePartBase"
      }
    },
    "isReply": {
      "type": "boolean"
    },
    "reply": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/definitions/TwitchMessageReply"
        }
      ]
    },
    "isTest": {
      "type": "boolean"
    },
    "sharedChatSource": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/definitions/TwitchBaseUser"
        }
      ]
    },
    "isInSharedChat": {
      "type": "boolean"
    },
    "isSharedChatHost": {
      "type": "boolean"
    },
    "isFromSharedChatGuest": {
      "type": "boolean"
    }
  },
  "definitions": {
    "ChatMessage": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "internal": {
          "type": "boolean"
        },
        "msgId": {
          "type": [
            "null",
            "string"
          ]
        },
        "clientNonce": {
          "type": [
            "null",
            "string"
          ]
        },
        "userId": {
          "type": [
            "null",
            "string"
          ]
        },
        "username": {
          "type": [
            "null",
            "string"
          ]
        },
        "role": {
          "$ref": "#/definitions/ViewerRole"
        },
        "subscriber": {
          "type": "boolean"
        },
        "subscriptionTier": {
          "type": [
            "null",
            "string"
          ]
        },
        "displayName": {
          "type": [
            "null",
            "string"
          ]
        },
        "color": {
          "type": [
            "null",
            "string"
          ]
        },
        "channel": {
          "type": [
            "null",
            "string"
          ]
        },
        "message": {
          "type": [
            "null",
            "string"
          ]
        },
        "isHighlighted": {
          "type": "boolean"
        },
        "isMe": {
          "type": "boolean"
        },
        "isCustomReward": {
          "type": "boolean"
        },
        "isAnonymous": {
          "type": "boolean"
        },
        "isReply": {
          "type": "boolean"
        },
        "reply": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/definitions/ReplyData"
            }
          ]
        },
        "bits": {
          "type": "integer",
          "format": "int32"
        },
        "firstMessage": {
          "type": "boolean"
        },
        "returningChatter": {
          "type": "boolean"
        },
        "hasBits": {
          "type": "boolean"
        },
        "emotes": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/Emote"
          }
        },
        "cheerEmotes": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/CheerEmote"
          }
        },
        "badges": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/Badge"
          }
        },
        "monthsSubscribed": {
          "type": "integer",
          "format": "int32"
        },
        "isTest": {
          "type": "boolean"
        },
        "isInSharedChat": {
          "type": "boolean"
        },
        "isFromSharedChatGuest": {
          "type": "boolean"
        },
        "sourceRoomId": {
          "type": [
            "null",
            "string"
          ]
        },
        "sourceMsgId": {
          "type": [
            "null",
            "string"
          ]
        },
        "sourceBadges": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/Badge"
          }
        }
      }
    },
    "ViewerRole": {
      "type": "integer",
      "description": "",
      "x-enum-names": [
        "Unknown",
        "Viewer",
        "Vip",
        "Moderator",
        "Broadcaster"
      ],
      "x-enum-varnames": [
        "Unknown",
        "Viewer",
        "Vip",
        "Moderator",
        "Broadcaster"
      ],
      "x-enumNames": [
        "Unknown",
        "Viewer",
        "Vip",
        "Moderator",
        "Broadcaster"
      ],
      "x-enum-descriptions": [
        null,
        null,
        null,
        null,
        null
      ],
      "x-enumDescriptions": [
        null,
        null,
        null,
        null,
        null
      ],
      "enum": [
        0,
        1,
        2,
        3,
        4
      ]
    },
    "ReplyData": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "userId": {
          "type": [
            "null",
            "string"
          ]
        },
        "userLogin": {
          "type": [
            "null",
            "string"
          ]
        },
        "userName": {
          "type": [
            "null",
            "string"
          ]
        },
        "msgId": {
          "type": [
            "null",
            "string"
          ]
        },
        "msgBody": {
          "type": [
            "null",
            "string"
          ]
        },
        "threadMsgId": {
          "type": [
            "null",
            "string"
          ]
        },
        "threadUserLogin": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    },
    "Emote": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": [
            "null",
            "string"
          ]
        },
        "name": {
          "type": [
            "null",
            "string"
          ]
        },
        "startIndex": {
          "type": "integer",
          "format": "int32"
        },
        "endIndex": {
          "type": "integer",
          "format": "int32"
        },
        "imageUrl": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    },
    "CheerEmote": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": [
            "null",
            "string"
          ]
        },
        "name": {
          "type": [
            "null",
            "string"
          ]
        },
        "startIndex": {
          "type": "integer",
          "format": "int32"
        },
        "endIndex": {
          "type": "integer",
          "format": "int32"
        },
        "imageUrl": {
          "type": [
            "null",
            "string"
          ]
        },
        "bits": {
          "type": "integer",
          "format": "int32"
        },
        "color": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    },
    "Badge": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": [
            "null",
            "string"
          ]
        },
        "version": {
          "type": [
            "null",
            "string"
          ]
        },
        "imageUrl": {
          "type": [
            "null",
            "string"
          ]
        },
        "info": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    },
    "TwitchUser": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": [
            "null",
            "string"
          ]
        },
        "login": {
          "type": [
            "null",
            "string"
          ]
        },
        "name": {
          "type": [
            "null",
            "string"
          ]
        },
        "type": {
          "type": [
            "null",
            "string"
          ]
        },
        "role": {
          "$ref": "#/definitions/ViewerRole2"
        },
        "badges": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/definitions/TwitchBadge"
          }
        },
        "color": {
          "type": [
            "null",
            "string"
          ]
        },
        "subscribed": {
          "type": "boolean"
        },
        "subscriptionTier": {
          "type": [
            "null",
            "string"
          ]
        },
        "monthsSubscribed": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "ViewerRole2": {
      "type": "integer",
      "description": "",
      "x-enum-names": [
        "Unknown",
        "Viewer",
        "Vip",
        "Moderator",
        "Broadcaster"
      ],
      "x-enum-varnames": [
        "Unknown",
        "Viewer",
        "Vip",
        "Moderator",
        "Broadcaster"
      ],
      "x-enumNames": [
        "Unknown",
        "Viewer",
        "Vip",
        "Moderator",
        "Broadcaster"
      ],
      "x-enum-descriptions": [
        null,
        null,
        null,
        null,
        null
      ],
      "x-enumDescriptions": [
        null,
        null,
        null,
        null,
        null
      ],
      "enum": [
        0,
        1,
        2,
        3,
        4
      ]
    },
    "TwitchBadge": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": [
            "null",
            "string"
          ]
        },
        "version": {
          "type": [
            "null",
            "string"
          ]
        },
        "imageUrl": {
          "type": [
            "null",
            "string"
          ]
        },
        "info": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    },
    "TwitchMessageMetaData": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "internal": {
          "type": "boolean"
        },
        "clientNonce": {
          "type": [
            "null",
            "string"
          ]
        },
        "firstMessage": {
          "type": "boolean"
        },
        "returningChatter": {
          "type": "boolean"
        },
        "isHighlighted": {
          "type": "boolean"
        },
        "isMe": {
          "type": "boolean"
        },
        "isCustomReward": {
          "type": "boolean"
        },
        "isTest": {
          "type": "boolean"
        }
      }
    },
    "TwitchMessagePartBase": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": [
            "null",
            "string"
          ]
        },
        "text": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    },
    "TwitchMessageReply": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "msgId": {
          "type": [
            "null",
            "string"
          ]
        },
        "userId": {
          "type": [
            "null",
            "string"
          ]
        },
        "userLogin": {
          "type": [
            "null",
            "string"
          ]
        },
        "userName": {
          "type": [
            "null",
            "string"
          ]
        },
        "msgBody": {
          "type": [
            "null",
            "string"
          ]
        },
        "threadMsgId": {
          "type": [
            "null",
            "string"
          ]
        },
        "threadUserLogin": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    },
    "TwitchBaseUser": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": [
            "null",
            "string"
          ]
        },
        "login": {
          "type": [
            "null",
            "string"
          ]
        },
        "name": {
          "type": [
            "null",
            "string"
          ]
        },
        "type": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    }
  }
}

JSON Payload

An example JSON payload for the event, automatically generated using JSONSchemaFaker
example.json
{
  "anonymous": true,
  "emotes": [
    {
      "endIndex": -52350569,
      "imageUrl": null,
      "name": null,
      "startIndex": -4738339,
      "type": null
    },
    {
      "endIndex": 89020452,
      "imageUrl": "occaecat eu mollit qui in",
      "name": null,
      "startIndex": 3896557,
      "type": "ullamco laborum ex"
    },
    {
      "endIndex": 19913627,
      "imageUrl": null,
      "name": null,
      "startIndex": 68043177,
      "type": "qui enim"
    },
    {
      "endIndex": 7048389,
      "imageUrl": "do exercitation culpa",
      "name": null,
      "startIndex": 67322132,
      "type": null
    },
    {
      "endIndex": -80450854,
      "imageUrl": "incididunt",
      "name": "irure elit pariatur Lorem adipisicing",
      "startIndex": 61434686,
      "type": "quis sunt anim"
    }
  ],
  "isFromSharedChatGuest": true,
  "isInSharedChat": true,
  "isReply": true,
  "isSharedChatHost": true,
  "isTest": false,
  "message": {
    "badges": null,
    "bits": -18544794,
    "channel": "non",
    "cheerEmotes": [
      {
        "bits": -59453778,
        "color": "dolore",
        "endIndex": -14079830,
        "imageUrl": null,
        "name": "cupidatat id voluptate ut",
        "startIndex": 84139134,
        "type": null
      },
      {
        "bits": -14206746,
        "color": "velit in ad",
        "endIndex": -67483144,
        "imageUrl": "Ut mollit sed et proident",
        "name": "cillum dolore aliquip",
        "startIndex": -24659838,
        "type": "sint anim sed in aute"
      },
      {
        "bits": -71840282,
        "color": null,
        "endIndex": 71251221,
        "imageUrl": null,
        "name": "exercitation est",
        "startIndex": -52440321,
        "type": null
      },
      {
        "bits": -23739348,
        "color": null,
        "endIndex": 20568131,
        "imageUrl": null,
        "name": "tempor aliquip id et",
        "startIndex": 7099757,
        "type": "dolor id do enim ipsum"
      },
      {
        "bits": 46024050,
        "color": "laboris sint exercitation",
        "endIndex": -53990997,
        "imageUrl": null,
        "name": "fugiat eu tempor Lorem aliqua",
        "startIndex": 16532366,
        "type": null
      }
    ],
    "clientNonce": null,
    "color": "esse ea",
    "displayName": "eu",
    "emotes": null,
    "firstMessage": false,
    "hasBits": false,
    "internal": true,
    "isAnonymous": false,
    "isCustomReward": false,
    "isFromSharedChatGuest": false,
    "isHighlighted": true,
    "isInSharedChat": false,
    "isMe": false,
    "isReply": false,
    "isTest": true,
    "message": null,
    "monthsSubscribed": 64439014,
    "msgId": "ut",
    "reply": null,
    "returningChatter": true,
    "role": 1,
    "sourceBadges": [
      {
        "imageUrl": null,
        "info": null,
        "name": "ad culpa laborum",
        "version": "id dolore qui"
      },
      {
        "imageUrl": "reprehenderit fugiat",
        "info": null,
        "name": null,
        "version": null
      },
      {
        "imageUrl": null,
        "info": null,
        "name": null,
        "version": null
      },
      {
        "imageUrl": "do sed dolor officia aute",
        "info": "veniam ad ut id voluptate",
        "name": "ad",
        "version": "quis labore"
      },
      {
        "imageUrl": "sunt enim incididunt",
        "info": "deserunt",
        "name": "veniam cupidatat",
        "version": "dolore nostrud"
      }
    ],
    "sourceMsgId": null,
    "sourceRoomId": "nulla ea laboris est in",
    "subscriber": false,
    "subscriptionTier": "do dolor incididunt",
    "userId": "id dolore minim deserunt ex",
    "username": "Duis aute sit"
  },
  "messageId": "dolor",
  "meta": null,
  "parts": [
    {
      "text": "sunt",
      "type": "laborum"
    },
    {
      "text": null,
      "type": "qui voluptate Duis ad"
    },
    {
      "text": null,
      "type": null
    },
    {
      "text": "enim anim Excepteur",
      "type": null
    },
    {
      "text": "laborum dolor Ut minim ad",
      "type": null
    }
  ],
  "reply": {
    "msgBody": null,
    "msgId": "esse cillum nostrud",
    "threadMsgId": "voluptate velit fugiat id",
    "threadUserLogin": null,
    "userId": null,
    "userLogin": "ut mollit",
    "userName": "non nisi dolore"
  },
  "sharedChatSource": null,
  "text": null,
  "user": {
    "badges": [
      {
        "imageUrl": null,
        "info": "tempor cupidatat laboris",
        "name": null,
        "version": "eiusmod non consequat"
      },
      {
        "imageUrl": "Ut officia sunt",
        "info": null,
        "name": null,
        "version": null
      },
      {
        "imageUrl": null,
        "info": null,
        "name": null,
        "version": null
      },
      {
        "imageUrl": null,
        "info": null,
        "name": "aliquip in",
        "version": null
      },
      {
        "imageUrl": null,
        "info": null,
        "name": null,
        "version": null
      }
    ],
    "color": "sint eu ut dolore consectetur",
    "id": null,
    "login": "sit est aliquip",
    "monthsSubscribed": -82628414,
    "name": null,
    "role": 0,
    "subscribed": true,
    "subscriptionTier": null,
    "type": "consequat fugiat"
  }
}

Client Example

Example code showing how to subscribe to this event using the Streamer.bot WebSocket Client
index.js
// Initialize the Streamer.bot WebSocket Client
const client = new StreamerbotClient();

// Subscribe to "Twitch.FirstWord" events and register a callback
client.on('Twitch.FirstWord', ({ event, data }) => {
  // Code here will run every time the event is received!
  console.log('Received event:', event.source, event.type);
  console.log('Event data:', data);
});