Method: liveChatMessages.insert

Adds a text message or a poll to a live chat.

Provide a liveChatMessage resource in the request body with these required properties:

  • snippet.liveChatId: The live chat ID for the target broadcast.
  • snippet.type: Either textMessageEvent or pollEvent.
  • For textMessageEvent, include snippet.textMessageDetails.messageText.
  • For pollEvent (requires channel owner or content manager authorization, with at most one active poll per chat), include snippet.pollDetails.metadata with:
    • questionText: Poll question text (up to 100 characters).
    • options: Between 2 and 4 items displayed in the order listed, each setting optionText (up to 35 characters). Do not set tally or snippet.pollDetails.status.

For method-specific error responses, see liveChatMessages.insert errors. For code examples, see liveChatMessages.insert code snippets.

HTTP request

POST https://youtube.googleapis.com/youtube/v3/liveChat/messages

The URL uses gRPC Transcoding syntax.

Query parameters

Parameters
part[]

string

Required. Specifies the properties that the write operation sets and the resource parts that the API response includes. This parameter must include snippet, and can also include id and authorDetails.

Request body

The request body contains an instance of LiveChatMessage.

Response body

If successful, the response body contains a newly created instance of LiveChatMessage.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/youtube
  • https://www.googleapis.com/auth/youtube.force-ssl

For more information, see the OAuth 2.0 Overview.