Twitch.Cheer

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
bits
integer required
cheerEmotes
CheerEmote[]

Schema

The JSON Schema for the event payload, if available.
schema.json
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "TwitchCheerEvent",
  "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"
    },
    "bits": {
      "type": "integer",
      "format": "int32"
    },
    "cheerEmotes": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/definitions/CheerEmote"
      }
    }
  },
  "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,
  "bits": -31222011,
  "cheerEmotes": [
    {
      "bits": -39593280,
      "color": null,
      "endIndex": 28410734,
      "imageUrl": "irure nulla dolore",
      "name": "ex",
      "startIndex": 26708726,
      "type": "in aliquip esse est officia"
    },
    {
      "bits": 40931392,
      "color": "laborum sed Duis ipsum",
      "endIndex": 91481584,
      "imageUrl": null,
      "name": null,
      "startIndex": 16480794,
      "type": null
    },
    {
      "bits": -62316219,
      "color": null,
      "endIndex": 52006165,
      "imageUrl": "cupidatat",
      "name": "eiusmod do quis ea",
      "startIndex": 73975482,
      "type": null
    },
    {
      "bits": 26689408,
      "color": "ea commodo do",
      "endIndex": 92084722,
      "imageUrl": "in occaecat nulla",
      "name": "ipsum voluptate",
      "startIndex": 70359121,
      "type": null
    },
    {
      "bits": -461486,
      "color": "qui fugiat quis",
      "endIndex": -54044588,
      "imageUrl": "dolor ex",
      "name": "elit sit exercitation do",
      "startIndex": 32180744,
      "type": "ea tempor pariatur adipisicing ut"
    }
  ],
  "emotes": [
    {
      "endIndex": -58861058,
      "imageUrl": null,
      "name": "deserunt",
      "startIndex": -60982954,
      "type": "culpa irure occaecat"
    },
    {
      "endIndex": 56387112,
      "imageUrl": null,
      "name": null,
      "startIndex": -90255180,
      "type": "ut"
    },
    {
      "endIndex": 16643324,
      "imageUrl": "incididunt",
      "name": null,
      "startIndex": -69179633,
      "type": null
    },
    {
      "endIndex": 43319971,
      "imageUrl": null,
      "name": "aliqua ea",
      "startIndex": -69361824,
      "type": "consequat occaecat non dolor"
    },
    {
      "endIndex": 94847336,
      "imageUrl": "cupidatat officia",
      "name": null,
      "startIndex": 20918838,
      "type": null
    }
  ],
  "isFromSharedChatGuest": true,
  "isInSharedChat": false,
  "isReply": false,
  "isSharedChatHost": false,
  "isTest": true,
  "message": {
    "badges": null,
    "bits": -48991566,
    "channel": "nisi dolor",
    "cheerEmotes": [],
    "clientNonce": "incididunt in enim sunt",
    "color": null,
    "displayName": "incididunt ut aliqua exercitation",
    "emotes": [],
    "firstMessage": true,
    "hasBits": false,
    "internal": false,
    "isAnonymous": false,
    "isCustomReward": false,
    "isFromSharedChatGuest": false,
    "isHighlighted": true,
    "isInSharedChat": true,
    "isMe": false,
    "isReply": true,
    "isTest": true,
    "message": null,
    "monthsSubscribed": 66379057,
    "msgId": null,
    "reply": {
      "msgBody": "dolor consectetur Duis quis",
      "msgId": null,
      "threadMsgId": null,
      "threadUserLogin": "id do Ut cillum",
      "userId": null,
      "userLogin": null,
      "userName": "consectetur aliquip ut ullamco Ut"
    },
    "returningChatter": false,
    "role": 1,
    "sourceBadges": null,
    "sourceMsgId": "veniam in Ut",
    "sourceRoomId": null,
    "subscriber": false,
    "subscriptionTier": null,
    "userId": "eiusmod qui nulla",
    "username": "dolor elit cupidatat"
  },
  "messageId": null,
  "meta": null,
  "parts": [
    {
      "text": null,
      "type": "ad in proident irure ullamco"
    },
    {
      "text": "est",
      "type": "consectetur est"
    },
    {
      "text": null,
      "type": "Excepteur"
    },
    {
      "text": "veniam ut Excepteur sed",
      "type": null
    },
    {
      "text": null,
      "type": null
    }
  ],
  "reply": null,
  "sharedChatSource": null,
  "text": null,
  "user": null
}

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.Cheer" events and register a callback
client.on('Twitch.Cheer', ({ 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);
});