Skip to main content

Data Types

Live Assistant server provides many kinds of data types to the client. The client should request only the data types that it needs. To know how to send the requested, see here.

tip

To correctly request a data type, send the name in camelCase. For example, to request Audience Update data type, send audienceUpdate instead of audience-update or AudienceUpdate.

Common Fields

Timestamp

The timestamp is a Unix timestamp in milliseconds.

info

It is whether provided by the streaming platform or the time when the Live Assistant server received the data.

Position Data

All position related data use the screen coordinate system. The origin is at the top left corner of the screen. The x-axis is horizontal and the y-axis is vertical. The value is always number/double.

Shared Payloads

Some data payloads are shared between different data types:

String Content

The StringContentPayload is used to send a string with optional language, pronunciation, translation, and translation language.

type StringContentPayload = {
string: string
language?: string
pronunciation?: string
translation?: string
translationLanguage?: string
}

Image Content

The ImageContentPayload is used to send an image URL with optional data URL.

info

The data URL is only provided when the image URL has CORS restrictions. The data URL is a base64 encoded version of the image, in the format of data:[CONTENT-TYPE];base64,XXXXXXXXXXXXX...

type ImageContentPayload = {
url: string
dataUrl?: string
}

Badge

The BadgePayload represents a badge that an audience member could be wearing.

type BadgePayload = {
displayName?: StringContentPayload
level: number
image?: ImageContentPayload
color?: string
}

Audience

The AudiencePayload represents an audience who is watching the stream.

caution

This payload might not be the up to date. (For example, some streaming platforms does not provider avatar URL when a chat message is sent via API connection.) If the client wants to update the UI or database later with the latest data, it should also request audienceUpdate data type. For more information, see here.

type AudiencePayload = {
id: string
username?: StringContentPayload
avatar?: ImageContentPayload
level: number
badges: BadgePayload[]
isModerator: boolean
isMember: boolean
}

SKU

The SkuPayload represents a SKU that can be purchased.

type SkuPayload = {
id: string
displayName: StringContentPayload
image?: ImageContentPayload
amount: number
currency: string
level: number
}

Emote

The EmotePayload represents an emote that can be used in chat. It is usually displayed inline in the chat message.

The client should replace the matching emote keyword in a message with the emote image if possible.

type EmotePayload = {
id: string
keyword: string
image: ImageContentPayload
}