{
  "name": "AI Content Repurposing Engine",
  "nodes": [
    {
      "id": "17e94397-b7d0-4b0f-a905-f4c93bda52ee",
      "name": "Receive YouTube URL",
      "type": "n8n-nodes-base.webhook",
      "position": [
        720,
        768
      ],
      "parameters": {
        "path": "yt-repurpose",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "b064c3ae-683c-4561-86cb-96fb47d0d64e",
      "name": "Extract Video ID",
      "type": "n8n-nodes-base.code",
      "position": [
        912,
        768
      ],
      "parameters": {
        "jsCode": "const url = $json.body.url;\n\nconst videoId = url.split(\"v=\")[1]?.split(\"&\")[0];\n\nreturn [{ videoId }];"
      },
      "typeVersion": 2
    },
    {
      "id": "dca2708c-5448-4a71-86c2-5b4402e4612f",
      "name": "Fetch YouTube Video Details",
      "type": "n8n-nodes-base.youTube",
      "position": [
        1216,
        768
      ],
      "parameters": {
        "part": [
          "id",
          "contentDetails",
          "topicDetails",
          "snippet"
        ],
        "options": {},
        "videoId": "={{ $json.videoId }}",
        "resource": "video",
        "operation": "get"
      },
      "typeVersion": 1
    },
    {
      "id": "7f9c7c3f-504e-48bf-88fb-d4f767654134",
      "name": "Fetch Video Transcript",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        1440,
        768
      ],
      "parameters": {
        "actorId": {
          "__rl": true,
          "mode": "list",
          "value": "ekL1keWNO0gPwCnv9",
          "cachedResultUrl": "https://console.apify.com/actors/ekL1keWNO0gPwCnv9/input",
          "cachedResultName": "YouTube Transcript & Captions Scraper (benthepythondev/youtube-transcript-scraper)"
        },
        "timeout": {},
        "customBody": "={\n  \"startUrls\": [\n    {\n      \"url\": \"https://www.youtube.com/watch?v={{ $json.id }}\"\n    }\n  ]\n}",
        "actorSource": "store"
      },
      "typeVersion": 1
    },
    {
      "id": "edccdef1-8840-44eb-a801-92d081047809",
      "name": "Clean Transcript Text",
      "type": "n8n-nodes-base.code",
      "position": [
        1648,
        768
      ],
      "parameters": {
        "jsCode": "const transcript = $json.transcript;\n\n// remove HTML entities like &#39;\nconst clean = transcript\n  .replace(/&#39;/g, \"'\")\n  .replace(/\\[♪.*?♪\\]/g, \"\")\n  .replace(/\\s+/g, \" \")\n  .trim();\n\nreturn [{\n  transcript: clean\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "06bd201b-d17f-4e2d-8f66-cf78210ff6d7",
      "name": "Generate Social Media Content",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1840,
        768
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "content": "=You are a professional content repurposing assistant.\n\nConvert this YouTube transcript into:\n\n{\n  \"linkedin_post\": \"\",\n  \"twitter_thread\": \"\",\n  \"blog\": \"\",\n  \"youtube_description\": \"\"\n}\n\nTranscript:\n{{$json.transcript}}"
            }
          ]
        },
        "builtInTools": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "010c100f-c007-44e0-afa5-fb8746ee19e8",
      "name": "Extract AI Response",
      "type": "n8n-nodes-base.code",
      "position": [
        2640,
        320
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    content: $json.output[0].content[0].text\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "ff0b2896-bb8e-47fb-8a0b-e8d47953251d",
      "name": "Convert AI Response to JSON",
      "type": "n8n-nodes-base.code",
      "position": [
        2896,
        320
      ],
      "parameters": {
        "jsCode": "const data = JSON.parse($json.content);\n\nreturn [\n  {\n    json: {\n      linkedin_post: data.linkedin_post,\n      twitter_thread: data.twitter_thread,\n      blog: data.blog,\n      youtube_description: data.youtube_description\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "3d196f76-fad0-43b8-860c-22d849ed6c98",
      "name": "Create Thumbnail Prompt",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2272,
        768
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "content": "=Create a professional YouTube thumbnail prompt for this video.\n\nVideo Title:\n{{$('Fetch YouTube Video Details').first().json.snippet.title}}\n\nTranscript: {{ $('Clean Transcript Text').item.json.transcript }}\n\n\nRules:\n- Make it visually attractive\n- Modern YouTube style\n- Bold text\n- High contrast\n- Cinematic lighting\n- AI art style\n- Return only the image prompt"
            }
          ]
        },
        "builtInTools": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "b2a24f94-cf69-4309-b4d1-662b86ef99cf",
      "name": "Extract Thumbnail Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        2592,
        768
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    content: $json.output[0].content[0].text\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "59488e65-72f0-40b5-9ac5-85909c0d1c20",
      "name": "Generate AI Thumbnail",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2784,
        768
      ],
      "parameters": {
        "model": "gpt-image-1",
        "prompt": "={{ $json.content }}",
        "options": {
          "size": "1024x1024"
        },
        "resource": "image"
      },
      "typeVersion": 2.1
    },
    {
      "id": "7fccc4c0-7537-45ac-9ea0-b517746ec8c6",
      "name": "Upload Thumbnail",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        3088,
        768
      ],
      "parameters": {
        "name": "Ai content",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "88182336-5331-4e75-b7c8-7526c6ab4a5a",
      "name": "Make Thumbnail Public",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        3296,
        768
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $json.webViewLink }}"
        },
        "options": {},
        "operation": "share",
        "permissionsUi": {
          "permissionsValues": {
            "role": "reader",
            "type": "anyone"
          }
        }
      },
      "typeVersion": 3
    },
    {
      "id": "3dc01daa-437a-43b9-a84e-a4116b3c0236",
      "name": "Prepare Thumbnail URL",
      "type": "n8n-nodes-base.set",
      "position": [
        3504,
        768
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "166473b4-bed0-4983-84f4-d94142135239",
              "name": "Thumbnail",
              "type": "string",
              "value": "={{ $('Upload Thumbnail').item.json.webViewLink }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "8b1ae49b-6b08-4468-964d-0d17982f00a2",
      "name": "Prepare Final Content Data",
      "type": "n8n-nodes-base.code",
      "position": [
        3136,
        320
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      video_title: $('Fetch YouTube Video Details').first().json.snippet.title,\n\n      video_url:\n        'https://www.youtube.com/watch?v=' +\n        $('Fetch YouTube Video Details').first().json.id,\n\n      transcript:\n        $('Fetch Video Transcript').first().json.transcript.substring(0, 1900),\n\n      linkedin_post: $json.linkedin_post,\n\n      twitter_thread: $json.twitter_thread,\n\n      blog: $json.blog,\n\n      youtube_description: $json.youtube_description,\n\n      timestamp: new Date().toISOString()\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "18b98dd0-6b1e-462f-8d5a-75b74b1b054f",
      "name": "Save Content to Notion",
      "type": "n8n-nodes-base.notion",
      "position": [
        3920,
        768
      ],
      "parameters": {
        "title": "n8n",
        "simple": false,
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "2b54b520-96ce-80e3-865e-fb10916e28fd",
          "cachedResultUrl": "https://www.notion.so/2b54b52096ce80e3865efb10916e28fd",
          "cachedResultName": "Socialmedia content"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Video Title|title",
              "title": "={{ $json.video_title }}"
            },
            {
              "key": "Video URL|url",
              "urlValue": "={{ $json.video_url }}"
            },
            {
              "key": "Transcript|rich_text",
              "textContent": "={{ $json.transcript }}"
            },
            {
              "key": "LinkedIn Post|rich_text",
              "textContent": "={{ $json.linkedin_post }}"
            },
            {
              "key": "Twitter Thread|rich_text",
              "textContent": "={{ $json.twitter_thread }}"
            },
            {
              "key": "Blog|rich_text",
              "textContent": "={{ $json.blog }}"
            },
            {
              "key": "Timestamp|date",
              "timezone": "={{ $json.timestamp }}"
            },
            {
              "key": " Youtubedescription|rich_text",
              "textContent": "={{ $json.youtube_description }}"
            },
            {
              "key": "Thumbnail|url",
              "urlValue": "={{ $json.Thumbnail }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "af3d5ecd-0efc-45d3-ac94-c40da51345b9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3824,
        592
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 368,
        "content": "Stores all generated content and thumbnail link into the Notion database."
      },
      "typeVersion": 1
    },
    {
      "id": "f154b200-6c5e-4132-8524-3be7c0f907ac",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        528
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 432,
        "content": "## Receive and Process YouTube Link\n\nThis step receives the YouTube video URL and extracts the video ID.\nThe video ID is used to fetch video details and transcript for further AI processing."
      },
      "typeVersion": 1
    },
    {
      "id": "cb82c89b-67f4-47e7-8ba0-6d9a09370f0d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        528
      ],
      "parameters": {
        "color": 7,
        "width": 1024,
        "height": 432,
        "content": "## Fetch and Process Video Content\n\nThis step fetches YouTube video details and transcript.\nThe transcript is cleaned and sent to OpenAI to generate: LinkedIn Post, Twitter Thread, Blog Content, YouTube Description\nThis prepares all AI-generated content for storage and publishing."
      },
      "typeVersion": 1
    },
    {
      "id": "970d6926-cb94-4152-8ca3-e0f17c3ffa29",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2496,
        176
      ],
      "parameters": {
        "color": 7,
        "width": 848,
        "height": 320,
        "content": "## Prepare Final AI Content Data\n\nThis step extracts the AI-generated response and converts it into structured JSON format.\nThen it combines: Video details, Transcript, AI-generated content\ninto one final data object ready for Notion storage."
      },
      "typeVersion": 1
    },
    {
      "id": "dee859df-44d7-4697-b409-db24a406fe8c",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2224,
        528
      ],
      "parameters": {
        "color": 7,
        "width": 704,
        "height": 432,
        "content": "## Generate AI Thumbnail Image\n\nThis step creates a professional thumbnail prompt using OpenAI.\nThe prompt is extracted and sent to AI image generation to create a custom YouTube thumbnail image automatically."
      },
      "typeVersion": 1
    },
    {
      "id": "79b98f1b-2d5f-457b-a5bf-a7409085b550",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3008,
        528
      ],
      "parameters": {
        "color": 7,
        "width": 704,
        "height": 432,
        "content": "## Store and Share Thumbnail Image\n\nThis step uploads the AI-generated thumbnail to Google Drive.\nThe image is made publicly accessible and the thumbnail URL is prepared for saving into the Notion database."
      },
      "typeVersion": 1
    },
    {
      "id": "e55bc1df-2d9e-4159-ac1e-85f76cf90d2d",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -32
      ],
      "parameters": {
        "width": 768,
        "height": 992,
        "content": "## How it works\n\nThis workflow automatically converts a YouTube video into multiple types of social media content using AI.\n\nThe workflow starts when a YouTube video URL is received through a webhook. It extracts the video ID, fetches video details from YouTube, and collects the video transcript using Apify.\n\nThe transcript is cleaned and sent to OpenAI, which generates:\n\nLinkedIn post\nTwitter/X thread\nBlog content\nYouTube description\n\nThe workflow also creates a professional AI thumbnail prompt and generates a custom thumbnail image using OpenAI image generation.\n\nThe thumbnail image is uploaded to Google Drive, made publicly accessible, and its public link is stored.\n\nFinally, all generated content, transcript data, video details, and thumbnail URL are saved into a Notion database for easy content management and reuse.\n\n\n\n## Setup steps\n\n**1.** Create credentials for:\nYouTube API, OpenAI API, Apify API, Google Drive, Notion\n\n**2.** Connect all credentials inside n8n.\n**3.** Create a Notion database with fields for:\nVideo Title, Video URL, Transcript, inkedIn Post, Twitter Thread, Blog, YouTube, Description, Thumbnail URL, Timestamp\n**3.** Update the Notion Database ID in the workflow.\n**4.** Activate the workflow.\n**5.** Send a YouTube video URL to the webhook endpoint to generate AI content automatically."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Extract Video ID": {
      "main": [
        [
          {
            "node": "Fetch YouTube Video Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Thumbnail": {
      "main": [
        [
          {
            "node": "Make Thumbnail Public",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract AI Response": {
      "main": [
        [
          {
            "node": "Convert AI Response to JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive YouTube URL": {
      "main": [
        [
          {
            "node": "Extract Video ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Transcript Text": {
      "main": [
        [
          {
            "node": "Generate Social Media Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate AI Thumbnail": {
      "main": [
        [
          {
            "node": "Upload Thumbnail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Make Thumbnail Public": {
      "main": [
        [
          {
            "node": "Prepare Thumbnail URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Thumbnail URL": {
      "main": [
        [
          {
            "node": "Save Content to Notion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Video Transcript": {
      "main": [
        [
          {
            "node": "Clean Transcript Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Thumbnail Prompt": {
      "main": [
        [
          {
            "node": "Extract Thumbnail Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Thumbnail Prompt": {
      "main": [
        [
          {
            "node": "Generate AI Thumbnail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Final Content Data": {
      "main": [
        [
          {
            "node": "Save Content to Notion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert AI Response to JSON": {
      "main": [
        [
          {
            "node": "Prepare Final Content Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch YouTube Video Details": {
      "main": [
        [
          {
            "node": "Fetch Video Transcript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Social Media Content": {
      "main": [
        [
          {
            "node": "Extract AI Response",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create Thumbnail Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false
}
