Resource: LiveChatMessage
A liveChatMessage resource represents a chat message in a YouTube live chat. The resource can contain details about several types of messages, such as text messages, Super Chats, Super Stickers, membership events, live polls, and virtual gifts.
Live chat is enabled by default for live broadcasts and is available while the live broadcast is active. After the broadcast ends, live chat is no longer available for that event.
| JSON representation |
|---|
{ "kind": string, "etag": string, "id": string, "snippet": { "type": enum, "liveChatId": string, "authorChannelId": string, "publishedAt": string, "hasDisplayContent": boolean, "displayMessage": string, "fanFundingEventDetails": { "amountMicros": string, "currency": string, "amountDisplayString": string, "userComment": string }, "textMessageDetails": { "messageText": string }, "userBannedDetails": { "bannedUserDetails": { "channelId": string, "channelUrl": string, "displayName": string, "profileImageUrl": string }, "banType": enum, "banDurationSeconds": string }, "superChatDetails": { "amountMicros": string, "currency": string, "amountDisplayString": string, "userComment": string, "tier": integer }, "superStickerDetails": { "amountMicros": string, "currency": string, "amountDisplayString": string, "tier": integer, "superStickerMetadata": { "stickerId": string, "altText": string, "altTextLanguage": string } }, "newSponsorDetails": { "memberLevelName": string, "isUpgrade": boolean }, "memberMilestoneChatDetails": { "memberLevelName": string, "memberMonth": integer, "userComment": string }, "membershipGiftingDetails": { "giftMembershipsCount": integer, "giftMembershipsLevelName": string }, "giftMembershipReceivedDetails": { "memberLevelName": string, "gifterChannelId": string, "associatedMembershipGiftingMessageId": string }, "pollDetails": { "metadata": { "questionText": string, "options": [ { "optionText": string, "tally": string } ] }, "status": enum }, "giftDetails": { "giftName": string, "giftDuration": string, "jewelsAmount": integer, "giftUrl": string, "altText": string, "language": string, "hasVisualEffect": boolean, "comboCount": integer } }, "authorDetails": { "channelId": string, "channelUrl": string, "displayName": string, "profileImageUrl": string, "isVerified": boolean, "isChatOwner": boolean, "isChatSponsor": boolean, "isChatModerator": boolean } } |
| Fields | |
|---|---|
kind |
Output only. Identifies what kind of resource this is. Value: the fixed string |
etag |
Output only. Etag of this resource. |
id |
Output only. The ID that YouTube assigns to uniquely identify the message. For |
snippet |
The |
snippet.type |
The type of message. This property is always present and determines the contents of the message and which fields appear in the resource.
Valid values of this enum field are:
|
snippet.liveChatId |
The ID that uniquely identifies the live chat associated with this message. The live chat ID for a broadcast appears in the liveBroadcast resource's |
snippet.authorChannelId |
Output only. The ID of the user associated with authoring this message. This field is populated based on
|
snippet.publishedAt |
Output only. The date and time when the message was originally published. The value is specified in ISO 8601 ( |
snippet.hasDisplayContent |
Output only. Whether the message has display content that should be displayed to users. |
snippet.displayMessage |
Output only. Contains a string that can be displayed to users. Omitted for silent events that have no display message, such as |
snippet.fanFundingEventDetails |
Output only. Deprecated: As of February 28, 2017, |
snippet.fanFundingEventDetails |
The amount of the fan funding contribution, in micros of the contribution currency. |
snippet.fanFundingEventDetails |
The currency in which the fan funding contribution was made. |
snippet.fanFundingEventDetails |
A rendered string that displays the contribution amount and currency to the user. |
snippet.fanFundingEventDetails |
The comment added by the user to this fan funding event. |
snippet.textMessageDetails |
Details about the text message. Only set if |
snippet.textMessageDetails.messageText |
The user's message. |
snippet.userBannedDetails |
Output only. Details about a user banned or timed out from the live chat and details about the ban. Only set if |
snippet.userBannedDetails.bannedUserDetails |
The details of the user that was banned. |
snippet.userBannedDetails.bannedUserDetails.channelId |
The YouTube channel ID. |
snippet.userBannedDetails.bannedUserDetails.channelUrl |
The channel's URL. |
snippet.userBannedDetails.bannedUserDetails.displayName |
The channel's display name. |
snippet.userBannedDetails.bannedUserDetails.profileImageUrl |
The channel's avatar URL. |
snippet.userBannedDetails.banType |
The type of ban. Valid values are Valid values of this enum field are:
|
snippet.userBannedDetails.banDurationSeconds |
The duration of the ban, in seconds. This property is only present if |
snippet.superChatDetails |
Output only. Details about the Super Chat event. Only set if |
snippet.superChatDetails.amountMicros |
The amount purchased by the user, in micros of the purchase currency (1,750,000 micros = 1.75). |
snippet.superChatDetails.currency |
The currency in which the purchase was made, specified as an ISO 4217 currency code. |
snippet.superChatDetails.amountDisplayString |
A rendered string that displays the purchase amount and currency (for example, |
snippet.superChatDetails.userComment |
The comment added by the user to this Super Chat event. |
snippet.superChatDetails.tier |
The tier for the paid message, matching the The tier is based on the purchase amount and determines the highlight color in the live chat UI, maximum message length, and ticker pin duration. Super Chat tiers are documented in the YouTube Help Center; the lowest purchase amount is tier |
snippet.superStickerDetails |
Output only. Details about the Super Sticker event. Only set if |
snippet.superStickerDetails.amountMicros |
The amount purchased by the user, in micros of the purchase currency (1,750,000 micros = 1.75). |
snippet.superStickerDetails.currency |
The currency in which the purchase was made, specified as an ISO 4217 currency code. |
snippet.superStickerDetails.amountDisplayString |
A rendered string that displays the purchase amount and currency (for example, |
snippet.superStickerDetails.tier |
The tier for the paid message, matching the The tier is based on the purchase amount and determines the highlight color in the live chat UI, maximum message length, and ticker pin duration. Super Chat tiers, which also cover Super Stickers, are documented in the YouTube Help Center; the lowest purchase amount is tier |
snippet.superStickerDetails.superStickerMetadata |
Information about the Super Sticker. |
snippet.superStickerDetails.superStickerMetadata.stickerId |
Unique identifier of the Super Sticker. This is a shorter form of The sticker image is displayed in YouTube live chat, and the image URL isn't available through the API. For reference, see the Super Sticker ID to URL mapping CSV. |
snippet.superStickerDetails.superStickerMetadata.altText |
Internationalized alt text that describes the sticker image and any animation associated with it. The |
snippet.superStickerDetails.superStickerMetadata.altTextLanguage |
Specifies the localization language in which |
snippet.newSponsorDetails |
Output only. Details about the New Member Announcement event. Only set if |
snippet.newSponsorDetails.memberLevelName |
The name of the level that the viewer joined. Level names are defined by the YouTube channel offering the membership. In some situations this field isn't filled. |
snippet.newSponsorDetails.isUpgrade |
Whether the viewer upgraded from a lower membership level. Set to |
snippet.memberMilestoneChatDetails |
Output only. Details about the Member Milestone Chat event. Only set if |
snippet.memberMilestoneChatDetails.memberLevelName |
The name of the level at which the viewer is a member. Level names are defined by the YouTube channel offering the membership. In some situations this field isn't filled. |
snippet.memberMilestoneChatDetails.memberMonth |
The total number of months (rounded up) the viewer has been a member that granted them this Member Milestone Chat. This is the same number of months displayed to YouTube users. |
snippet.memberMilestoneChatDetails.userComment |
The comment added by the member to this Member Milestone Chat. Empty for messages without a comment from the member. |
snippet.membershipGiftingDetails |
Output only. Details about the Membership Gifting event. Only set if |
snippet.membershipGiftingDetails.giftMembershipsCount |
The number of gift memberships purchased by the user. |
snippet.membershipGiftingDetails.giftMembershipsLevelName |
The name of the level of the gift memberships purchased by the user. Level names are defined by the YouTube channel offering the membership. In some situations this field isn't filled. |
snippet.giftMembershipReceivedDetails |
Output only. Details about the Gift Membership Received event. Only set if |
snippet.giftMembershipReceivedDetails.memberLevelName |
The name of the level at which the viewer is a member. This matches the In some situations this field isn't filled. |
snippet.giftMembershipReceivedDetails.gifterChannelId |
The ID of the user that made the membership gifting purchase. This matches the |
snippet.giftMembershipReceivedDetails.associatedMembershipGiftingMessageId |
The ID of the membership gifting message that is related to this gift membership. This ID refers to a message whose |
snippet.pollDetails |
Details about the poll event. Only set if |
snippet.pollDetails.metadata |
Metadata for the live poll, including the question and options. |
snippet.pollDetails.metadata.questionText |
The question text for the live poll. Maximum length is 100 characters. |
snippet.pollDetails.metadata.options[] |
The list of poll choices, returned in display order. When creating a poll, provide between 2 and 4 options. |
snippet.pollDetails.metadata.options[].optionText |
The text displayed for this poll choice. Maximum length is 35 characters. |
snippet.pollDetails.metadata.options[].tally |
Output only. The vote count for this poll option. For an active poll, present only when the request is authorized by the channel owner or a user who has voted; for a closed poll, present with the final vote count. Do not set this field when creating a poll. |
snippet.pollDetails.status |
Output only. The poll's lifecycle status: Valid values of this enum field are:
|
snippet.giftDetails |
Output only. Details about the gift event. Only set if |
snippet.giftDetails.giftName |
The name of the gift. |
snippet.giftDetails.giftDuration |
The duration to display the gift. A duration in seconds with up to nine fractional digits, ending with ' |
snippet.giftDetails.jewelsAmount |
The number of Jewels redeemed for the gift. |
snippet.giftDetails.giftUrl |
The URL of the gift asset. |
snippet.giftDetails.altText |
The alternative text to use for accessibility. |
snippet.giftDetails.language |
The BCP-47 language code of |
snippet.giftDetails.hasVisualEffect |
Whether the gift involves a visual effect. |
snippet.giftDetails.comboCount |
The number of times the gift has been sent in a row. Omitted when the gift is not part of a combo. |
authorDetails |
Output only. The |
authorDetails.channelId |
The author's YouTube channel ID. |
authorDetails.channelUrl |
The URL of the author's YouTube channel. |
authorDetails.displayName |
The display name of the author's YouTube channel. |
authorDetails.profileImageUrl |
The avatar URL of the author's YouTube channel. |
authorDetails.isVerified |
Whether the author's identity has been verified by YouTube. |
authorDetails.isChatOwner |
Whether the author is the owner of the live chat. |
authorDetails.isChatSponsor |
Whether the author is a sponsor of the live chat. |
authorDetails.isChatModerator |
Whether the author is a moderator of the live chat. |
Methods |
|
|---|---|
|
Deletes a chat message. |
|
Adds a text message or a poll to a live chat. |
|
Lists live chat messages for a specific chat. |
|
Establishes a server-streaming connection to receive live chat messages for a specific chat with low latency. |
|
Transitions the status of a live chat poll message to close an active poll. |