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": false,
  "bits": 38404043,
  "cheerEmotes": [
    {
      "bits": 96823971,
      "color": "deserunt",
      "endIndex": -24298127,
      "imageUrl": "occaecat dolore",
      "name": "ullamco ex",
      "startIndex": -63542109,
      "type": null
    },
    {
      "bits": -39939470,
      "color": null,
      "endIndex": -85742013,
      "imageUrl": null,
      "name": "cupidatat",
      "startIndex": -33630348,
      "type": "ullamco anim"
    },
    {
      "bits": -20904279,
      "color": null,
      "endIndex": -72370448,
      "imageUrl": "consectetur elit ut",
      "name": "laborum ullamco voluptate",
      "startIndex": -66261136,
      "type": "sed dolor eu adipisicing esse"
    },
    {
      "bits": 75197461,
      "color": null,
      "endIndex": 52540836,
      "imageUrl": null,
      "name": null,
      "startIndex": -62531487,
      "type": "incididunt aliquip officia"
    },
    {
      "bits": -18649847,
      "color": "fugiat dolor",
      "endIndex": -34757033,
      "imageUrl": "in Excepteur",
      "name": "quis deserunt qui",
      "startIndex": 90444902,
      "type": "dolor"
    }
  ],
  "emotes": [
    {
      "endIndex": -70360493,
      "imageUrl": "aute ex mollit",
      "name": "do nostrud adipisicing cupidatat anim",
      "startIndex": -54139912,
      "type": "ad Duis"
    },
    {
      "endIndex": -72833289,
      "imageUrl": "adipisicing",
      "name": "id reprehenderit",
      "startIndex": 85540274,
      "type": null
    },
    {
      "endIndex": -51915473,
      "imageUrl": "ea enim",
      "name": null,
      "startIndex": 5727460,
      "type": "ut labore esse Duis in"
    },
    {
      "endIndex": -69532179,
      "imageUrl": "irure ut do in officia",
      "name": "dolor laborum",
      "startIndex": -88597708,
      "type": "minim adipisicing sed proident officia"
    },
    {
      "endIndex": -84629007,
      "imageUrl": "magna aliqua laborum Ut et",
      "name": "ad velit anim fugiat Excepteur",
      "startIndex": 1583309,
      "type": "minim"
    }
  ],
  "isFromSharedChatGuest": false,
  "isInSharedChat": false,
  "isReply": false,
  "isSharedChatHost": false,
  "isTest": true,
  "message": {
    "badges": null,
    "bits": 88014244,
    "channel": "elit culpa pariatur irure enim",
    "cheerEmotes": [
      {
        "bits": 51169057,
        "color": "veniam",
        "endIndex": -13020694,
        "imageUrl": "esse occaecat ut enim",
        "name": "dolore ut ullamco",
        "startIndex": -53748911,
        "type": null
      },
      {
        "bits": 37236100,
        "color": "aute exercitation",
        "endIndex": 25856479,
        "imageUrl": null,
        "name": null,
        "startIndex": -43351983,
        "type": "nostrud aliqua mollit deserunt"
      },
      {
        "bits": -12804669,
        "color": "dolore irure",
        "endIndex": 78301757,
        "imageUrl": "dolor sunt anim incididunt Excepteur",
        "name": "aute ex eu",
        "startIndex": -29115923,
        "type": "ea"
      },
      {
        "bits": 80283578,
        "color": "ut",
        "endIndex": 74376297,
        "imageUrl": "qui non reprehenderit",
        "name": "laborum",
        "startIndex": -72199204,
        "type": "ut"
      },
      {
        "bits": -8646961,
        "color": "dolore Duis aliquip dolore in",
        "endIndex": 99829058,
        "imageUrl": "dolore",
        "name": null,
        "startIndex": -45811140,
        "type": null
      }
    ],
    "clientNonce": "in",
    "color": "deserunt ipsum dolore incididunt",
    "displayName": "esse aliquip",
    "emotes": null,
    "firstMessage": false,
    "hasBits": false,
    "internal": false,
    "isAnonymous": true,
    "isCustomReward": true,
    "isFromSharedChatGuest": false,
    "isHighlighted": true,
    "isInSharedChat": true,
    "isMe": true,
    "isReply": true,
    "isTest": false,
    "message": "consectetur adipisicing pariatur nulla dolore",
    "monthsSubscribed": -7244663,
    "msgId": "nulla dolore id sunt esse",
    "reply": {
      "msgBody": null,
      "msgId": "amet sunt fugiat ut",
      "threadMsgId": "eu",
      "threadUserLogin": "dolore esse dolor tempor",
      "userId": null,
      "userLogin": null,
      "userName": "sint"
    },
    "returningChatter": true,
    "role": 0,
    "sourceBadges": null,
    "sourceMsgId": null,
    "sourceRoomId": "deserunt exercitation dolor",
    "subscriber": true,
    "subscriptionTier": "occaecat ipsum adipisicing nulla aliqua",
    "userId": "Ut et Duis dolor labore",
    "username": null
  },
  "messageId": "do sint aliqua fugiat",
  "meta": null,
  "parts": [
    {
      "text": "dolore ea ullamco ad",
      "type": "deserunt proident non"
    },
    {
      "text": null,
      "type": "deserunt"
    },
    {
      "text": null,
      "type": null
    },
    {
      "text": null,
      "type": "in elit"
    },
    {
      "text": "pariatur proident anim eu",
      "type": null
    }
  ],
  "reply": {
    "msgBody": "ad voluptate minim",
    "msgId": "commodo laborum culpa",
    "threadMsgId": null,
    "threadUserLogin": null,
    "userId": null,
    "userLogin": null,
    "userName": null
  },
  "sharedChatSource": null,
  "text": "Ut quis",
  "user": {
    "badges": null,
    "color": "aute",
    "id": null,
    "login": "ut Duis veniam adipisicing",
    "monthsSubscribed": -11523288,
    "name": null,
    "role": 1,
    "subscribed": true,
    "subscriptionTier": "nulla in eiusmod laborum veniam",
    "type": "occaecat culpa anim dolor qui"
  }
}

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