{
  "id": "iR5Qxsd2rQKs553F",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AI-Powered YouTube Auto-Tagging Workflow (SEO Automation)",
  "tags": [
    {
      "id": "yZoudEzYFVwawRWb",
      "name": "youtube",
      "createdAt": "2025-08-26T06:37:09.894Z",
      "updatedAt": "2025-08-26T06:37:09.894Z"
    }
  ],
  "nodes": [
    {
      "id": "eeb9e588-5a0c-4f88-9816-73c7e1e084b2",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        480,
        192
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a18a582a-ba79-4e23-b39a-7e3d4f37f610",
      "name": "Youtube Video Auto Tagging Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        384,
        -32
      ],
      "parameters": {
        "text": "=Here is my YouTube video information:\n\nTitle: {{ $json.snippet.title }}\nDescription: {{ $json.snippet.description }}\nChannel Name: {{ $json.snippet.channelTitle }}\n\nPlease analyze this information and provide me with the most relevant and SEO-friendly tags (15\u201320, comma-separated). \nFocus on tags that increase reach, match viewer search intent, and balance between trending keywords and niche keywords. ",
        "options": {
          "systemMessage": "You are an expert YouTube SEO strategist. \nYour goal is to generate a list of highly relevant, diverse, and SEO-friendly tags for a YouTube video based on its title, description, and channel name. \nThe tags should:\n- Improve discoverability and ranking on YouTube search and recommendations\n- Cover both specific keywords (directly related to the video) and broader categories (general niche)\n- Include variations (short-tail and long-tail keywords)\n- Avoid duplicates, irrelevant terms, or hashtags (#)\n- Be limited to 15\u201320 tags, formatted as a clean comma-separated list\n- Prioritize high-search-intent keywords that align with the channel\u2019s theme"
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "a568f816-976c-476d-90ce-2e3833d5a53b",
      "name": "Weekly Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -496,
        -32
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "12932cab-a1c4-4703-8f3b-8acf297a50bf",
      "name": "Get all videos uploaded last week",
      "type": "n8n-nodes-base.youTube",
      "position": [
        -64,
        -32
      ],
      "parameters": {
        "filters": {
          "channelId": "={{ $json.Channel_Id }}",
          "publishedAfter": "={{ $today.minus(1,'days') }}"
        },
        "options": {
          "order": "date"
        },
        "resource": "video",
        "returnAll": true
      },
      "credentials": {
        "youTubeOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d6cabd43-deb2-40ba-bd57-fea53b848f0a",
      "name": "Get video detail",
      "type": "n8n-nodes-base.youTube",
      "position": [
        160,
        -32
      ],
      "parameters": {
        "options": {},
        "videoId": "={{ $json.id.videoId }}",
        "resource": "video",
        "operation": "get"
      },
      "credentials": {
        "youTubeOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5603be02-d036-4c04-91dc-a7f4bde972af",
      "name": "Update video with AI generated tags",
      "type": "n8n-nodes-base.youTube",
      "position": [
        784,
        -32
      ],
      "parameters": {
        "title": "={{ $('Get video detail').item.json.snippet.title }}",
        "videoId": "={{ $('Get video detail').item.json.id }}",
        "resource": "video",
        "operation": "update",
        "categoryId": "28",
        "regionCode": "VN",
        "updateFields": {
          "tags": "={{ $json.output }}",
          "description": "={{ $('Get video detail').item.json.snippet.description }}"
        }
      },
      "credentials": {
        "youTubeOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0d30ce62-5c94-40ac-83cd-e3120c941c6a",
      "name": "Inform via slack message",
      "type": "n8n-nodes-base.slack",
      "position": [
        1216,
        -144
      ],
      "parameters": {
        "text": "=The video \u201d{{ $json.snippet.title }} - {{ $json.id }}\u201d has been auto-tagged successfully with the following tags: {{ $('Youtube Video Auto Tagging Agent').item.json.output }}",
        "user": {
          "__rl": true,
          "mode": "username",
          "value": "@trung.tran"
        },
        "select": "user",
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "b443412b-03a0-4663-a6e8-72575fdafb50",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1424,
        -176
      ],
      "parameters": {
        "width": 688,
        "height": 128,
        "content": "![](https://s3.ap-southeast-1.amazonaws.com/automatewith.me/Screenshot+2025-08-26+at+1.19.18%E2%80%AFPM.png)"
      },
      "typeVersion": 1
    },
    {
      "id": "9229f95f-88f4-45e0-b5aa-5365777a68d2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        -784
      ],
      "parameters": {
        "width": 608,
        "height": 528,
        "content": "![](https://s3.ap-southeast-1.amazonaws.com/automatewith.me/Screenshot+2025-08-26+at+1.21.47%E2%80%AFPM.png)"
      },
      "typeVersion": 1
    },
    {
      "id": "baa0e76d-7a75-45df-a4c4-c7600a5b6617",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1760,
        -1136
      ],
      "parameters": {
        "width": 1072,
        "height": 2208,
        "content": "# AI-Powered YouTube Auto-Tagging Workflow (SEO Automation)\n> Supercharge your YouTube SEO with this AI-powered workflow that automatically generates and applies smart, SEO friendly tags to your new videos every week. No more manual tagging, just better discoverability, improved reach, and consistent optimization. Plus, get instant Slack notifications so your team stays updated on every video\u2019s SEO boost.\n## Who\u2019s it for\n- YouTube creators, channel admins, and marketing teams who publish regularly and want consistent, SEO-friendly tags without manual effort.  \n- Agencies managing multiple channels who need an auditable, automated tagging process with Slack notifications.\n\n## How it works / What it does\n1. **Weekly Schedule Trigger**  \n   Runs the workflow once per week.\n\n2. **Get all videos uploaded last week**  \n   Queries YouTube for videos uploaded by the channel in the past 7 days.\n\n3. **Get video detail**  \n   Retrieves each video\u2019s title, description, and ID.\n\n4. **YouTube Video Auto Tagging Agent** (LLM)  \n   - Inputs: `video.title`, `video.description`, `channelName`.  \n   - Uses a SEO-specialist system prompt to generate 15\u201320 relevant, comma-separated tags.\n\n5. **Update video with AI-generated tags**  \n   Writes the tags back to the video via YouTube Data API.\n\n6. **Inform via Slack message**  \n   Posts a confirmation message (video title + ID + tags) to a chosen Slack channel for visibility.\n\n## How to set up\n1. **YouTube connection**\n   - Create a Google Cloud project and enable **YouTube Data API v3**.\n   - Configure OAuth client (Web app / Desktop as required).\n   - Authorize with the Google account that manages the channel.\n   - In your automation platform, add the YouTube credential and grant scopes (see *Requirements*).\n\n2. **Slack connection**\n   - Create or use an existing Slack app/bot.\n   - Install to your workspace and capture the Bot Token.\n   - Add the Slack credential in your automation platform.\n\n3. **LLM / Chat Model**\n   - Select your model (e.g., OpenAI GPT).  \n   - Paste the **System Prompt** (SEO expert) and the **User Prompt** template:\n     - Inputs: `{{video_title}}`, `{{video_description}}`, `{{channel_name}}`.\n     - Output: **comma-separated list** of 15\u201320 tags (no #, no duplicates).\n\n4. **Node configuration**\n   - **Weekly Schedule Trigger:** choose day/time (e.g., Mondays 09:00 local).\n   - **Get all videos uploaded last week:** date filter = now() - 7 days.\n   - **Get video detail:** map each video ID from previous node.\n   - **Agent node:** map fields to the prompt variables.\n   - **Update video:** map the agent\u2019s tag string to the YouTube `tags` field.\n   - **Slack message:**  \n     ```\n     The video \"*{{video_title}} - {{video_id}}*\" has been auto-tagged successfully.\n     Tags: {{tags}}\n     ```\n\n5. **Test run**\n   - Manually run the workflow with one recent video.\n   - Verify the tags appear in YouTube Studio and the Slack message posts.\n\n## Requirements\n**APIs & Scopes**\n- **YouTube Data API v3**\n  - `youtube.readonly` (to list videos / details)\n  - `youtube` or `youtube.force-ssl` (to update video metadata incl. tags)\n- **Slack Bot Token Scopes**\n  - `chat:write` (post messages)\n  - `channels:read` or `groups:read` if selecting channels dynamically (optional)\n\n**Platform**\n- Access to a chat/LLM provider (e.g., OpenAI).\n- Outbound HTTPS allowed.\n\n**Rate limits & quotas**\n- YouTube updates consume quota; tag updates are write operations\u2014avoid re-writing unchanged tags.\n- Add basic throttling (e.g., 1\u20132 updates/sec) if you process many videos.\n\n## How to customize the workflow\n- **Schedule:** switch to daily, or run on publish events instead of weekly.\n- **Filtering:** process only videos matching rules (e.g., title contains \u201ctutorial\u201d, or missing tags).\n- **Prompt tuning:**  \n  - Add brand keywords to always include (e.g., \u201cWiseStack AI\u201d).  \n  - Constrain to language (e.g., \u201cVietnamese tags only\u201d).  \n  - Enforce max 500 chars total for tags if you want a stricter cap.\n- **Safety guardrails:**  \n  - Validate model output: split by comma, trim whitespace, dedupe, drop empty/over-long tags.  \n  - If the agent fails, fall back to a heuristic generator (title/keywords extraction).\n- **Change log:** write a row per update to a sheet/DB (videoId, oldTags, newTags, timestamp, runId).\n- **Human-in-the-loop:** send tags to Slack as buttons (\u201cApply / Edit / Skip\u201d) before updating YouTube.\n- **Multi-channel support:** loop through a list of channel credentials and repeat the pipeline.\n- **Notifications:** add error Slack messages for failed API calls; summarize weekly results.\n\n**Tip:** Keep a small allow/deny list (e.g., banned terms, mandatory brand terms) and run a quick sanitizer right after the agent node to maintain consistency across your channel."
      },
      "typeVersion": 1
    },
    {
      "id": "d8d08371-f68e-4de2-b6f3-85c7ff34257b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        -192
      ],
      "parameters": {
        "height": 128,
        "content": "### 1. Weekly Schedule Trigger\nThe workflow starts automatically once per week, ensuring newly uploaded videos are processed on schedule.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ac946b30-3d0a-4e47-a925-ebe4957ce05d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -336,
        160
      ],
      "parameters": {
        "height": 128,
        "content": "### 2. Get All Videos Uploaded Last Week\nFetches a list of all videos uploaded to the channel in the past 7 days."
      },
      "typeVersion": 1
    },
    {
      "id": "eb5de2fc-5469-44d1-b539-9d252f2ff08a",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -176
      ],
      "parameters": {
        "height": 112,
        "content": "### 3. Get Video Detail\nRetrieves each video\u2019s title, description, and ID to prepare for SEO tag generation.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6a37b4aa-6f5a-4038-ba78-a0a34fbd14ef",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        -224
      ],
      "parameters": {
        "content": "### 4. YouTube Video Auto Tagging Agent\nUses an AI SEO expert prompt to generate 15\u201320 relevant, comma-separated tags based on the video title, description, and channel name."
      },
      "typeVersion": 1
    },
    {
      "id": "5e5d6e85-c775-4922-ae93-aacbe6df8953",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        160
      ],
      "parameters": {
        "height": 128,
        "content": "### 5. Update Video with AI-Generated Tags\nUpdates each video in YouTube with the newly generated SEO-friendly tags.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "dc46942f-1a90-479a-8101-878490739aa1",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        -336
      ],
      "parameters": {
        "content": "### 6. Inform via Slack Message\nSends a confirmation message to Slack with the video title, ID, and the tags applied, keeping the team informed."
      },
      "typeVersion": 1
    },
    {
      "id": "29b62c5e-1ec2-4dde-a484-8c96d9a65116",
      "name": "Alternative channel to inform",
      "type": "n8n-nodes-base.telegram",
      "disabled": true,
      "position": [
        1216,
        176
      ],
      "parameters": {
        "text": "=The video \u201d{{ $json.snippet.title }} - {{ $json.id }}\u201d has been auto-tagged successfully with the following tags: {{ $('Youtube Video Auto Tagging Agent').item.json.output }}",
        "chatId": "chat_id",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6bde2db5-e5c0-487f-b2fd-150369bc1236",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        384
      ],
      "parameters": {
        "height": 80,
        "content": "(Optional) Customize this node to send message via Telegram, in case you're not using Slack"
      },
      "typeVersion": 1
    },
    {
      "id": "8cc6eb91-0f1c-4b92-bf75-e47889c4fa2c",
      "name": "Set Channel Information",
      "type": "n8n-nodes-base.set",
      "position": [
        -272,
        -32
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4c3894aa-c248-4eac-a97c-9d44a9496964",
              "name": "Channel_Id",
              "type": "string",
              "value": "UCOdDjEyCCUQECkzWHxTF5iw"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "845e49ef-ae93-4b9a-9f52-087d5263821b",
  "connections": {
    "Get video detail": {
      "main": [
        [
          {
            "node": "Youtube Video Auto Tagging Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Youtube Video Auto Tagging Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Set Channel Information": {
      "main": [
        [
          {
            "node": "Get all videos uploaded last week",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Schedule Trigger": {
      "main": [
        [
          {
            "node": "Set Channel Information",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alternative channel to inform": {
      "main": [
        []
      ]
    },
    "Youtube Video Auto Tagging Agent": {
      "main": [
        [
          {
            "node": "Update video with AI generated tags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all videos uploaded last week": {
      "main": [
        [
          {
            "node": "Get video detail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update video with AI generated tags": {
      "main": [
        [
          {
            "node": "Inform via slack message",
            "type": "main",
            "index": 0
          },
          {
            "node": "Alternative channel to inform",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}