{
  "name": "molehill.io script to video automation",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        -32,
        -128
      ],
      "id": "88815cf5-aef0-4a10-b176-86cd1083c7e0",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -32,
        32
      ],
      "id": "3929019e-78fe-43fc-9ef1-0121e474a6e1",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "documentId": {},
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ABn9Jx3EhuLGrGE0E7GTaR-OJY1QwfzxamD9qYA3bc0/edit#gid=0"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "Status",
              "lookupValue": "Pending"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        240,
        -48
      ],
      "id": "9a9f7237-00c3-4fb2-be6e-97a70473b246",
      "name": "Get row(s) in sheet",
      "credentials": {}
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {},
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ABn9Jx3EhuLGrGE0E7GTaR-OJY1QwfzxamD9qYA3bc0/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "row_number": "={{ $json.row_number }}",
            "Status": "Processing"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "Video Idea",
              "displayName": "Video Idea",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Video URL",
              "displayName": "Video URL",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        448,
        -224
      ],
      "id": "1bb85596-7794-4ce9-be3d-bd842172c45a",
      "name": "Update row in sheet",
      "credentials": {}
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are a viral YouTube Shorts script writer. Create a short, punchy script (under 20 seconds when read aloud) for:\n\n{{ $json['Video Idea'] }}\n\nRequirements:\n- Hook the viewer in the first 3 seconds\n- Use simple, conversational language\n- Include emotional triggers (curiosity, surprise, humor)\n- End with a clear call-to-action\n- Format: [SCENE 1] [Description] [Voiceover]\n\nReturn only the script, nothing else.",
        "batching": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.7,
      "position": [
        448,
        -48
      ],
      "id": "91a35697-5563-41e2-8bd5-3a195224f07e",
      "name": "Basic LLM Chain"
    },
    {
      "parameters": {
        "model": "google/gemini-2.5-flash",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        448,
        128
      ],
      "id": "25d202e9-ce8f-4511-97d1-98e5892c5349",
      "name": "OpenRouter Chat Model",
      "credentials": {}
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://queue.fal.run/fal-ai/kling-video/v2/master/text-to-video",
        "authentication": "",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"prompt\": \"Create a 5 second short form video with the following script:\\n\\n{{ $json.text.replaceAll('\\n','')}}\",\n  \"duration\": \"5\",\n  \"aspect_ratio\": \"9:16\"\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        752,
        -48
      ],
      "id": "f645a22b-c592-4f70-844b-4f548283ee52",
      "name": "Create Video",
      "credentials": {}
    },
    {
      "parameters": {
        "url": "=https://queue.fal.run/fal-ai/kling-video/requests/{{ $json.request_id }}/status",
        "authentication": "",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        960,
        -48
      ],
      "id": "abc252e7-76eb-47d8-a84e-dbc66fa2211e",
      "name": "Check Status",
      "credentials": {}
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "c7cc41cc-71bb-4707-8ca6-c57c51776643",
              "leftValue": "={{ $json.status }}",
              "rightValue": "COMPLETED",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1168,
        -48
      ],
      "id": "1068414c-1c89-460c-ac86-caec01b236e6",
      "name": "If"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1168,
        192
      ],
      "id": "7124f602-ca33-4099-93e7-b2d646c7add7",
      "name": "Wait"
    },
    {
      "parameters": {
        "url": "={{ $json.response_url }}",
        "authentication": "",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        1376,
        -144
      ],
      "id": "017ca047-b162-426c-9474-04c8a85e6337",
      "name": "HTTP Request",
      "credentials": {}
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {},
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ABn9Jx3EhuLGrGE0E7GTaR-OJY1QwfzxamD9qYA3bc0/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "row_number": "={{ $('Get row(s) in sheet').item.json.row_number }}",
            "Video URL": "={{ $json.video.url }}",
            "Status": "Completed"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "Video Idea",
              "displayName": "Video Idea",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Video URL",
              "displayName": "Video URL",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1584,
        -144
      ],
      "id": "03c9a92a-bb9f-4588-b7c1-db91bcecd27c",
      "name": "Update Sheet with Video",
      "credentials": {}
    }
  ],
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet": {
      "main": [
        []
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Create Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Video": {
      "main": [
        [
          {
            "node": "Check Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Status": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Check Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Update Sheet with Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9021e126-3cc0-47e5-91db-3e0aaae0a056",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "u53F5OQXPlf8J6kl",
  "tags": []
}