Twitch.SharedChatAnnouncement
WebSocket event schema, payload, and examples
text
string
parts
TwitchMessagePartBase[]
user
TwitchUser required
source
TwitchBaseUser required
sourceMessageId
string
sourceBadges
TwitchBadge[]
messageId
string
systemMessage
string
isTest
boolean required
isInSharedChat
boolean required
isSharedChatHost
boolean required
isFromSharedChatGuest
boolean required
announcementColor
string
Schema
The JSON Schema for the event payload, if available.
schema.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "TwitchChatNotification_SharedAnnouncement",
"type": "object",
"additionalProperties": false,
"properties": {
"text": {
"type": [
"null",
"string"
]
},
"parts": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/$defs/TwitchMessagePartBase"
}
},
"user": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/$defs/TwitchUser"
}
]
},
"source": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/$defs/TwitchBaseUser"
}
]
},
"sourceMessageId": {
"type": [
"null",
"string"
]
},
"sourceBadges": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/$defs/TwitchBadge"
}
},
"messageId": {
"type": [
"null",
"string"
]
},
"systemMessage": {
"type": [
"null",
"string"
]
},
"isTest": {
"type": "boolean"
},
"isInSharedChat": {
"type": "boolean"
},
"isSharedChatHost": {
"type": "boolean"
},
"isFromSharedChatGuest": {
"type": "boolean"
},
"announcementColor": {
"type": [
"null",
"string"
]
}
},
"$defs": {
"TwitchMessagePartBase": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"type": [
"null",
"string"
]
},
"text": {
"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": "#/$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"
]
}
}
},
"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
{
"text": "bBYqKW",
"parts": [
{
"type": null,
"text": "JherZo"
},
{
"type": "MZPAQ2",
"text": null
},
{
"type": "JizoG0",
"text": "4L3xrfxeN"
},
{
"type": null,
"text": "2UWZ9dIT"
},
{
"type": "",
"text": null
}
],
"user": null,
"source": null,
"sourceMessageId": "7Z9",
"sourceBadges": [
{
"name": "0xF1a",
"version": null,
"imageUrl": "77pp0Zm7",
"info": "dkLbl69jj"
},
{
"name": "iBT",
"version": null,
"imageUrl": null,
"info": "Byqn"
},
{
"name": "dz",
"version": "eJp",
"imageUrl": "b8F8",
"info": null
},
{
"name": null,
"version": null,
"imageUrl": "",
"info": "Jw"
},
{
"name": "7hk",
"version": null,
"imageUrl": "",
"info": "Xa"
}
],
"messageId": null,
"systemMessage": null,
"isTest": false,
"isInSharedChat": true,
"isSharedChatHost": true,
"isFromSharedChatGuest": false,
"announcementColor": "RIKWoC"
}
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.SharedChatAnnouncement" events and register a callback
client.on('Twitch.SharedChatAnnouncement', ({ 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);
});
 Â