Twitch.Cheer

WebSocket event schema, payload, and examples

Properties

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": "",
      "x-enum-names": [
        "Unknown",
        "Viewer",
        "Vip",
        "Moderator",
        "Broadcaster"
      ],
      "x-enum-descriptions": [
        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"
        },
        "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": null,
  "anonymous": false,
  "text": null,
  "emotes": null,
  "parts": null,
  "isReply": true,
  "reply": {},
  "isTest": false,
  "sharedChatSource": {},
  "isInSharedChat": true,
  "isSharedChatHost": false,
  "isFromSharedChatGuest": false,
  "bits": -535,
  "cheerEmotes": [
    {
      "type": "d",
      "name": "",
      "startIndex": 965,
      "endIndex": -855,
      "imageUrl": "Qd",
      "bits": 556,
      "color": "6eS8"
    },
    {
      "type": "c00Ht",
      "name": "vb7t",
      "startIndex": -124,
      "endIndex": 599,
      "imageUrl": "mOMS",
      "bits": 876,
      "color": null
    },
    {
      "type": "",
      "name": "W",
      "startIndex": -211,
      "endIndex": -162,
      "imageUrl": "9qfRb",
      "bits": 469,
      "color": "uOg"
    },
    {
      "type": "NhJ6bJGS0A",
      "name": null,
      "startIndex": 726,
      "endIndex": -109,
      "imageUrl": "JGsn4",
      "bits": 200,
      "color": null
    },
    {
      "type": null,
      "name": null,
      "startIndex": 956,
      "endIndex": -545,
      "imageUrl": null,
      "bits": -371,
      "color": "zY3u"
    }
  ]
}

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