{
  "id": "Iqn6p06vxqQB1o2B",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Generate YouTube Video Ideas with Dumpling AI and GPT-4o",
  "tags": [],
  "nodes": [
    {
      "id": "dd360394-c997-46eb-b4aa-813ae2efb284",
      "name": "Trigger on New YouTube Video Row",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -544,
        -320
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 943292970,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Jq2UpzUq8lBMNJxezZLErnlqH4z7tKI2h2jONNA3lEc/edit#gid=943292970",
          "cachedResultName": "YouTube finds"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Jq2UpzUq8lBMNJxezZLErnlqH4z7tKI2h2jONNA3lEc",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Jq2UpzUq8lBMNJxezZLErnlqH4z7tKI2h2jONNA3lEc/edit?usp=drivesdk",
          "cachedResultName": "Youtube Video/Creators"
        }
      },
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2a65182b-3fdb-4525-a761-56e8de94a1c0",
      "name": "Loop Over Videos",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -144,
        -320
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "8c9d3978-fad8-4a55-bf71-f25b9981e2d0",
      "name": "Wait Between Requests",
      "type": "n8n-nodes-base.wait",
      "position": [
        128,
        -176
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "0ea80688-8018-4586-8440-d52023c8bd4b",
      "name": "Get Transcript from Dumpling AI",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        352,
        -176
      ],
      "parameters": {
        "url": "https://app.dumplingai.com/api/v1/get-youtube-transcript",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"videoUrl\": \"{{ $json['Video Link'] }}\"\n} ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "28d28895-e29b-4631-863f-e41d066582c4",
      "name": "Get Comments from Dumpling AI",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        576,
        -176
      ],
      "parameters": {
        "url": "https://app.dumplingai.com/api/v1/youtube/video/comments",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"url\": \"{{ $('Trigger on New YouTube Video Row').item.json['Video Link'] }}\"\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "97d55e38-bb35-4451-8bdd-17299cfbab57",
      "name": "Extract Comment Content",
      "type": "n8n-nodes-base.code",
      "position": [
        800,
        -176
      ],
      "parameters": {
        "jsCode": "// n8n Function node\n// Input: items[0].json.comments (array of comment objects)\n// Output: one item per comment with { content: \"...\" }\n\nconst results = [];\n\nfor (const item of items) {\n  if (item.json.comments && Array.isArray(item.json.comments)) {\n    for (const comment of item.json.comments) {\n      results.push({\n        json: {\n          content: comment.content\n        }\n      });\n    }\n  }\n}\n\nreturn results;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "1793f720-9f0b-4701-8eb6-2dee3d4d875b",
      "name": "Merge Comments into Single Field",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1024,
        -176
      ],
      "parameters": {
        "include": "specifiedFields",
        "options": {},
        "aggregate": "aggregateAllItemData",
        "fieldsToInclude": "content",
        "destinationFieldName": "comment"
      },
      "typeVersion": 1
    },
    {
      "id": "11577acc-7188-48fe-a0ff-53b5a0a65531",
      "name": "Generate Video Ideas with GPT-4o",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1248,
        -176
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "chatgpt-4o-latest",
          "cachedResultName": "CHATGPT-4O-LATEST"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=You are a YouTube content strategist. I will provide you with three inputs: 1) the transcript of a YouTube video, 2) the topic or search query that led to this video, and 3) a set of comments viewers left on the video.\n\nYour task:\n\nAnalyze the transcript to identify the main themes, insights, and information shared.\n\nReview the search topic to understand what people are actively looking for.\n\nAnalyze the comments to detect audience sentiment, recurring questions, pain points, and what viewers wish had been covered.\n\nBased on this analysis, generate 3 to 5 concrete YouTube video ideas for my channel. For each idea, clearly explain:\n\nThe proposed video title or topic.\n\nWhy this idea is a good follow-up (tie it directly to the transcript, search intent, or comments).\n\nHow it can attract engagement (views, likes, comments).\n\nMake your response clear, structured, and actionable so I can immediately plan my next video.\n\nReturn the result strictly in JSON format with the following structure:\n\n{\n  \"contentIdeas\": [\n    {\n      \"title\": \"string\",\n      \"whyGoodIdea\": \"string\",\n      \"engagementPotential\": \"string\"\n    }\n  ]\n}\n\nMake sure the response is valid JSON only, with no extra text or explanation outside of the JSON."
            },
            {
              "content": "=comment: {{ JSON.stringify($json.comment) }}\n\ntranscript:{{ $('Get Transcript from Dumpling AI').item.json.transcript }}\n\nSearch Topic:{{ $('Trigger on New YouTube Video Row').item.json['search topic'] }}"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "152a63c2-39e1-4224-ad00-63d27228b938",
      "name": "Split Content Ideas",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1600,
        -176
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "message.content.contentIdeas"
      },
      "typeVersion": 1
    },
    {
      "id": "b81bf143-f4dc-47db-99c3-76fd77248fa6",
      "name": "Save Video Ideas to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1824,
        -176
      ],
      "parameters": {
        "columns": {
          "value": {
            "title": "={{ $json.title }}",
            "whyGoodIdea": "={{ $json.whyGoodIdea }}",
            "engagementPotential": "={{ $json.engagementPotential }}"
          },
          "schema": [
            {
              "id": "title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "whyGoodIdea",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "whyGoodIdea",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "engagementPotential",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "engagementPotential",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Jq2UpzUq8lBMNJxezZLErnlqH4z7tKI2h2jONNA3lEc/edit#gid=1868697318",
          "cachedResultName": "Youtube Content Idea"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Jq2UpzUq8lBMNJxezZLErnlqH4z7tKI2h2jONNA3lEc/edit?usp=drivesdk",
          "cachedResultName": "Youtube Video/Creators"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "927b3dfa-43df-4b77-8bde-83442391cecb",
      "name": "Email Content Ideas",
      "type": "n8n-nodes-base.gmail",
      "position": [
        64,
        -416
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=Hello,  \n\nHere are the recommended content ideas generated from the latest YouTube video analysis:\n\nhttps://docs.google.com/spreadsheets/d//edit?usp=sharing\n\nThese insights are based on the video transcript, the original search topic, and what viewers are actively discussing in the comments. You can use them to plan your next upload with confidence.  Best regards, Your Automation Workflow",
        "options": {
          "appendAttribution": false
        },
        "subject": "New YouTube Content Ideas Based on Video Analysis",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "35b3ed75-af8f-4d41-9a77-d10c5cb5d44c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -688
      ],
      "parameters": {
        "width": 1664,
        "height": 896,
        "content": "## \ud83d\udccc YouTube Ideas from Dumpling AI + GPT-4o\n\nThis workflow triggers when a new YouTube video is added to a Google Sheet.\n\n**Branch 1 \u2013 Collect Data**\n1. \ud83d\udcc4 Trigger on new video in sheet  \n2. \ud83d\udd01 Loop over rows (one at a time)  \n3. \ud83d\udcdd Get transcript (Dumpling AI)  \n4. \ud83d\udcac Get comments (Dumpling AI)  \n5. \ud83d\udd03 Extract and merge comment text\n"
      },
      "typeVersion": 1
    },
    {
      "id": "289785ab-275e-4087-a851-99c70f30ef1b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1152,
        -672
      ],
      "parameters": {
        "color": 4,
        "width": 944,
        "height": 832,
        "content": "## \ud83e\udd16 Generate & Save Video Ideas\n\n**Branch 2 \u2013 Process & Output**\n6. \ud83e\udde0 GPT-4o generates 3\u20135 video ideas  \n7. \ud83e\udde9 Split each idea  \n8. \ud83d\udcca Save to \u201cYouTube Content Idea\u201d sheet  \n9. \ud83d\udce7 Email summary link\n\n\u2705 Make sure:\n- Dumpling + OpenAI credentials are stored securely\n- Sheet columns: `Video Link`, `search topic`, `title`, `whyGoodIdea`, `engagementPotential`\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1bf226e2-e083-4eda-bda5-2c3d6f413c8d",
  "connections": {
    "Loop Over Videos": {
      "main": [
        [
          {
            "node": "Email Content Ideas",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait Between Requests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Content Ideas": {
      "main": [
        [
          {
            "node": "Save Video Ideas to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait Between Requests": {
      "main": [
        [
          {
            "node": "Get Transcript from Dumpling AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Comment Content": {
      "main": [
        [
          {
            "node": "Merge Comments into Single Field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Comments from Dumpling AI": {
      "main": [
        [
          {
            "node": "Extract Comment Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Transcript from Dumpling AI": {
      "main": [
        [
          {
            "node": "Get Comments from Dumpling AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Video Ideas with GPT-4o": {
      "main": [
        [
          {
            "node": "Split Content Ideas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Comments into Single Field": {
      "main": [
        [
          {
            "node": "Generate Video Ideas with GPT-4o",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger on New YouTube Video Row": {
      "main": [
        [
          {
            "node": "Loop Over Videos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Video Ideas to Google Sheets": {
      "main": [
        [
          {
            "node": "Loop Over Videos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}