{
  "name": "Instagram Content Generator",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 6
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [40, 20],
      "id": "df0235fb-b5c0-471f-bbdb-7dfeb1b76e9a",
      "name": "Schedule Trigger - Daily"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "REDACTED_DOCUMENT_ID",
          "mode": "list"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list"
        },
        "options": {
          "dataLocationOnSheet": {
            "values": {
              "rangeDefinition": "specifyRange"
            }
          }
        }
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [260, 20],
      "id": "e5b03a46-a9fb-4f99-b643-6889bf4c73af",
      "name": "Google Sheets - Fetch Creators Data",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "REDACTED_CREDENTIAL_ID",
          "name": "REDACTED_CREDENTIAL_NAME"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Code to format usernames"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [480, 20],
      "id": "a2535306-718d-4946-8509-f7e01c60cff3",
      "name": "Code"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/acts/REDACTED_ACT_ID/run-sync-get-dataset-items",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "Bearer REDACTED_API_KEY"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{$json}}"
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [700, 20],
      "id": "7352801c-1b89-4583-8684-982ca43ce7ca",
      "name": "HTTP Request - Scrape Videos"
    },
    {
      "parameters": {
        "url": "={{ $json.videoUrl }}"
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [1480, 0],
      "id": "772e2766-8ce4-45af-bd4e-c6a91e475eac",
      "name": "HTTP Request - Download Videos"
    },
    {
      "parameters": {
        "batchSize": "=1"
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [1760, 0],
      "id": "9eeff098-b29b-489d-b8b6-363665142ab8",
      "name": "Loop Over Videos"
    },
    {
      "parameters": {
        "resource": "audio",
        "operation": "transcribe",
        "binaryPropertyName": "=data"
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [2300, 220],
      "id": "dbcb86c8-c686-4586-8c73-5279cced5b5a",
      "name": "OpenAI - Transcribe Audio",
      "credentials": {
        "openAiApi": {
          "id": "REDACTED_CREDENTIAL_ID",
          "name": "REDACTED_CREDENTIAL_NAME"
        }
      }
    },
    {
      "parameters": {
        "amount": 20
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [2520, 220],
      "id": "bf52f3e2-c6b7-455f-96b0-61c9cf06e81d",
      "name": "Wait - Bypass Rate Limits"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "varTest",
              "name": "varTest",
              "value": "={{ $json.text }}",
              "type": "string"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [2740, 220],
      "id": "a1fe6b1d-581f-45b7-bb0e-aef5a94e2c0e",
      "name": "Edit Fields - Save Response"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list"
        },
        "messages": {
          "values": [
            {
              "content": "System instruction...",
              "role": "system"
            },
            {
              "content": "=Transcript content..."
            },
            {
              "content": "JSON format instructions...",
              "role": "assistant"
            }
          ]
        },
        "jsonOutput": true
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [2960, 220],
      "id": "76e67cb5-b58a-46ed-b61f-ff837a3451a2",
      "name": "OpenAI - Generate Scripts",
      "credentials": {
        "openAiApi": {
          "id": "REDACTED_CREDENTIAL_ID",
          "name": "REDACTED_CREDENTIAL_NAME"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "REDACTED_DOCUMENT_ID",
          "mode": "list"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Title": "={{ $json.message.content.title }}",
            "Script": "={{ $json.message.content.script }}"
          },
          "schema": [
            {
              "id": "Title",
              "type": "string"
            },
            {
              "id": "Script",
              "type": "string"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [3320, 220],
      "id": "63303301-2c0d-45ca-bbb6-093f2c4d22a9",
      "name": "Google Sheets - Update Content Ideas",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "REDACTED_CREDENTIAL_ID",
          "name": "REDACTED_CREDENTIAL_NAME"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "conditions": [
            {
              "leftValue": "= {{ $json.videoUrl.isUrl() }}",
              "rightValue": "true",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ]
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [1980, 100],
      "id": "7b0fa37e-097f-4e1e-a948-5b2602bf7b06",
      "name": "If - URL Broken"
    }
  ],
  "connections": {
    // unchanged for structure
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "REDACTED_VERSION_ID",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "REDACTED_INSTANCE_ID"
  },
  "id": "REDACTED_WORKFLOW_ID",
  "tags": []
}
