YouTube.Message

WebSocket event schema, payload, and examples
The properties defined in the event schema, with descriptions.
broadcast
object required
emotes
Emote[]
eventId
string
isTest
boolean required
message
string
meta
object required
parts
array
publishedAt
string required
user
object required
The JSON Schema for the event payload, if available.
schema.json
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "YouTubeMessageEvent",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "message": {
      "type": [
        "null",
        "string"
      ]
    },
    "meta": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/YouTubeMessageMetaData"
        }
      ]
    },
    "emotes": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/Emote"
      }
    },
    "parts": {
      "type": [
        "array",
        "null"
      ],
      "items": {}
    },
    "user": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/YouTubeBaseUser"
        }
      ]
    },
    "eventId": {
      "type": [
        "null",
        "string"
      ]
    },
    "publishedAt": {
      "type": "string"
    },
    "broadcast": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/YouTubeBroadcastWebsocketData"
        }
      ]
    },
    "isTest": {
      "type": "boolean"
    }
  },
  "$defs": {
    "YouTubeMessageMetaData": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "internal": {
          "type": "boolean"
        },
        "FirstMessage": {
          "type": "boolean"
        },
        "FirstMessageTimestamp": {
          "type": [
            "null",
            "string"
          ]
        },
        "ReturningChatter": {
          "type": "boolean"
        }
      }
    },
    "Emote": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": [
            "null",
            "string"
          ]
        },
        "name": {
          "type": [
            "null",
            "string"
          ]
        },
        "imageUrl": {
          "type": [
            "null",
            "string"
          ]
        },
        "startIndex": {
          "type": "integer"
        },
        "endIndex": {
          "type": "integer"
        }
      }
    },
    "YouTubeMessagePartText": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": [
            "null",
            "string"
          ]
        },
        "text": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    },
    "YouTubeMessagePartEmote": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string"
        },
        "text": {
          "type": [
            "null",
            "string"
          ]
        },
        "source": {
          "type": [
            "null",
            "string"
          ]
        },
        "imageUrl": {
          "type": [
            "null",
            "string"
          ]
        },
        "zeroWidth": {
          "type": "boolean"
        }
      }
    },
    "YouTubeBaseUser": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": [
            "null",
            "string"
          ]
        },
        "login": {
          "type": [
            "null",
            "string"
          ]
        },
        "name": {
          "type": [
            "null",
            "string"
          ]
        },
        "type": {
          "type": "string"
        },
        "url": {
          "type": [
            "null",
            "string"
          ]
        },
        "profileImageUrl": {
          "type": [
            "null",
            "string"
          ]
        },
        "isOwner": {
          "type": "boolean"
        },
        "isModerator": {
          "type": "boolean"
        },
        "isSponsor": {
          "type": "boolean"
        },
        "isVerified": {
          "type": "boolean"
        }
      }
    },
    "YouTubeBroadcastWebsocketData": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": [
            "null",
            "string"
          ]
        },
        "channelId": {
          "type": [
            "null",
            "string"
          ]
        },
        "liveChatId": {
          "type": [
            "null",
            "string"
          ]
        },
        "title": {
          "type": [
            "null",
            "string"
          ]
        },
        "description": {
          "type": [
            "null",
            "string"
          ]
        },
        "categoryId": {
          "type": [
            "null",
            "string"
          ]
        },
        "privacy": {
          "type": [
            "null",
            "string"
          ]
        },
        "publishedAt": {
          "type": "string"
        },
        "scheduledStartTime": {
          "type": "string"
        },
        "scheduledEndTime": {
          "type": "string"
        },
        "actualStartTime": {
          "type": "string"
        },
        "actualEndTime": {
          "type": "string"
        },
        "tags": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "defaultLanguage": {
          "type": [
            "null",
            "string"
          ]
        },
        "defaultAudioLanguage": {
          "type": [
            "null",
            "string"
          ]
        },
        "status": {
          "type": [
            "null",
            "string"
          ]
        }
      }
    }
  }
}
An example JSON payload for the event, automatically generated using JSONSchemaFaker
example.json
{
  "message": null,
  "meta": null,
  "emotes": null,
  "parts": [
    true,
    {},
    false,
    -357.6181079261005,
    "rysR65uf"
  ],
  "user": {},
  "eventId": "oy50",
  "publishedAt": "Qj",
  "broadcast": {},
  "isTest": true
}
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 "YouTube.Message" events and register a callback
client.on('YouTube.Message', ({ 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);
});