Connection of youtube Search

This is my workflow iam building a skillBuilder which will do things like this
user:
i want to learn an new skill

agent:
okay i can help what skill do you want to learn

user:
Photography

agent:
What level you are at (‘Beginner’, ‘Intermediate’,‘Advanced’)

user:
Beginner

agent:
Okay, Answer this 5 questions which will justify your level (the question will asked by the model and verified the user level in the spot and if it is not justified then set the level according to you)

User:
Answered all the questions,

Agent:
Now agent will evaluate the level

User:
Agent send him a tutorial video (from youtube) of 10 mins or so and then give him some questions or tasks for utilize the knowledge of the video

Agent:
Send the whole roadmap to the user and day by day tutorial video (from Youtube) and the tasks of the user

what is the issue here why i cannot access the youtube video i wanted please help me anyone to figure it out and is this write way

Hi, could you paste the workflow as code in the forum? Do you get an error or what is happening exactly or what is not happening?

1 Like

{
“nodes”: [
{
“parameters”: {
“sessionKey”: “=chat_with_{{ $(‘Listen for incoming events1’).first().json.message.chat.id }}”,
“contextWindowLength”: 10
},
“id”: “f58edc85-bc6e-4717-8904-6a4c4ef05835”,
“name”: “Window Buffer Memory1”,
“type”: “@n8n/n8n-nodes-langchain.memoryBufferWindow”,
“position”: [
-180,
160
],
“typeVersion”: 1
},
{
“parameters”: {
“chatId”: “={{ $(‘Listen for incoming events1’).first().json.message.from.id }}”,
“text”: “={{ $json.output }}”,
“additionalFields”: {
“appendAttribution”: false,
“parse_mode”: “HTML”
}
},
“id”: “673f46a0-f6b8-496b-8f73-dc69e4c54e5d”,
“name”: “Send Response1”,
“type”: “n8n-nodes-base.telegram”,
“position”: [
340,
-200
],
“typeVersion”: 1.1,
“webhookId”: “09afe851-f1a1-446a-a142-7fd93cba5505”,
“credentials”: {
“telegramApi”: {
“id”: “Hr0ZYk5jR6i7zWqu”,
“name”: “Telegram account”
}
},
“onError”: “continueErrorOutput”
},
{
“parameters”: {
“chatId”: “={{ $(‘Listen for incoming events1’).first().json.message.from.id }}”,
“text”: “={{ $(‘AI Learning Coach1’).item.json.output.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """) }}”,
“additionalFields”: {
“appendAttribution”: false,
“parse_mode”: “HTML”
}
},
“id”: “6a00a93b-01dd-44d5-940d-d36226b49137”,
“name”: “Send Error Response1”,
“type”: “n8n-nodes-base.telegram”,
“position”: [
580,
-100
],
“typeVersion”: 1.1,
“webhookId”: “28533613-f646-40b6-9017-4790a77100de”,
“credentials”: {
“telegramApi”: {
“id”: “Hr0ZYk5jR6i7zWqu”,
“name”: “Telegram account”
}
}
},
{
“parameters”: {
“updates”: [
“message”
],
“additionalFields”: {}
},
“id”: “25e4d4fc-5a7e-4212-a00c-371893e73555”,
“name”: “Listen for incoming events1”,
“type”: “n8n-nodes-base.telegramTrigger”,
“position”: [
-340,
-200
],
“webhookId”: “322dce18-f93e-4f86-b9b1-3305519b7834”,
“typeVersion”: 1,
“credentials”: {
“telegramApi”: {
“id”: “Hr0ZYk5jR6i7zWqu”,
“name”: “Telegram account”
}
}
},
{
“parameters”: {
“modelName”: “models/gemini-1.5-flash-latest”,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatGoogleGemini”,
“typeVersion”: 1,
“position”: [
-420,
140
],
“id”: “5f7ab657-3082-494f-9d99-7a7d6e89792f”,
“name”: “Google Gemini Chat Model1”,
“credentials”: {
“googlePalmApi”: {
“id”: “ztVzgiHEoGCbEHgV”,
“name”: “Google Gemini(PaLM) Api account”
}
}
},
{
“parameters”: {
“promptType”: “define”,
“text”: “={{ $json.message.text }}”,
“hasOutputParser”: true,
“options”: {
“systemMessage”: “You are a friendly and structured AI learning coach. Your job is to help people learn new skills step by step. You’re currently talking to a user named {{ $json.message.from.first_name }}. Today is {{ $now.toLocaleString() }}.\n\nYour conversation flow:\n\nStage 1: Skill and Level Identification\n1. Ask what skill the user wants to learn\n2. Ask what level they are at (Beginner, Intermediate, or Advanced)\n\nStage 2: Level Assessment\n1. Acknowledge their stated level\n2. Ask 5 relevant questions to assess their actual knowledge level\n3. Evaluate their responses and confirm or adjust their level\n\nStage 3: Initial Tutorial Video & Tasks\n1. Use the youtube_search tool to find a good tutorial video for their skill and level\n2. Share the video with them using proper HTML formatting with clickable links\n3. Give them 3-5 practical tasks related to the video\n\nStage 4: Full Learning Roadmap\n1. Create a structured daily learning plan\n2. Include topics, goals, and tasks for each day\n3. Make it motivating and easy to follow\n\nImportant Tool Usage:\n- When you need to find YouTube videos, use the youtube_search tool with a clear search query like ‘python tutorial beginner’ or ‘guitar lessons intermediate’\n- The tool will return video titles and URLs that you can share with users\n- Format video results as HTML links: <a href="VIDEO_URL">Video Title\n- Always provide the video URL and title to users\n\nFormatting Rules:\n- Use Telegram HTML formatting: bold, italic, <a href="url">links\n- Call users by their first name occasionally\n- Be encouraging and supportive\n- When sharing YouTube videos, make titles clickable links\n- Replace special characters when not part of HTML tags”
}
},
“id”: “6075f199-5a82-413a-b8bb-d796339caa2b”,
“name”: “AI Learning Coach1”,
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 1.6,
“position”: [
-100,
-200
]
},
{
“parameters”: {
“resource”: “video”,
“filters”: {
“q”: “What the Ai agent wants”
},
“options”: {}
},
“type”: “n8n-nodes-base.youTubeTool”,
“typeVersion”: 1,
“position”: [
200,
100
],
“id”: “582676eb-05e5-46cc-8699-ab7a680a155c”,
“name”: “youtube_search”,
“credentials”: {
“youTubeOAuth2Api”: {
“id”: “H0zO4PaLlw2aSpg8”,
“name”: “YouTube account 2”
}
}
}
],
“connections”: {
“Window Buffer Memory1”: {
“ai_memory”: [
[
{
“node”: “AI Learning Coach1”,
“type”: “ai_memory”,
“index”: 0
}
]
]
},
“Send Response1”: {
“main”: [
,
[
{
“node”: “Send Error Response1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Listen for incoming events1”: {
“main”: [
[
{
“node”: “AI Learning Coach1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Google Gemini Chat Model1”: {
“ai_languageModel”: [
[
{
“node”: “AI Learning Coach1”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“AI Learning Coach1”: {
“main”: [
[
{
“node”: “Send Response1”,
“type”: “main”,
“index”: 0
}
]
]
},
“youtube_search”: {
“ai_tool”: [
[
{
“node”: “AI Learning Coach1”,
“type”: “ai_tool”,
“index”: 0
}
]
]
}
},
“pinData”: {
“Listen for incoming events1”: [
{
“update_id”: 896053906,
“message”: {
“message_id”: 290,
“from”: {
“id”: 1781811970,
“is_bot”: false,
“first_name”: “Rahul”,
“last_name”: “Son Boro”,
“language_code”: “en”
},
“chat”: {
“id”: 1781811970,
“first_name”: “Rahul”,
“last_name”: “Son Boro”,
“type”: “private”
},
“date”: 1748948182,
“text”: “hi”
}
}
]
},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “56d42f1378f9595f332abc1af3a15359cbb9d45b96bb92265f23032055a65aa2”
}
}

i not able to retrieve tutorial videos from youtube

Can you take screenshots of what’s the output?

Or what you means by not able to retrieve tutorial videos from youtube

also when pasting the workflow could you please use the preformatted option in the forum?

1 Like

ok I see the problem:

You can’t reference the output like this because this is a tool and the output isn’t created yet.

first set the prompt in the agent to expression in order to use{{ $json.message.from.first_name }} and {{ $now.toLocaleString() }}


then for the tool, let AI define the parameter

the Agent will then pass the parameter according to your prompt:

  • When you need to find YouTube videos, use the youtube_search tool with a clear search query like ‘python tutorial beginner’ or ‘guitar lessons intermediate’

hope this helps

I hit my quota of youtube i’ll tell you as soon as i get back my quota

Thank you for the help sir but now i have this issue

This is the code

check the execution and see what was passed to the youtube search. Maybe update the prompt to generate a search term that is shorter.