We use WebSockets to send and receive updates to and from clients.
wss://sockets.betterttv.net/ws
join_channel
Joining a channel will subscribe you to its events, such as emote and user updates.
Field | Type | Description |
---|---|---|
name | ChannelName | The name of the channel to join. |
{
"name": "join_channel",
"data": {
"name": "{provider}:{providerId}"
}
}
part_channel
Parting a channel will unsubscribe you from its events.
Field | Type | Description |
---|---|---|
name | ChannelName | The name of the channel to join. |
{
"name": "part_channel",
"data": {
"name": "{provider}:{providerId}"
}
}
emote_create
Create events are sent when a new emote is uploaded to the subscribed channel, or when a new shared emote is added.
Field | Type | Description |
---|---|---|
emote | Emote | The emote that was created. |
channel | ChannelName | The channel that the emote was created in. |
{
"name": "emote_create",
"data": {
"emote": {
"id": "5f1b0186cf6d2144653d2970",
"code": "catJAM",
"imageType": "gif",
"animated": true,
"user": {
"id": "5f17a10cfe85fb4472d107b4",
"name": "madlittlecat",
"displayName": "MadLittleCat",
"providerId": "36646922"
}
},
"channel": "twitch:38974721"
}
}
emote_update
This event will be triggered when an emote's code is modified. In addition, this event will be emitted when a shared emote's code-alias is updated.
Field | Type | Description |
---|---|---|
emote.id | string | The ID of the emote that was updated. |
emote.code | string | The new code of the emote. |
channel | ChannelName | The channel that the emote was created in. |
{
"name": "emote_update",
"data": {
"emote": {
"id": "5f1b0186cf6d2144653d2970",
"code": "dogJAM"
},
"channel": "twitch:38974721"
}
}
emote_delete
This event will be triggered when an emote is deleted from a subscribed channel.
Field | Type | Description |
---|---|---|
emoteId | string | The ID of the emote that was deleted. |
channel | ChannelName | The channel that the emote was deleted from. |
{
"name": "emote_delete",
"data": {
"emoteId": "5f1b0186cf6d2144653d2970",
"channel": "twitch:38974721"
}
}
broadcast_me
Broadcasts your user information, if any, to other clients in the same channel. This should be sent when messages are sent by the user.
Field | Type | Description |
---|---|---|
provider | Provider | The name of the platform. |
providerId | string | Platform user Id for specified provider. |
channel | ChannelName | The channel that the emote was created in. |
{
"name": "broadcast_me",
"data": {
"provider": "twitch",
"providerId": "38974721",
"channel": "twitch:91067577"
}
}
lookup_user
Usually on channel join, this is event is triggered when a user broadcasts themselves to other clients.
Field | Type | Description |
---|---|---|
name | string | User's platform username. |
providerId | string | User's platform user id. |
channel | ChannelName | The channel the change occured in. |
pro | boolean | Whether the user is a pro subscriber. |
emotes | Emote[] | List of the user's personal emotes. |
badge?.url | string | The URL of the user badge. |
badge?.startedAt? | string | Date when user first subscribed to Pro. |
{
"name": "lookup_user",
"data": {
"name": "vasp",
"providerId": "38974721",
"channel": "twitch:91067577",
"pro": true,
"emotes": [
{
"id": "61f013ba06fd6a9f5be219f3",
"code": "COPIUM",
"imageType": "png",
"animated": false,
"user": {
"id": "5ebda868f0fb3f168c4b64e1",
"name": "dzurekk",
"displayName": "Dzurekk",
"providerId": "447870355"
}
}
],
"badge": {
"url": "https://cdn.betterttv.net/badges/pro/0b58eba8-e49c-4ed7-ae7d-be0b524502e6.png",
"startedAt": "2020-12-01T00:00:00.000Z"
}
}
}
Channel name is a concatted string, with provider
and providerId
.
{provider}:{providerId}
Field | Type | Description |
---|---|---|
provider | Provider | The name of the platform. |
providerId | string | Platform user Id for specified provider. |