Twitch.Cheer

WebSocket event schema, payload, and examples

Properties

The properties defined in the event schema, with descriptions.
anonymous
boolean required
bits
integer required
cheerEmotes
CheerEmote[]
emotes
Emote[]
isFromSharedChatGuest
boolean required
isInSharedChat
boolean required
isReply
boolean required
isSharedChatHost
boolean required
isTest
boolean required
messageId
string
meta
object required
parts
TwitchMessagePartBase[]
reply
object required
sharedChatSource
object required
text
string
user
object required

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": {
    "user": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/TwitchUser"
        }
      ]
    },
    "messageId": {
      "type": [
        "null",
        "string"
      ]
    },
    "meta": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/TwitchMessageMetaData"
        }
      ]
    },
    "anonymous": {
      "type": "boolean"
    },
    "text": {
      "type": [
        "null",
        "string"
      ]
    },
    "emotes": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/Emote"
      }
    },
    "parts": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/TwitchMessagePartBase"
      }
    },
    "isReply": {
      "type": "boolean"
    },
    "reply": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/TwitchMessageReply"
        }
      ]
    },
    "isTest": {
      "type": "boolean"
    },
    "sharedChatSource": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/TwitchBaseUser"
        }
      ]
    },
    "isInSharedChat": {
      "type": "boolean"
    },
    "isSharedChatHost": {
      "type": "boolean"
    },
    "isFromSharedChatGuest": {
      "type": "boolean"
    },
    "bits": {
      "type": "integer"
    },
    "cheerEmotes": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/CheerEmote"
      }
    }
  },
  "$defs": {
    "TwitchUser": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": [
            "null",
            "string"
          ]
        },
        "login": {
          "type": [
            "null",
            "string"
          ]
        },
        "name": {
          "type": [
            "null",
            "string"
          ]
        },
        "type": {
          "type": [
            "null",
            "string"
          ]
        },
        "role": {
          "$ref": "#/$defs/ViewerRole"
        },
        "badges": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/TwitchBadge"
          }
        },
        "color": {
          "type": [
            "null",
            "string"
          ]
        },
        "subscribed": {
          "type": "boolean"
        },
        "subscriptionTier": {
          "type": [
            "null",
            "string"
          ]
        },
        "monthsSubscribed": {
          "type": "integer"
        }
      }
    },
    "ViewerRole": {
      "type": "integer",
      "description": "",
      "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"
        },
        "firstMessage": {
          "type": "boolean"
        },
        "firstMessageTimestamp": {
          "type": "string"
        },
        "returningChatter": {
          "type": "boolean"
        },
        "isHighlighted": {
          "type": "boolean"
        },
        "isMe": {
          "type": "boolean"
        },
        "isCustomReward": {
          "type": "boolean"
        },
        "isTest": {
          "type": "boolean"
        }
      }
    },
    "Emote": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": [
            "null",
            "string"
          ]
        },
        "name": {
          "type": [
            "null",
            "string"
          ]
        },
        "startIndex": {
          "type": "integer"
        },
        "endIndex": {
          "type": "integer"
        },
        "imageUrl": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    },
    "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"
          ]
        }
      }
    },
    "CheerEmote": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": [
            "null",
            "string"
          ]
        },
        "name": {
          "type": [
            "null",
            "string"
          ]
        },
        "startIndex": {
          "type": "integer"
        },
        "endIndex": {
          "type": "integer"
        },
        "imageUrl": {
          "type": [
            "null",
            "string"
          ]
        },
        "bits": {
          "type": "integer"
        },
        "color": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    }
  }
}

JSON Payload

An example JSON payload for the event, automatically generated using JSONSchemaFaker
example.json
{
  "user": null,
  "messageId": null,
  "meta": {},
  "anonymous": false,
  "text": "uQrPGZHa2",
  "emotes": null,
  "parts": [
    {
      "type": null,
      "text": ""
    },
    {
      "type": null,
      "text": "WKKexGZ"
    },
    {
      "type": null,
      "text": "1PxQRC82"
    },
    {
      "type": "VdeH1vHrCI",
      "text": null
    },
    {
      "type": null,
      "text": "VdzjQVM9"
    }
  ],
  "isReply": false,
  "reply": null,
  "isTest": false,
  "sharedChatSource": null,
  "isInSharedChat": false,
  "isSharedChatHost": false,
  "isFromSharedChatGuest": true,
  "bits": 252,
  "cheerEmotes": [
    {
      "type": null,
      "name": "2d",
      "startIndex": 697,
      "endIndex": -824,
      "imageUrl": "",
      "bits": 341,
      "color": null
    },
    {
      "type": "a",
      "name": "ZQYhlh",
      "startIndex": 219,
      "endIndex": 351,
      "imageUrl": "6f7",
      "bits": -610,
      "color": null
    },
    {
      "type": "PaC",
      "name": null,
      "startIndex": -101,
      "endIndex": -262,
      "imageUrl": null,
      "bits": -794,
      "color": null
    },
    {
      "type": "xduqihzob",
      "name": null,
      "startIndex": -231,
      "endIndex": 921,
      "imageUrl": "urm",
      "bits": 534,
      "color": null
    },
    {
      "type": "JkK",
      "name": null,
      "startIndex": 968,
      "endIndex": -373,
      "imageUrl": null,
      "bits": -45,
      "color": "J2N11"
    }
  ]
}

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);
});