Setu Recipes: reusable workflows across every app.Browse templates

Integrations / YouTube

YouTube

Search YouTube, read your channel, playlists and videos, and create playlists.

6 actions OAuth 2 5 read1 write Calls www.googleapis.com

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "youtube" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();

Permissions requested

ScopeWhy it is requested
https://www.googleapis.com/auth/userinfo.emailSee which Google account you connected
https://www.googleapis.com/auth/youtube.readonlySee your YouTube channel, playlists and video details
https://www.googleapis.com/auth/youtubeCreate playlists on your YouTube account

Actions

Create playlistwriteyoutube.create_playlistCreate a new playlist on the signed-in user's YouTube channel.

Needs scope: https://www.googleapis.com/auth/youtube

InputTypeDescription
titlestringRequiredPlaylist title
descriptionstringOptionalPlaylist description
privacy_statusstringOptionalWho can see it
TypeScript
await setu.execute({
  userId: "user_1",
  action: "youtube.create_playlist",
  input: {
    "title": "<title>"
  },
});
Get my channelreadyoutube.get_my_channelGet the signed-in user's own YouTube channel: its ID, title, subscriber and video counts, and the ID of its uploads playlist.

Needs scope: https://www.googleapis.com/auth/youtube.readonly

No input.

TypeScript
await setu.execute({
  userId: "user_1",
  action: "youtube.get_my_channel",
  input: {},
});
Get video detailsreadyoutube.get_videosGet the title, description, view and like counts and duration of one or more videos by ID.

Needs scope: https://www.googleapis.com/auth/youtube.readonly

InputTypeDescription
video_idsarray of stringRequiredVideo IDs (up to 50)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "youtube.get_videos",
  input: {
    "video_ids": []
  },
});
List my playlistsreadyoutube.list_my_playlistsList the playlists owned by the signed-in user, with their IDs and titles.

Needs scope: https://www.googleapis.com/auth/youtube.readonly

InputTypeDescription
max_resultsintegerOptionalPlaylists to return, 1 to 50 (default 5)
page_tokenstringOptionalnextPageToken from an earlier call
TypeScript
await setu.execute({
  userId: "user_1",
  action: "youtube.list_my_playlists",
  input: {},
});
List playlist itemsreadyoutube.list_playlist_itemsList the videos in a playlist. Use the uploads playlist ID from get_my_channel to list a channel's own videos.

Needs scope: https://www.googleapis.com/auth/youtube.readonly

InputTypeDescription
playlist_idstringRequiredPlaylist ID
max_resultsintegerOptionalItems to return, 1 to 50 (default 5)
page_tokenstringOptionalnextPageToken from an earlier call
TypeScript
await setu.execute({
  userId: "user_1",
  action: "youtube.list_playlist_items",
  input: {
    "playlist_id": "<playlist_id>"
  },
});
Search videosreadyoutube.search_videosSearch YouTube for videos matching a text query, optionally limited to one channel and sorted by date, rating or views.

Needs scope: https://www.googleapis.com/auth/youtube.readonly

InputTypeDescription
qstringRequiredSearch terms
max_resultsintegerOptionalResults to return, 1 to 50 (default 5)
orderstringOptionalSort order
channel_idstringOptionalOnly videos from this channel ID
page_tokenstringOptionalnextPageToken from an earlier call
TypeScript
await setu.execute({
  userId: "user_1",
  action: "youtube.search_videos",
  input: {
    "q": "<q>"
  },
});