N8N AI Automation Agency

WordPress Article Explanation: “Automate Short-Form Video Creation from Long-Form Content Using n8n + KLAP + Google Sheets

🚀 What This Workflow Does

This n8n automation takes a long-form video URL from a Google Sheet, sends it to the KLAP API to generate short-form content, waits for the video to be processed, and then logs the results back into Google Sheets — complete with download links and auto-generated captions for different platforms like YouTube, TikTok, Instagram, and LinkedIn.


🔁 Workflow Steps Breakdown

1. Trigger – Schedule

  • The workflow starts on a schedule, allowing automation to run every few hours or daily.
  • Node: Schedule Trigger

2. Get Input Data – Google Sheets

  • It fetches rows from a Google Sheet where production_status = "for production".
  • Sheet: GET LONG FORM
  • Only the first matching row is used.
  • Node: Google Sheets

3. Send Video to KLAP for Short Creation

  • The longform_links URL is sent to https://api.klap.app/v2/tasks/video-to-shorts.
  • Parameters:
    • 2 short clips requested
    • Captions, emojis, reframing, and silence removal enabled
    • Duration between 15-60s
  • Node: POST Youtube video to KLAP

4. Wait for Processing

  • Waits for 2 minutes before checking the KLAP task status.
  • Node: Wait

5. Check KLAP Status

  • Polls https://api.klap.app/v2/tasks/{{task_id}} to see if the short-form video is “ready”.
  • If not ready, loops back and waits again.
  • Node: Check Shorts from KLAP, then If

6. Fetch Metadata Once Ready

  • Once the video is ready, the next API call fetches metadata including social media captions.
  • Node: HTTP Request2

7. Export Short Video

  • A POST request triggers the export of the video in a sharable format.
  • Node: EXPORT

8. Wait Again for Export Completion

  • Another 2-minute delay to ensure the export finishes.
  • Node: Wait1
  • Makes a final GET request to fetch the short video file.
  • Node: GET SHORTS

10. Final Check: Is Export Ready?

  • Uses another If condition to check if the export is ready.
  • If yes, continues; if not, stops silently (you can add alert logic here).
  • Node: If1

11. Mark Original Entry as Done

  • Updates the original row in GET LONG FORM sheet to mark production_status = done.
  • Node: Google Sheets1

12. Log the Result in Another Sheet

  • Adds a new row to the sheet long form shorts URL with:
    • Short video link
    • Captions for TikTok, YouTube, LinkedIn, Instagram
    • Production status set to for publishing
  • Node: LOG URL SHORTS

🔧 Tools & APIs Used

ToolPurpose
Google SheetsStores the video queue and logs results
KLAP APIConverts long-form videos into short clips
n8nOrchestrates the entire process end-to-end

🛡️ Notes on Security

  • All sensitive API credentials should be stored using n8n’s credential manager.
  • Never hardcode secrets or leave API keys visible in exports or shared workflows.

📈 Customization Ideas

  • Add a Telegram/Slack notification when new short videos are ready.
  • Auto-publish the short to YouTube Shorts or TikTok using publishing APIs.
  • Automatically generate thumbnails using Replicate or OpenAI.

FULL CODE FOR WORKFLOW

				
					{
  "name": "Long form video to Short",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ],
      "id": "b64332fa-ad9f-44a0-9429-943c790dd799",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "10bOThjr_FLlyWlRMAckMCrgXntNhTiAdxINzF6DJP8I",
          "mode": "list",
          "cachedResultName": "veo3 video Generation",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/10bOThjr_FLlyWlRMAckMCrgXntNhTiAdxINzF6DJP8I/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1975242804,
          "mode": "list",
          "cachedResultName": "GET LONG FORM",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/10bOThjr_FLlyWlRMAckMCrgXntNhTiAdxINzF6DJP8I/edit#gid=1975242804"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "production_status",
              "lookupValue": "for production"
            }
          ]
        },
        "options": {
          "returnFirstMatch": true
        }
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        220,
        0
      ],
      "id": "15c96ba7-4c67-4dfb-832f-970a71d486fd",
      "name": "Google Sheets",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "API_KEY_HERE",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "amount": 2,
        "unit": "minutes"
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        220,
        220
      ],
      "id": "12255dcd-9406-498d-b6f7-dd0bdab18328",
      "name": "Wait",
      "webhookId": "5fa423c7-ae07-4ffe-8c58-ea2ad3510b7e"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "05baa47e-c88d-498b-bf66-14fd381c2a1e",
              "leftValue": "={{ $json.status }}",
              "rightValue": "ready",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        660,
        180
      ],
      "id": "a9663cf9-e318-4cb7-bc28-aa46e44b4ce9",
      "name": "If"
    },
    {
      "parameters": {
        "url": "=https://api.klap.app/v2/projects/{{ $json.output_id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        920,
        220
      ],
      "id": "746b1d69-f9d9-438e-a00f-246b4cbed99b",
      "name": "HTTP Request2",
      "credentials": {
        "httpHeaderAuth": {
          "id": "API_KEY_HERE",
          "name": "KLAP API"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.klap.app/v2/projects/{{ $json.folder_id }}/{{ $json.id }}/exports",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"preset_id\": \"123\"\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        20,
        580
      ],
      "id": "51b7f444-c2e7-44f6-9d5b-7fec438ac127",
      "name": "EXPORT",
      "credentials": {
        "httpHeaderAuth": {
          "id": "API_KEY_HERE",
          "name": "KLAP API"
        }
      }
    },
    {
      "parameters": {
        "amount": 2,
        "unit": "minutes"
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        200,
        580
      ],
      "id": "cddb5abc-3d95-4c80-906b-3f5a08725069",
      "name": "Wait1",
      "webhookId": "a301466e-30f1-44c1-a6e2-c533d1341b7d"
    },
    {
      "parameters": {
        "url": "=https://api.klap.app/v2/projects/{{ $json.folder_id }}/{{ $json.id }}/exports/{{ $json.id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        380,
        580
      ],
      "id": "e8222232-9298-4aeb-96a8-fc55ed4a51c8",
      "name": "GET SHORTS",
      "credentials": {
        "httpHeaderAuth": {
          "id": "API_KEY_HERE",
          "name": "KLAP API"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "05baa47e-c88d-498b-bf66-14fd381c2a1e",
              "leftValue": "={{ $json.status }}",
              "rightValue": "ready",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        560,
        580
      ],
      "id": "c2e35c36-6136-4823-b7e0-e8b3e4f8d322",
      "name": "If1"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "10bOThjr_FLlyWlRMAckMCrgXntNhTiAdxINzF6DJP8I",
          "mode": "list",
          "cachedResultName": "veo3 video Generation",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/10bOThjr_FLlyWlRMAckMCrgXntNhTiAdxINzF6DJP8I/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1975242804,
          "mode": "list",
          "cachedResultName": "GET LONG FORM",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/10bOThjr_FLlyWlRMAckMCrgXntNhTiAdxINzF6DJP8I/edit#gid=1975242804"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "production_status": "done",
            "id": "={{ $('Google Sheets').item.json.id }}",
            "date_produced": "1st august"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "longform_links",
              "displayName": "longform_links",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "production_status",
              "displayName": "production_status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "date_produced",
              "displayName": "date_produced",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        760,
        580
      ],
      "id": "27df04a8-e109-42a7-802a-16750fda35e6",
      "name": "Google Sheets1",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "API_KEY_HERE",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "10bOThjr_FLlyWlRMAckMCrgXntNhTiAdxINzF6DJP8I",
          "mode": "list",
          "cachedResultName": "veo3 video Generation",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/10bOThjr_FLlyWlRMAckMCrgXntNhTiAdxINzF6DJP8I/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1029168704,
          "mode": "list",
          "cachedResultName": "long form shorts URL",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/10bOThjr_FLlyWlRMAckMCrgXntNhTiAdxINzF6DJP8I/edit#gid=1029168704"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "id": "=ROW()-1",
            "SHORTFORM LINKS": "={{ $('GET SHORTS').item.json.src_url }}",
            "tiktok_caption": "={{ $('HTTP Request2').item.json.publication_captions.tiktok }}",
            "YT_caption": "={{ $('HTTP Request2').item.json.publication_captions.youtube }}",
            "linkedin_caption": "={{ $('HTTP Request2').item.json.publication_captions.linkedin }}",
            "insta_caption": "={{ $('HTTP Request2').item.json.publication_captions.instagram }}",
            "production_status": "for publishing"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "SHORTFORM LINKS",
              "displayName": "SHORTFORM LINKS",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "tiktok_caption",
              "displayName": "tiktok_caption",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "insta_caption",
              "displayName": "insta_caption",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "linkedin_caption",
              "displayName": "linkedin_caption",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "YT_caption",
              "displayName": "YT_caption",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "production_status",
              "displayName": "production_status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "date_produced",
              "displayName": "date_produced",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        940,
        580
      ],
      "id": "09a0d189-b07b-4b34-af68-33707db1000c",
      "name": "LOG URL SHORTS",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "API_KEY_HERE",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.klap.app/v2/tasks/video-to-shorts",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"source_video_url\": \"{{ $json.longform_links }}\",\n  \"language\": \"en\",\n  \"target_clip_count\": 2,\n  \"max_clip_count\": 2,\n  \"editing_options\": {\n    \"captions\": true,\n    \"reframe\": true,\n    \"emojis\": true,\n    \"remove_silences\": true,\n    \"intro_title\": false\n  },\n  \"dimensions\": {\n    \"width\": 1080,\n    \"height\": 1920\n  },\n  \"min_duration\": 15,\n  \"max_duration\": 60,\n  \"target_duration\": 30\n}\n",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        20,
        220
      ],
      "id": "d7dfb6ec-a50d-4bf6-b5bb-2eb34fd1d62e",
      "name": "POST Youtube video to KLAP",
      "credentials": {
        "httpHeaderAuth": {
          "id": "API_KEY_HERE",
          "name": "KLAP API"
        }
      }
    },
    {
      "parameters": {
        "url": "=https://api.klap.app/v2/tasks/{{ $json.id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        220
      ],
      "id": "b2bcbc47-3948-4ed3-aa2b-61a3c0b6f3ea",
      "name": "Check Shorts from KLAP",
      "credentials": {
        "httpHeaderAuth": {
          "id": "API_KEY_HERE",
          "name": "KLAP API"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "POST Youtube video to KLAP",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Check Shorts from KLAP",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "HTTP Request2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request2": {
      "main": [
        [
          {
            "node": "EXPORT",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "EXPORT": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "GET SHORTS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET SHORTS": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Google Sheets1",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Google Sheets1": {
      "main": [
        [
          {
            "node": "LOG URL SHORTS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "POST Youtube video to KLAP": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Shorts from KLAP": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7f20567b-55d3-417a-b477-7a4cd21058ef",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "5459891812e7c4f47e0f9c614e88405f4156733b257e9461734291e116432123"
  },
  "id": "gNtp643dSyMRuiZs",
  "tags": [
    {
      "createdAt": "2025-07-22T14:43:37.306Z",
      "updatedAt": "2025-07-22T14:43:37.306Z",
      "id": "RociHmxfByNRguIJ",
      "name": "Sucess"
    }
  ]
}
				
			
Scroll to Top