{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "290281b9-00dd-4198-a7a4-2e03eef10e42",
      "name": "Main Sticky \u2014 Overview + Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        1696
      ],
      "parameters": {
        "width": 400,
        "height": 748,
        "content": "## \ud83d\udccb Training Video Knowledge Base Builder\n\n### How it works\nThis workflow turns any YouTube training video into a structured knowledge base entry \u2014 automatically. A team member fills out a simple form with the video URL and department or topic name. The workflow sends the video to the WayinVideo API, waits for AI to generate a summary, then checks if highlights are ready. If not ready, it waits and retries. Once confirmed, it saves the title, summary, highlights, and tags to a shared Google Sheet.\n\n### Setup\n1. Replace **YOUR_WAYINVIDEO_API_KEY** in both HTTP Request nodes.\n2. Connect your Google account in the Save to Google Sheet node.\n3. Update the Google Sheets URL to your own spreadsheet.\n4. Your sheet must have columns: Topic/Department, Video URL, Video Title, Key Summary, Highlights, Tags.\n5. Activate and share the form URL with your team.\n\n### Customization tips\n- Increase wait time (default 30s) for longer videos.\n- Add a Slack or email node to notify your team when a new entry is saved.\n- Map {{ $now }} to a Date Added column to auto-log entry dates."
      },
      "typeVersion": 1
    },
    {
      "id": "360a746b-0761-4198-8ebe-06d6529e1eb8",
      "name": "Section \u2014 User Input",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        1776
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "height": 120,
        "content": "## \ud83d\udce5 Section 1 \u2014 User Input\nTeam member submits the training video URL and department name via a simple web form. This triggers the entire workflow automatically."
      },
      "typeVersion": 1
    },
    {
      "id": "3b49b359-1923-46f6-969c-34e0ba950bfd",
      "name": "Section \u2014 AI Video Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        1776
      ],
      "parameters": {
        "color": 5,
        "width": 500,
        "height": 120,
        "content": "## \ud83e\udd16 Section 2 \u2014 AI Video Processing\nVideo URL is sent to WayinVideo API to generate a summary. Workflow waits 30 seconds, then polls the API for the completed result."
      },
      "typeVersion": 1
    },
    {
      "id": "afc36f1f-1067-40c6-977f-0ceed876a853",
      "name": "Section \u2014 Retry Check",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        1760
      ],
      "parameters": {
        "color": 5,
        "width": 272,
        "height": 136,
        "content": "## \ud83d\udd01 Section 3 \u2014 Retry Check\nChecks if highlights are ready. If yes, saves to Sheet. If not, loops back and retries automatically."
      },
      "typeVersion": 1
    },
    {
      "id": "059addef-d67c-4f4b-a0aa-5a0a44734fba",
      "name": "Warning \u2014 Infinite Retry Risk",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        2144
      ],
      "parameters": {
        "color": 3,
        "width": 608,
        "height": 172,
        "content": "## \u26a0\ufe0f WARNING \u2014 Infinite Retry Risk\nThis node retries indefinitely if WayinVideo never returns highlights. For unsupported or very long videos, the loop may consume many executions. Add a counter or max retry limit before using in production."
      },
      "typeVersion": 1
    },
    {
      "id": "59352db7-342b-4686-8189-8b7b6323fb3d",
      "name": "Section \u2014 Save to Google Sheet",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        1760
      ],
      "parameters": {
        "color": 5,
        "width": 280,
        "height": 120,
        "content": "## \ud83d\udcbe Section 4 \u2014 Save to Knowledge Base\nAppends a new row with video title, summary, highlights, tags, topic/department, and original URL into the shared Google Sheets knowledge base."
      },
      "typeVersion": 1
    },
    {
      "id": "70b966f7-798c-4096-b5ef-34e359a95b87",
      "name": "2. WayinVideo \u2014 Submit Summary Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        32,
        1920
      ],
      "parameters": {
        "url": "https://wayinvideo-api.wayin.ai/api/v2/summaries",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"video_url\": \"{{ $json['Training Video URL'] }}\",\n  \"target_lang\": \"en\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            },
            {
              "name": "x-wayinvideo-api-version",
              "value": "v2"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a273ae03-b799-4af1-a8d8-c2857e0c3d25",
      "name": "3. Wait \u2014 30 Seconds",
      "type": "n8n-nodes-base.wait",
      "position": [
        272,
        1920
      ],
      "parameters": {
        "amount": 30
      },
      "typeVersion": 1.1
    },
    {
      "id": "9a959a26-4272-4cb5-bdf3-1f9855c089a3",
      "name": "4. WayinVideo \u2014 Fetch Summary Result",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        512,
        1920
      ],
      "parameters": {
        "url": "=https://wayinvideo-api.wayin.ai/api/v2/summaries/results/{{ $('2. WayinVideo \u2014 Submit Summary Request').item.json.data.id }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            },
            {
              "name": "x-wayinvideo-api-version",
              "value": "v2"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b513daa0-212e-4ea4-830f-16c8cdd81748",
      "name": "5. Check \u2014 Highlights Ready?",
      "type": "n8n-nodes-base.if",
      "position": [
        720,
        1920
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "71c71aef-c367-4c40-9b73-1baf5e699cc0",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.highlights }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "fbcc3551-2649-465f-8a5d-701dc665b371",
      "name": "6. Save \u2014 Append Row to Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        992,
        1904
      ],
      "parameters": {
        "columns": {
          "value": {
            "Tags": "={{ $json.data.tags.map(tag => `\u2022 ${tag}`).join('\\n') }}",
            "Video URL": "={{ $('1. Form \u2014 Video URL + Topic1').item.json['Training Video URL'] }}",
            "Highlights": "={{ $json.data.highlights\n  .flatMap(item => item.events.map(e => e.desc))\n  .map((desc, i) => `${i + 1}. ${desc}`)\n  .join('\\n\\n')\n}}",
            "Key Summary": "={{ $json.data.summary }}",
            "Video Title": "={{ $json.data.title }}",
            "Topic/Department": "={{ $('1. Form \u2014 Video URL + Topic1').item.json['Topic / Department'] }}"
          },
          "schema": [
            {
              "id": "Topic/Department",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Topic/Department",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Video URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Video URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Video Title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Video Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Key Summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Key Summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Highlights",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Highlights",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Tags",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Tags",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "YOUR_GOOGLE_SHEET_URL",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "YOUR_GOOGLE_SHEET_URL"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "078817c7-9d1c-4aa1-89ba-ec2394a9abb0",
      "name": "1. Form \u2014 Video URL + Topic1",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -240,
        1920
      ],
      "parameters": {
        "options": {},
        "formTitle": "\ud83c\udf93 Training Video Knowledge Base",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Training Video URL",
              "placeholder": "https://www.youtube.com/watch?v=xxxxxxx",
              "requiredField": true
            },
            {
              "fieldLabel": "Topic / Department",
              "placeholder": "e.g. HR Onboarding, Sales Training, Product Demo",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Submit a training video URL \u2014 AI will extract key points and save them automatically to Google Sheets."
      },
      "typeVersion": 2.2
    }
  ],
  "connections": {
    "3. Wait \u2014 30 Seconds": {
      "main": [
        [
          {
            "node": "4. WayinVideo \u2014 Fetch Summary Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1. Form \u2014 Video URL + Topic1": {
      "main": [
        [
          {
            "node": "2. WayinVideo \u2014 Submit Summary Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5. Check \u2014 Highlights Ready?": {
      "main": [
        [
          {
            "node": "6. Save \u2014 Append Row to Google Sheet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "3. Wait \u2014 30 Seconds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4. WayinVideo \u2014 Fetch Summary Result": {
      "main": [
        [
          {
            "node": "5. Check \u2014 Highlights Ready?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2. WayinVideo \u2014 Submit Summary Request": {
      "main": [
        [
          {
            "node": "3. Wait \u2014 30 Seconds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}