Skip to content

Reference Script Functions Youtube

Kristopher Barrantes edited this page Nov 5, 2026 · 3 revisions

YouTube script functions

Also on the Cuebot Docs site.

Functions for C# (Cb.Call) and Python (a cb method each, or cb.call). See Script functions for how to use them.

A Run Python code step in the action editor

youtube.addModerator

Makes a viewer a moderator of your live YouTube chat. Fails when YouTube is not connected or you are not live.

Value In Python What to put in
user user The viewer: their channel id (starts with UC), their @handle, or the name of someone who chatted recently.
broadcastId broadcast_id Optional. The id of a monitored broadcast. Leave it out for your latest live broadcast.

Gives back: Nothing.

C#

var answer = await Cb.Call("youtube.addModerator", new { user = "@CoolViewer42" });

Python

answer = cb.youtube_add_moderator(user="@CoolViewer42")

youtube.addTags

Adds tags to your YouTube broadcast. Tags it already has are kept, and doubles are skipped.

Value In Python What to put in
tags tags The tags to add, as a list like ["gaming", "chill"] or as text with commas, like "gaming, chill".
broadcastId broadcast_id Optional. The video id of the broadcast to change. Leave it out for your live broadcast (or the next upcoming one).

Gives back: The full list of tags the video has now.

C#

var answer = await Cb.Call("youtube.addTags", new { tags = new[] { "gaming", "chill" } });

Python

answer = cb.youtube_add_tags(tags=["gaming", "chill"])

youtube.banUser

Bans a viewer from your live YouTube chat for good. Fails when YouTube is not connected or you are not live.

Value In Python What to put in
user user The viewer: their channel id (starts with UC), their @handle, or the name of someone who chatted recently.
broadcastId broadcast_id Optional. The id of a monitored broadcast. Leave it out for your latest live broadcast.

Gives back: Nothing.

C#

var answer = await Cb.Call("youtube.banUser", new { user = "@CoolViewer42" });

Python

answer = cb.youtube_ban_user(user="@CoolViewer42")

youtube.clearTags

Removes every tag from your YouTube broadcast.

Value In Python What to put in
broadcastId broadcast_id Optional. The video id of the broadcast to change. Leave it out for your live broadcast (or the next upcoming one).

Gives back: The list of tags the video has now (empty).

C#

var answer = await Cb.Call("youtube.clearTags");

Python

answer = cb.youtube_clear_tags()

youtube.createPoll

Starts a poll in your live YouTube chat. It needs a question and 2 to 4 options.

Value In Python What to put in
question question The question, like "Which game next?"
options options The answers, as a list like ["Minecraft", "Fortnite"] or as text with commas.
broadcastId broadcast_id Optional. The id of a monitored broadcast. Leave it out for your latest live broadcast.

Gives back: The id of the poll message. You can give it to youtube.endPoll.

C#

var answer = await Cb.Call("youtube.createPoll", new { question = "Which game next?", options = new[] { "Minecraft", "Fortnite", "Tetris" } });

Python

answer = cb.youtube_create_poll(question="Which game next?", options=["Minecraft", "Fortnite", "Tetris"])

youtube.deleteMessage

Deletes one message from your YouTube chat. Fails when YouTube is not connected or the id is empty.

Value In Python What to put in
messageId message_id The id of the chat message, like the %messageId% of a chat trigger.

Gives back: Nothing.

C#

var answer = await Cb.Call("youtube.deleteMessage", new { messageId = "LCC.abc123" });

Python

answer = cb.youtube_delete_message(message_id="LCC.abc123")

youtube.endPoll

Ends a YouTube chat poll. Fails when there is no active poll.

Value In Python What to put in
pollMessageId poll_message_id Optional. The poll id from youtube.createPoll. Leave it out for the poll Cuebot started last.

Gives back: Nothing.

C#

var answer = await Cb.Call("youtube.endPoll");

Python

answer = cb.youtube_end_poll()

youtube.getBot

Gives you the details of your YouTube bot account, as set on the YouTube page.

Gives back: An object with userName, userId, customUrl, profileImageUrl and isSignedIn.

C#

var answer = await Cb.Call("youtube.getBot");

Python

answer = cb.youtube_get_bot()

youtube.getBroadcaster

Gives you the details of your own YouTube account, as set on the YouTube page.

Gives back: An object with userName, userId, customUrl, profileImageUrl and isSignedIn.

C#

var answer = await Cb.Call("youtube.getBroadcaster");

Python

answer = cb.youtube_get_broadcaster()

youtube.getChannelInfo

Looks up a YouTube channel. Fails when you are not signed in or the channel cannot be found.

Value In Python What to put in
user user The viewer: their channel id (starts with UC), their @handle, or the name of someone who chatted recently.

Gives back: An object with id, title, description, customUrl, url, profileImageUrl, subscriberCount, subscriberCountHidden, videoCount, viewCount and createdAt.

C#

var answer = await Cb.Call("youtube.getChannelInfo", new { user = "@CoolStreamer" });

Python

answer = cb.youtube_get_channel_info(user="@CoolStreamer")

youtube.getLatestMonitoredBroadcast

Gives you the newest live broadcast Cuebot is watching.

Gives back: The broadcast with id, title, description, privacy, status, liveChatId, url, actualStart, actualEnd, scheduledStart, channelId and thumbnailUrl. null when none is being watched.

C#

var answer = await Cb.Call("youtube.getLatestMonitoredBroadcast");

Python

answer = cb.youtube_get_latest_monitored_broadcast()

youtube.getMonitoredBroadcasts

Lists every live broadcast Cuebot is watching right now.

Gives back: A list of broadcasts, each with id, title, description, privacy, status, liveChatId, url, actualStart, actualEnd, scheduledStart, channelId and thumbnailUrl. Empty when there are none.

C#

var answer = await Cb.Call("youtube.getMonitoredBroadcasts");

Python

answer = cb.youtube_get_monitored_broadcasts()

youtube.getQuota

Shows how much of your daily YouTube allowance (quota) Cuebot has used. YouTube limits how many requests you can make per day.

Gives back: An object with used (units used today, an estimate), dailyQuota, exhausted (true when none is left) and resetsAt (when it starts over).

C#

var answer = await Cb.Call("youtube.getQuota");

Python

answer = cb.youtube_get_quota()

youtube.getVideoInfo

Looks up a YouTube video, with live numbers like viewers and likes. Fails when you are not signed in or the video cannot be found.

Value In Python What to put in
videoId video_id Optional. The video id, like "dQw4w9WgXcQ". Leave it out for your live broadcast (or the next upcoming one).

Gives back: An object with id, title, description, url, channelId, channelTitle, categoryId, tags, privacy, liveStatus, thumbnail, concurrentViewers, viewCount, likeCount, commentCount, actualStart and actualEnd.

C#

var answer = await Cb.Call("youtube.getVideoInfo");

Python

answer = cb.youtube_get_video_info()

youtube.removeModerator

Takes moderator away from a viewer in your live YouTube chat. Fails when they are not a moderator.

Value In Python What to put in
user user The viewer: their channel id (starts with UC), their @handle, or the name of someone who chatted recently.
broadcastId broadcast_id Optional. The id of a monitored broadcast. Leave it out for your latest live broadcast.

Gives back: Nothing.

C#

var answer = await Cb.Call("youtube.removeModerator", new { user = "@CoolViewer42" });

Python

answer = cb.youtube_remove_moderator(user="@CoolViewer42")

youtube.removeTags

Removes some tags from your YouTube broadcast. Upper or lower case does not matter.

Value In Python What to put in
tags tags The tags to remove, as a list like ["chill"] or as text with commas.
broadcastId broadcast_id Optional. The video id of the broadcast to change. Leave it out for your live broadcast (or the next upcoming one).

Gives back: The full list of tags the video has now.

C#

var answer = await Cb.Call("youtube.removeTags", new { tags = new[] { "chill" } });

Python

answer = cb.youtube_remove_tags(tags=["chill"])

youtube.sendMessage

Sends a message in your live YouTube chat. Text over 200 characters is split. Fails when YouTube is not connected or you are not live.

Value In Python What to put in
message message What to say, like "Welcome to the stream!"
useBot use_bot Optional. true sends it with your bot account. Leave it out to send as yourself.
fallback fallback Optional. With useBot, true (the default) sends as yourself when the bot is not signed in or fails; false makes it fail instead.
broadcastId broadcast_id Optional. The id of a monitored broadcast. Leave it out for your latest live broadcast.

Gives back: Nothing.

C#

var answer = await Cb.Call("youtube.sendMessage", new { message = "Welcome to the stream!" });

Python

answer = cb.youtube_send_message(message="Welcome to the stream!")

youtube.sendMessageToLatestMonitored

Sends a message in the chat of your newest live YouTube broadcast. Text over 200 characters is split. Fails when you are not live.

Value In Python What to put in
message message What to say, like "Welcome to the stream!"
useBot use_bot Optional. true sends it with your bot account. Leave it out to send as yourself.
fallback fallback Optional. With useBot, true (the default) sends as yourself when the bot is not signed in or fails; false makes it fail instead.

Gives back: Nothing.

C#

var answer = await Cb.Call("youtube.sendMessageToLatestMonitored", new { message = "Welcome to the stream!" });

Python

answer = cb.youtube_send_message_to_latest_monitored(message="Welcome to the stream!")

youtube.setCategory

Changes the category of your YouTube broadcast. YouTube uses number ids for categories, like "20" for Gaming.

Value In Python What to put in
categoryId category_id The category id, like "20" (Gaming) or "22" (People & Blogs).
broadcastId broadcast_id Optional. The video id of the broadcast to change. Leave it out for your live broadcast (or the next upcoming one).

Gives back: Nothing.

C#

var answer = await Cb.Call("youtube.setCategory", new { categoryId = "20" });

Python

answer = cb.youtube_set_category(category_id="20")

youtube.setDescription

Changes the description of your YouTube broadcast.

Value In Python What to put in
description description The new description, like "Playing with chat tonight!"
broadcastId broadcast_id Optional. The video id of the broadcast to change. Leave it out for your live broadcast (or the next upcoming one).

Gives back: Nothing.

C#

var answer = await Cb.Call("youtube.setDescription", new { description = "Playing with chat tonight!" });

Python

answer = cb.youtube_set_description(description="Playing with chat tonight!")

youtube.setMetadata

Changes the title, the description, or both, of your YouTube broadcast in one go. What you leave out stays as it is.

Value In Python What to put in
title title Optional. The new title. Leave it out (or empty) to keep it.
description description Optional. The new description. Leave it out to keep it.
broadcastId broadcast_id Optional. The video id of the broadcast to change. Leave it out for your live broadcast (or the next upcoming one).

Gives back: Nothing.

C#

var answer = await Cb.Call("youtube.setMetadata", new { title = "Chill games with chat", description = "Playing with chat tonight!" });

Python

answer = cb.youtube_set_metadata(title="Chill games with chat", description="Playing with chat tonight!")

youtube.setPrivacy

Changes who can see your YouTube broadcast.

Value In Python What to put in
privacy privacy "public" (everyone), "unlisted" (only people with the link) or "private" (only you).
broadcastId broadcast_id Optional. The video id of the broadcast to change. Leave it out for your live broadcast (or the next upcoming one).

Gives back: Nothing.

C#

var answer = await Cb.Call("youtube.setPrivacy", new { privacy = "unlisted" });

Python

answer = cb.youtube_set_privacy(privacy="unlisted")

youtube.setTitle

Changes the title of your YouTube broadcast. Fails when you are not signed in or there is no live or upcoming broadcast.

Value In Python What to put in
title title The new title, like "Chill games with chat".
broadcastId broadcast_id Optional. The video id of the broadcast to change. Leave it out for your live broadcast (or the next upcoming one).

Gives back: Nothing.

C#

var answer = await Cb.Call("youtube.setTitle", new { title = "Chill games with chat" });

Python

answer = cb.youtube_set_title(title="Chill games with chat")

youtube.timeoutUser

Times out a viewer in your live YouTube chat for some seconds. Fails when YouTube is not connected or you are not live.

Value In Python What to put in
user user The viewer: their channel id (starts with UC), their @handle, or the name of someone who chatted recently.
duration duration Optional. How long, in seconds, like 300. Leave it out for 300 (5 minutes).
broadcastId broadcast_id Optional. The id of a monitored broadcast. Leave it out for your latest live broadcast.

Gives back: Nothing.

C#

var answer = await Cb.Call("youtube.timeoutUser", new { user = "@CoolViewer42", duration = 300 });

Python

answer = cb.youtube_timeout_user(user="@CoolViewer42", duration=300)

youtube.unbanUser

Lifts a ban or timeout. YouTube only lets Cuebot undo bans it placed itself since it started; use YouTube Studio for older ones.

Value In Python What to put in
user user The viewer: their channel id (starts with UC), their @handle, or the name of someone who chatted recently.

Gives back: Nothing. Fails when Cuebot did not ban this viewer in this session.

C#

var answer = await Cb.Call("youtube.unbanUser", new { user = "@CoolViewer42" });

Python

answer = cb.youtube_unban_user(user="@CoolViewer42")

Clone this wiki locally