{
  "name": "C - UGC Content Pipeline",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyX",
              "value": 10,
              "unit": "minutes"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "value": "REPLACE_WITH_RAW_FOOTAGE_FOLDER_ID",
          "mode": "id"
        },
        "event": "fileCreated"
      },
      "type": "n8n-nodes-base.googleDriveTrigger",
      "typeVersion": 1,
      "position": [
        -400,
        0
      ],
      "id": "drive-trigger-1",
      "name": "New Raw Footage File"
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "={{ $json.id }}",
          "mode": "id"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -160,
        0
      ],
      "id": "drive-download-1",
      "name": "Download File",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.openai.com/v1/audio/transcriptions",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "openAiApi",
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "parameterType": "formBinaryData",
              "name": "file",
              "inputDataFieldName": "data"
            },
            {
              "name": "model",
              "value": "whisper-1"
            },
            {
              "name": "response_format",
              "value": "json"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        80,
        0
      ],
      "id": "openai-transcribe-1",
      "name": "Transcribe Footage",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.openai.com/v1/chat/completions",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "openAiApi",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ model: \"gpt-4.1-mini\", messages: [ { role: \"system\", content: \"You write short-form UGC video captions/hooks for a creator pitching brands on platforms like SideShift, Billo, and JoinBrands. Given a raw transcript of a filmed clip, produce 3 distinct caption/hook options (1-2 sentences each) that sound authentic and native to social feeds, plus a one-line note on which product niche this clip best demonstrates. Respond as plain readable text, not JSON.\" }, { role: \"user\", content: `Transcript:\\n${$json.text}` } ] }) }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        320,
        0
      ],
      "id": "openai-captions-1",
      "name": "Generate Caption Variants",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const items = $input.all();\nreturn items.map((item) => {\n  const captionText = item.json.choices?.[0]?.message?.content || item.json.message?.content || item.json.content || item.json.text || '';\n  const triggerFile = $('New Raw Footage File').first().json;\n  return {\n    json: {\n      fileName: (triggerFile.name || 'clip').replace(/\\.[^/.]+$/, '') + '_captions.txt',\n      captionText,\n      originalFileId: triggerFile.id,\n      originalFileName: triggerFile.name\n    }\n  };\n});\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        560,
        0
      ],
      "id": "code-format-1",
      "name": "Format Output"
    },
    {
      "parameters": {
        "operation": "upload",
        "name": "={{ $json.fileName }}",
        "driveId": {
          "__rl": true,
          "value": "My Drive",
          "mode": "list"
        },
        "folderId": {
          "__rl": true,
          "value": "REPLACE_WITH_READY_TO_SUBMIT_FOLDER_ID",
          "mode": "id"
        },
        "options": {
          "binaryData": false
        },
        "content": "={{ $json.captionText }}"
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        800,
        0
      ],
      "id": "drive-upload-1",
      "name": "Save Captions to Drive",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "move",
        "fileId": {
          "__rl": true,
          "value": "={{ $json.originalFileId }}",
          "mode": "id"
        },
        "driveId": {
          "__rl": true,
          "value": "My Drive",
          "mode": "list"
        },
        "folderId": {
          "__rl": true,
          "value": "REPLACE_WITH_READY_TO_SUBMIT_FOLDER_ID",
          "mode": "id"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        1040,
        0
      ],
      "id": "drive-move-1",
      "name": "Move Clip to Ready Folder",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "REPLACE_WITH_YOUR_TELEGRAM_CHAT_ID",
        "text": "=\ud83c\udfac New content ready to submit: {{ $json.originalFileName }}\nCaptions saved as: {{ $json.fileName }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1280,
        0
      ],
      "id": "telegram-ready-1",
      "name": "Notify Content Ready",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "New Raw Footage File": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Transcribe Footage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe Footage": {
      "main": [
        [
          {
            "node": "Generate Caption Variants",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Caption Variants": {
      "main": [
        [
          {
            "node": "Format Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Output": {
      "main": [
        [
          {
            "node": "Save Captions to Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Captions to Drive": {
      "main": [
        [
          {
            "node": "Move Clip to Ready Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Move Clip to Ready Folder": {
      "main": [
        [
          {
            "node": "Notify Content Ready",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {}
}