Skip to content

YouTube script functions

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

youtube.addModerator

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

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

Gives back: Nothing.

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

youtube.addTags

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

Value What to put in
tags The tags to add, as a list like ["gaming", "chill"] or as text with commas, like "gaming, chill".
broadcastId 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.

var answer = await Cb.Call("youtube.addTags", new { tags = new[] { "gaming", "chill" } });
answer = cb.call("youtube.addTags", 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 What to put in
user The viewer: their channel id (starts with UC), their @handle, or the name of someone who chatted recently.
broadcastId Optional. The id of a monitored broadcast. Leave it out for your latest live broadcast.

Gives back: Nothing.

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

youtube.clearTags

Removes every tag from your YouTube broadcast.

Value What to put in
broadcastId 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).

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

youtube.createPoll

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

Value What to put in
question The question, like "Which game next?"
options The answers, as a list like ["Minecraft", "Fortnite"] or as text with commas.
broadcastId 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.

var answer = await Cb.Call("youtube.createPoll", new { question = "Which game next?", options = new[] { "Minecraft", "Fortnite", "Tetris" } });
answer = cb.call("youtube.createPoll", 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 What to put in
messageId The id of the chat message, like the %messageId% of a chat trigger.

Gives back: Nothing.

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

youtube.endPoll

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

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

Gives back: Nothing.

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

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.

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

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.

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

youtube.getChannelInfo

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

Value What to put in
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.

var answer = await Cb.Call("youtube.getChannelInfo", new { user = "@CoolStreamer" });
answer = cb.call("youtube.getChannelInfo", 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.

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

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.

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

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).

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

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 What to put in
videoId 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.

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

youtube.removeModerator

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

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

Gives back: Nothing.

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

youtube.removeTags

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

Value What to put in
tags The tags to remove, as a list like ["chill"] or as text with commas.
broadcastId 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.

var answer = await Cb.Call("youtube.removeTags", new { tags = new[] { "chill" } });
answer = cb.call("youtube.removeTags", 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 What to put in
message What to say, like "Welcome to the stream!"
useBot Optional. true sends it with your bot account. Leave it out to send as yourself.
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 Optional. The id of a monitored broadcast. Leave it out for your latest live broadcast.

Gives back: Nothing.

var answer = await Cb.Call("youtube.sendMessage", new { message = "Welcome to the stream!" });
answer = cb.call("youtube.sendMessage", 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 What to put in
message What to say, like "Welcome to the stream!"
useBot Optional. true sends it with your bot account. Leave it out to send as yourself.
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.

var answer = await Cb.Call("youtube.sendMessageToLatestMonitored", new { message = "Welcome to the stream!" });
answer = cb.call("youtube.sendMessageToLatestMonitored", 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 What to put in
categoryId The category id, like "20" (Gaming) or "22" (People & Blogs).
broadcastId Optional. The video id of the broadcast to change. Leave it out for your live broadcast (or the next upcoming one).

Gives back: Nothing.

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

youtube.setDescription

Changes the description of your YouTube broadcast.

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

Gives back: Nothing.

var answer = await Cb.Call("youtube.setDescription", new { description = "Playing with chat tonight!" });
answer = cb.call("youtube.setDescription", 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 What to put in
title Optional. The new title. Leave it out (or empty) to keep it.
description Optional. The new description. Leave it out to keep it.
broadcastId Optional. The video id of the broadcast to change. Leave it out for your live broadcast (or the next upcoming one).

Gives back: Nothing.

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

youtube.setPrivacy

Changes who can see your YouTube broadcast.

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

Gives back: Nothing.

var answer = await Cb.Call("youtube.setPrivacy", new { privacy = "unlisted" });
answer = cb.call("youtube.setPrivacy", 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 What to put in
title The new title, like "Chill games with chat".
broadcastId Optional. The video id of the broadcast to change. Leave it out for your live broadcast (or the next upcoming one).

Gives back: Nothing.

var answer = await Cb.Call("youtube.setTitle", new { title = "Chill games with chat" });
answer = cb.call("youtube.setTitle", 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 What to put in
user The viewer: their channel id (starts with UC), their @handle, or the name of someone who chatted recently.
duration Optional. How long, in seconds, like 300. Leave it out for 300 (5 minutes).
broadcastId Optional. The id of a monitored broadcast. Leave it out for your latest live broadcast.

Gives back: Nothing.

var answer = await Cb.Call("youtube.timeoutUser", new { user = "@CoolViewer42", duration = 300 });
answer = cb.call("youtube.timeoutUser", 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 What to put in
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.

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