I have a youtube video uploaded on my channel with visibility as a "Private". I want to automatically invite people (logged in on Youtube with their respective email address) I specify on google apps script, so they can watch it. I have enabled the Youtube Api on Google Console and the Youtube API3 service on GAS. I tried with the code below, but without success:
function invitePeopleToVideo() { // 'Script_API_KEY' var apiKey = 'Script_API_KEY'; // 'PRIVATE_VIDEO_ID' var videoId = 'PRIVATE_VIDEO_ID'; // Google users to be invited var emailAddresses = ['EMAIL_1', 'EMAIL_2']; for (var i = 0; i < emailAddresses.length; i++) { inviteUser(apiKey, videoId, emailAddresses[i]); }}function inviteUser(apiKey, videoId, emailAddress) { var apiUrl = 'https://www.googleapis.com/youtube/v3/activities'; var payload = {'part': 'snippet,contentDetails','key': apiKey,'maxResults': 1,'fields': 'items(snippet/channelId)','q': 'video '+ videoId, }; var response = UrlFetchApp.fetch(apiUrl, {'method': 'get','payload': payload, }); var responseData = JSON.parse(response.getContentText()); var channelId = responseData.items[0].snippet.channelId; // Now you have the channelId, and you can use it to send invitations sendInvitation(channelId, emailAddress);}function sendInvitation(channelId, emailAddress) { // Implement the logic to send invitations using the obtained channelId and email address // This may involve additional API requests or other methods // Remember to handle errors and authentication properly}Is it possible this, and if Yes, please help!