Events
Used to display incoming events.
Action event represents a single incoming message collected from one of the supported event sources. Event payload will differ depending on the event type. The full list of supported event types along with a short description can be found in the table below. That list can be extended the same as more fields can be added to interfaces.
eventTypeId | Event Type | Description |
|---|---|---|
| 1 | Discord Text | Payload can include emojis as UTF symbols and links. Mentions are provided in the text format (@username). |
| 2 | DLive Text | Payload can include emojis as UTF symbols and links in text format. Mentions are provided in the text format (@username). |
| 3 | DLive Emoji | Payload contains a link to image with DLive emoji. |
| 4 | Twitch Text | Payload can include emojis as UTF symbols and links in text format. Mentions are provided in the text format (@username). Twitch emotes are just words in text. The payload includes replaces, which point to emojis in the text. Avatar will be provided only if the user has Display avatar setting enabled. |
| 5 | YouTube Text | Payload can include emojis as UTF symbols and links in text format. Mentions are provided in the text format (@username). |
| 7 | YouTube Super Chat | Payload contains an amount which was donated and currency. Also, a text message can be added to this event. |
| 8 | YouTube Super Sticker | Payload contains an amount which was donated and currency. StickerId saved for reference, API does not provide a link to an image. Also, altText which describes sticker added to the text field. |
| 11 | Facebook (Personal profile) Text | Payload can include emojis as UTF symbols and links and mentions in text format. Sometimes Facebook can omit information about the author, so fields inside author are optional. parent field, if present, contains the name of the author of the comment to which this comment was sent as a reply. |
| 12 | Facebook (Personal profile) Sticker | Extended payload of the Facebook (Personal profile) Text event. link has a URL of sticker image. |
| 13 | Facebook (Public page) Text | Payload can include emojis as UTF symbols and links and mentions in text format. Sometimes Facebook can omit information about the author, so fields inside author are optional. parent field, if present, contains the name of the author of the comment to which this comment was sent as a reply. |
| 14 | Facebook (Public page) Sticker | Extended payload of the Facebook (Public page) Text event. link has a URL of sticker image. |
| 21 | LinkedIn Text | It can include emojis as UTF symbols and links and mentions in text format. The author can be retrieved only for users who allows getting such information, so this field is optional. |
| 22 | Trovo Text | It can include emojis as UTF symbols and links and mentions in text format. The author can be retrieved only for users who allows getting such information, so this field is optional. |
| 23 | YouTube Member Milestone | Channel members can send one special highlighted message per month in live chat to recognize and celebrate how long they've been a member. This feature is available to members who are in, at least, their 2nd consecutive month as a member. Messages can only be sent during live streams or Premieres, and are visible to all viewers. |
| 24 | X Text | X text message. It can include emojis as UTF symbols and links in text format. Mentions are provided in the text format (@username). |
| 25 | Kick Text | Kick text message from live chat. Includes author information with user ID and username. Supports custom emotes through the replaces array for emote substitution. Can include emojis as UTF symbols and links in text format. The optional parent field contains the name of the author being replied to |
| 26 | Kick Subscription | Kick subscription event triggered when a user subscribes to a channel. Includes the subscriber's username and optionally the subscription duration in months (subscribedFor). For gifted subscriptions, includes an array of recipient usernames in giftedTo |
| 28 | YouTube Membership | YouTube Membership: includes new sponsors and gifted subscriptions |
| 29 | YouTube Membership Gifting | YouTube Membership Gifting: someone gifted membership to other users |
| 32 | Rumble Text | Rumble text message from live chat. Includes author information with display name and optional avatar. Supports custom emotes through the replaces array, which provides image URLs and positions for emote substitution in the text. Can include emojis as UTF symbols and links in text format |
You can use connectionIdentifier to associate an event with the connection from which it received.
You can't use eventIdentifier to uniquely identify events.
Each event has enough information to render it the same way it shown in Restream chat. If event has some attachments (stickers for example) payload will contain all data so no additional requests need to be made in order to display event content.
Emojis and Replaces
Emojis provided as UTF-8 symbols, so it's your decision about how to render them (Links processing and display is your choice as well.). In cases when event source has a support for custom emojis, replaces will be included into event payload. replaces is an array of objects with required from, to and type fields, where from is a position in the event text from which you should start the replacement and to is a position of replacement end. Replaces provided in reverse order so you can just iterate over them and replace directly in the text and don't worry about replacement position change.
All images used for attachments are stored on event source side. So Restream can't guaranty that all of them will be accessible all the time.
TypeScript Interfaces
TypeScript syntax, new actions and fields may be added over time
interface IEventTypePayloadBasic {}
interface IEventTypePayloadDiscordText extends IEventTypePayloadBasic {
author: {
avatar: string | null;
discriminator: string;
id: string;
name: string;
nickname: string | null;
nicknameColor: string | null;
roles: Array<{
color: string;
name: string;
}> | null;
};
bot: boolean;
text: string;
}
interface IEventTypePayloadDLiveText extends IEventTypePayloadBasic {
author: {
avatar: string;
badges: string[];
name: string;
partnerStatus: string;
role: string;
roomRole: string;
subscribing: boolean;
username: string;
};
bot: boolean;
text: string;
}
interface IEventTypePayloadDLiveEmoji extends IEventTypePayloadBasic {
author: {
avatar: string;
badges: string[];
name: string;
partnerStatus: string;
role: string;
roomRole: string;
subscribing: boolean;
username: string;
};
bot: boolean;
link: string;
}
interface IEventTypePayloadTwitchText extends IEventTypePayloadBasic {
author: {
avatar: string | null;
badges: Array<{
title: string;
imageUrl: string;
clickUrl: string | null;
}>;
// color of the nickname and `/me` messages
color: string | null;
displayName: string | null;
id: string;
name: string;
subscribedFor: number | null;
username: string;
};
// message created by bot
bot: boolean;
contentModifiers: {
me: boolean;
whisper: boolean;
};
firstMessage: boolean;
replaces: Array<{
from: number;
to: number;
type: 'imageUrl';
payload: {
url: string;
};
}>;
repliedInThread: {
displayName: string;
twitchMessageId: string;
twitchUserId: string;
} | null;
repliedTo: {
displayName: string;
twitchMessageId: string;
twitchUserId: string;
} | null;
text: string;
twitchMessageId: string | null;
}
interface IEventTypePayloadYouTubeText extends IEventTypePayloadBasic {
author: {
id: string;
avatar: string;
displayName: string;
isChatModerator: boolean;
isChatOwner: boolean;
isChatSponsor: boolean;
isVerified: boolean;
};
bot: boolean;
liveChatMessageId: string;
text: string;
}
interface IEventTypePayloadYouTubeSuperChat extends IEventTypePayloadBasic {
author: {
id: string;
avatar: string;
displayName: string;
isChatModerator: boolean;
isChatOwner: boolean;
isChatSponsor: boolean;
isVerified: boolean;
};
bot: false;
donation: {
amount: string;
currencyString: string;
tier: number;
};
liveChatMessageId: string;
text: string;
}
interface IEventTypePayloadYouTubeSuperSticker extends IEventTypePayloadBasic {
author: {
id: string;
avatar: string;
displayName: string;
isChatModerator: boolean;
isChatOwner: boolean;
isChatSponsor: boolean;
isVerified: boolean;
};
bot: boolean;
donation: {
amount: string;
currencyString: string;
stickerId: string;
tier: number;
};
liveChatMessageId: string;
text: string;
}
interface IEventTypePayloadFacebookPersonalText extends IEventTypePayloadBasic {
author: {
id?: string;
name?: string;
picture?: string;
};
bot: false;
parent?: {
name?: string;
};
text: string;
}
interface IEventTypePayloadFacebookPersonalSticker extends IEventTypePayloadBasic {
author: {
id?: string;
name?: string;
picture?: string;
};
bot: false;
parent?: {
name?: string;
};
link: string;
text: string;
}
interface IEventTypePayloadFacebookPageText extends IEventTypePayloadBasic {
author: {
id?: string;
name?: string;
picture?: string;
};
bot: false;
parent?: {
name?: string;
};
text: string;
}
interface IEventTypePayloadFacebookPageSticker extends IEventTypePayloadBasic {
author: {
id?: string;
name?: string;
picture?: string;
};
bot: false;
parent?: {
name?: string;
};
link: string;
text: string;
}
interface IEventTypePayloadLinkedInText extends IEventTypePayloadBasic {
author?: {
avatarUrl?: string;
name: string;
};
bot: false;
text: string;
}
interface IEventTypePayloadTrovoText extends IEventTypePayloadBasic {
author?: {
avatarUrl?: string;
name: string;
};
bot: false;
text: string;
replaces: Array<{
from: number;
payload: {
url: string;
};
to: number;
type: 'imageUrl' | string;
}>;
}
interface IEventTypePayloadYouTubeMemberMilestone extends IEventTypePayloadBasic {
author: {
id: string;
avatar: string;
displayName: string;
isChatModerator: boolean;
isChatOwner: boolean;
isChatSponsor: boolean;
isVerified: boolean;
};
bot: false;
liveChatMessageId: string;
memberMilestone: {
memberMonth: number;
memberLevelName?: string;
};
text: string;
}
interface IEventTypePayloadXplatformText extends IEventTypePayloadBasic {
author: {
id: string;
avatar?: string;
displayName: string;
username: string;
verified: boolean;
};
text: string;
}
interface IEventTypePayloadKickText extends IEventTypePayloadBasic {
author: {
id: number;
username: string;
};
parent?: {
name: string;
};
bot: boolean;
replaces: Array<{
from: number;
payload: {
url: string;
};
to: number;
type: 'imageUrl' | string;
}>;
text: string;
}
interface IEventTypePayloadKickSubscription extends IEventTypePayloadBasic {
author: {
username: string;
};
subscribedFor?: number;
giftedTo?: string[];
}
interface IEventTypePayloadYouTubeMembership extends IEventTypePayloadBasic {
author: {
id: string;
avatar: string;
displayName: string;
isChatModerator: boolean;
isChatOwner: boolean;
isChatSponsor: boolean;
isVerified: boolean;
};
bot: false;
liveChatMessageId: string;
membership: {
gift: boolean;
memberLevelName: string;
};
text: string;
}
interface IEventTypePayloadYouTubeMembershipGifting extends IEventTypePayloadBasic {
author: {
id: string;
avatar: string;
displayName: string;
isChatModerator: boolean;
isChatOwner: boolean;
isChatSponsor: boolean;
isVerified: boolean;
};
bot: false;
giftMemberships: {
count: number;
levelName: string;
};
liveChatMessageId: string;
text: string;
}
interface IEventTypePayloadRumbleText extends IEventTypePayloadBasic {
author: {
avatar?: string;
displayName: string;
id: string;
name: string;
};
bot: false;
replaces: Array<{
from: number;
payload: {
url: string;
};
to: number;
type: 'imageUrl' | string;
}>;
text: string;
}