{
  "name": "YouTube video → draft in Google Docs",
  "nodes": [
    {
      "parameters": {
        "content": "## Draft in Google Docs\nPaste a YouTube link and say what to write (blog post, newsletter, LinkedIn post); a draft appears in your Google Drive.\n\n**YouTubeTranscriptAPI key (once):** Credentials → New → Header Auth. Name: `Authorization`. Value: `Bearer tk_live_…` (your key from youtubetranscriptapi.com/dashboard/keys). Call it *YouTubeTranscriptAPI key* and pick it in every YouTube node.\n\n**Also:** add your OpenAI key and connect Google Docs.\n\n**Cost:** 1 credit per video.",
        "width": 440,
        "height": 360,
        "color": 5
      },
      "id": "1225b8c5-4f48-4e15-8d68-2bde3fb9fa66",
      "name": "Setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -520,
        -60
      ]
    },
    {
      "parameters": {
        "formTitle": "Draft from a YouTube video",
        "formDescription": "Paste a link and say what to write. The draft lands in your Google Drive.",
        "formFields": {
          "values": [
            {
              "fieldLabel": "YouTube link",
              "placeholder": "https://www.youtube.com/watch?v=…",
              "requiredField": true
            },
            {
              "fieldLabel": "What to write",
              "placeholder": "Blog post, newsletter or LinkedIn post",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "id": "62c4385b-8c35-47db-858e-d02deade5e34",
      "name": "YouTube link form",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        0,
        0
      ],
      "webhookId": "8b8cf6b0-ee2c-4046-82b1-f5859facdfc6"
    },
    {
      "parameters": {
        "url": "https://youtubetranscriptapi.com/api/v2/youtube/transcript",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "video_url",
              "value": "={{ $json['YouTube link'] }}"
            },
            {
              "name": "format",
              "value": "text"
            },
            {
              "name": "include_timestamp",
              "value": "false"
            },
            {
              "name": "send_metadata",
              "value": "true"
            }
          ]
        },
        "options": {}
      },
      "id": "a6534d3c-efdf-46cf-81ba-c119188da320",
      "name": "Get transcript",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Write a {{ $('YouTube link form').item.json['What to write'] }} based on this YouTube video.\n\nTitle: {{ $json.metadata.title }}\nChannel: {{ $json.metadata.author_name }}\nLink: {{ $('YouTube link form').item.json['YouTube link'] }}\n\nTranscript:\n{{ $json.transcript }}",
        "messages": {
          "messageValues": [
            {
              "message": "Write in a plain, direct voice with no hype. Keep the speaker's examples and numbers, and don't add facts that aren't in the transcript. Blog post: a title, a two-sentence intro, 3 to 6 sections with subheadings, a short wrap-up. Newsletter: a subject line and three short sections. LinkedIn post: under 1,300 characters. End with a credit line naming the video's title and link."
            }
          ]
        },
        "hasOutputParser": false
      },
      "id": "829ded6b-b853-4afe-886e-31de475d8724",
      "name": "Write the draft",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.6,
      "position": [
        480,
        0
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "id": "f30974b5-cab0-484f-804b-3ebc63f26b4e",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        480,
        220
      ]
    },
    {
      "parameters": {
        "title": "=Draft: {{ $('Get transcript').item.json.metadata.title }}",
        "folderId": "default"
      },
      "id": "9aaba732-051f-4bdc-84e8-69824e843a4e",
      "name": "Create the doc",
      "type": "n8n-nodes-base.googleDocs",
      "typeVersion": 2,
      "position": [
        800,
        0
      ]
    },
    {
      "parameters": {
        "operation": "update",
        "documentURL": "={{ $json.id }}",
        "actionsUi": {
          "actionFields": [
            {
              "action": "insert",
              "text": "={{ $('Write the draft').item.json.text }}"
            }
          ]
        }
      },
      "id": "67f6eb21-0d13-47fe-8aab-ef2f1d13ece0",
      "name": "Add the text",
      "type": "n8n-nodes-base.googleDocs",
      "typeVersion": 2,
      "position": [
        1020,
        0
      ]
    }
  ],
  "connections": {
    "YouTube link form": {
      "main": [
        [
          {
            "node": "Get transcript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get transcript": {
      "main": [
        [
          {
            "node": "Write the draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write the draft": {
      "main": [
        [
          {
            "node": "Create the doc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create the doc": {
      "main": [
        [
          {
            "node": "Add the text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Write the draft",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}