{
  "name": "Summarize YouTube video transcripts in Discord with Gemini and Supabase",
  "nodes": [
    {
      "id": "1273ffea-39d3-42cc-bcb1-abd403ea3bd7",
      "name": "Extract YouTube URL",
      "type": "n8n-nodes-base.code",
      "position": [
        -576,
        336
      ]
    },
    {
      "id": "610f37f3-d1c9-491f-9fa9-eda1af30e9d6",
      "name": "Discord Trigger",
      "type": "n8n-nodes-discord-trigger.discordTrigger",
      "position": [
        -800,
        336
      ]
    },
    {
      "id": "9e31fe2d-41e3-4405-8340-4a63650ea96d",
      "name": "Is YouTube URL?",
      "type": "n8n-nodes-base.if",
      "position": [
        -32,
        336
      ]
    },
    {
      "id": "3a55d9c6-c8b5-4170-be43-5d9b19c82b4d",
      "name": "yt-dlp Get Metadata",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        192,
        240
      ]
    },
    {
      "id": "6121252c-8e1f-446b-9b00-48039ed9eaaa",
      "name": "Parse Metadata",
      "type": "n8n-nodes-base.code",
      "position": [
        416,
        240
      ]
    },
    {
      "id": "fd999ffd-80b4-4248-bf9a-77247fe5d9f8",
      "name": "Read Subtitle File",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        640,
        240
      ]
    },
    {
      "id": "f77139fe-ebad-4c6c-9d63-55561a004918",
      "name": "Parse Transcript",
      "type": "n8n-nodes-base.code",
      "position": [
        864,
        240
      ]
    },
    {
      "id": "26965400-999e-4dea-bdf1-c8190da03f5f",
      "name": "Message a model",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        1088,
        240
      ]
    },
    {
      "id": "f0067574-707f-46b5-a725-8988539c20da",
      "name": "Prepare Insert Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        240
      ]
    },
    {
      "id": "b9f7473c-2bc1-4337-8efb-4b555cc8439c",
      "name": "Save to Supabase",
      "type": "n8n-nodes-base.supabase",
      "position": [
        1664,
        240
      ]
    },
    {
      "id": "5606a6df-0d30-4b1f-896f-5492ed37d048",
      "name": "Prepare Success Log",
      "type": "n8n-nodes-base.code",
      "position": [
        1888,
        240
      ]
    },
    {
      "id": "d94f1688-aed4-4cfa-8553-77519c45fa17",
      "name": "Log Run",
      "type": "n8n-nodes-base.supabase",
      "position": [
        2112,
        240
      ]
    },
    {
      "id": "e932de7a-bc59-4523-bd96-81b8855e4cc7",
      "name": "Discord Reply",
      "type": "n8n-nodes-base.discord",
      "position": [
        2528,
        240
      ]
    },
    {
      "id": "ac5c0018-638c-4c15-9138-ce6989427dae",
      "name": "Discord Not YouTube Reply",
      "type": "n8n-nodes-base.discord",
      "position": [
        192,
        432
      ]
    },
    {
      "id": "6516263a-56ab-4892-9a54-7699850fda00",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        -800,
        656
      ]
    },
    {
      "id": "8fa011ac-baa2-43d0-9ed6-a731d5532d62",
      "name": "Prepare Error Data",
      "type": "n8n-nodes-base.code",
      "position": [
        -576,
        656
      ]
    },
    {
      "id": "1c208dab-6014-4835-9a68-00a9e721a6bd",
      "name": "Log Run Error",
      "type": "n8n-nodes-base.supabase",
      "position": [
        -32,
        656
      ]
    },
    {
      "id": "6ddf1a0a-ed65-45de-b758-3f8040cc026d",
      "name": "Discord Error Reply",
      "type": "n8n-nodes-base.discord",
      "position": [
        192,
        656
      ]
    },
    {
      "id": "6dcab5da-8423-482c-b6d9-ffee1fa6c9a4",
      "name": "Sticky Note - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1408,
        -64
      ],
      "parameters": {
        "width": 496,
        "height": 892,
        "content": "# YouTube Video Summarizer — Discord Bot\n\n## Who is this for?\nTeams or creators who want to automatically summarize YouTube videos shared in a Discord channel.\n\n## What does it do?\n- Listens for YouTu"
      }
    },
    {
      "id": "48bfa715-4fed-473f-b804-ba0f735ec43b",
      "name": "Sticky Note - Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        32
      ],
      "parameters": {
        "width": 720,
        "height": 228,
        "content": "## 1. Trigger & URL Detection\n\nListens for every message in the configured Discord channel and checks if it contains a YouTube URL.\n\n**How it works:**\n1. Discord Trigger fires on every new message\n2. "
      }
    },
    {
      "id": "f6446181-cbbe-470a-b654-fc8274e71379",
      "name": "Sticky Note - Video Data Extraction",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -80
      ],
      "parameters": {
        "width": 480,
        "height": 256,
        "content": "## 2. Video Data Extraction\n\nRuns yt-dlp to download subtitles and fetch video metadata in a single shell command.\n\n**How it works:**\n1. yt-dlp downloads auto-generated English subtitles (.vtt) to /tm"
      }
    },
    {
      "id": "dfb5a5b4-921a-44b8-863a-f0a34ef284f6",
      "name": "Sticky Note - Transcript Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        -80
      ],
      "parameters": {
        "width": 480,
        "height": 240,
        "content": "## 3. Transcript Processing\n\nReads the .vtt subtitle file and cleans it into plain text.\n\n**How it works:**\n1. `cat` reads the VTT file (continueOnFail enabled)\n2. Parse Transcript strips timestamps, "
      }
    },
    {
      "id": "116e832f-4c11-451c-a3bb-66680d3b7f03",
      "name": "Sticky Note - AI Summarization",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1088,
        -80
      ],
      "parameters": {
        "width": 536,
        "height": 240,
        "content": "## 4. AI Summarization\n\nSends the clean transcript to Gemini 2.5 Flash for a concise summary.\n\n**How it works:**\n1. Gemini receives title, channel, and full transcript\n2. Returns 3-5 paragraphs of pro"
      }
    },
    {
      "id": "25b52b6c-db1c-4439-9e23-9481690c3837",
      "name": "Sticky Note - Save & Notify",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1712,
        -80
      ],
      "parameters": {
        "width": 900,
        "height": 240,
        "content": "## 5. Save & Notify\n\nPersists data to Supabase and replies in Discord.\n\n**How it works:**\n1. Save to Supabase inserts all fields into the `videos` table\n2. Prepare Success Log builds a run record (sta"
      }
    },
    {
      "id": "646554d2-c672-415b-a33a-1da62f3ed27d",
      "name": "Sticky Note - Error Handling",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        832
      ],
      "parameters": {
        "width": 740,
        "height": 256,
        "content": "## 6. Error Handling\n\nCatches any workflow crash and replies in Discord with the error details.\n\n**How it works:**\n1. Error Trigger fires on any unhandled node failure\n2. Prepare Error Data classifies"
      }
    },
    {
      "id": "eb2d6b48-a92c-4b0e-a778-e16fbe698b57",
      "name": "Sticky Note - Discord Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        1120
      ],
      "parameters": {
        "width": 440,
        "height": 300,
        "content": "### Discord Bot Setup\n\n1. Go to [Discord Developer Portal](https://discord.com/developers/applications)\n2. Create a new Application → Bot\n3. Enable **Message Content Intent** under Privileged Intents\n"
      }
    },
    {
      "id": "4c21a5a4-694b-4ca8-bbb1-83c9cf42915f",
      "name": "Sticky Note - Gemini Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1088,
        496
      ],
      "parameters": {
        "width": 400,
        "height": 240,
        "content": "### Gemini API Setup\n\n1. Go to [Google AI Studio](https://aistudio.google.com/apikey)\n2. Click **Create API Key**\n3. Copy the key\n4. In n8n: Click the Gemini node → Credential → Create New\n5. Paste yo"
      }
    },
    {
      "id": "447e0689-b5bc-4f93-aea4-e6a27a977d3c",
      "name": "Sticky Note - Supabase Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1664,
        496
      ],
      "parameters": {
        "width": 440,
        "height": 480,
        "content": "### Supabase Setup\n\n1. Create a project at [supabase.com](https://supabase.com)\n2. Go to Settings → API → copy the **URL** and **anon key**\n3. In n8n: Create Supabase credential with URL + API key\n4. "
      }
    },
    {
      "id": "b32a9d85-67a9-4217-984c-603702b292c0",
      "name": "Prepare Messages for Discord",
      "type": "n8n-nodes-base.code",
      "position": [
        2320,
        240
      ]
    }
  ],
  "connections": {
    "Log Run": {
      "main": [
        [
          {
            "node": "Prepare Messages for Discord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Prepare Error Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Run Error": {
      "main": [
        [
          {
            "node": "Discord Error Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Metadata": {
      "main": [
        [
          {
            "node": "Read Subtitle File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Discord Trigger": {
      "main": [
        [
          {
            "node": "Extract YouTube URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is YouTube URL?": {
      "main": [
        [
          {
            "node": "yt-dlp Get Metadata",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Discord Not YouTube Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Prepare Insert Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Transcript": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save to Supabase": {
      "main": [
        [
          {
            "node": "Prepare Success Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Error Data": {
      "main": [
        [
          {
            "node": "Log Run Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Subtitle File": {
      "main": [
        [
          {
            "node": "Parse Transcript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract YouTube URL": {
      "main": [
        [
          {
            "node": "Is YouTube URL?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Insert Data": {
      "main": [
        [
          {
            "node": "Save to Supabase",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Success Log": {
      "main": [
        [
          {
            "node": "Log Run",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "yt-dlp Get Metadata": {
      "main": [
        [
          {
            "node": "Parse Metadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Messages for Discord": {
      "main": [
        [
          {
            "node": "Discord Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}