{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "f57bfeb3-65d7-45c3-85fa-45f4c0e94d9f",
      "name": "Create or update a record",
      "type": "n8n-nodes-base.airtable",
      "position": [
        944,
        400
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appCV1g03wAMk91ZL",
          "cachedResultUrl": "https://airtable.com/appCV1g03wAMk91ZL",
          "cachedResultName": "contacts"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblvmGsSf7xTDtIwS",
          "cachedResultUrl": "https://airtable.com/appCV1g03wAMk91ZL/tblvmGsSf7xTDtIwS",
          "cachedResultName": "Zoom Meeting Log"
        },
        "columns": {
          "value": {
            "Host": "={{ $json.host }}",
            "Topic": "={{ $json.topic }}",
            "File Size": "={{ $json.file_type }}",
            "File Type": "Other",
            "Meeting ID": "={{ $json.meeting_id }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true
            },
            {
              "id": "Meeting ID",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Meeting ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Topic",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Topic",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Host",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Host",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "File Type",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "MP4",
                  "value": "MP4"
                },
                {
                  "name": "M4A",
                  "value": "M4A"
                },
                {
                  "name": "Other",
                  "value": "Other"
                }
              ],
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "File Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "File Size",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "File Size",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Google Drive Saved",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "Yes",
                  "value": "Yes"
                },
                {
                  "name": "No",
                  "value": "No"
                }
              ],
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Google Drive Saved",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Timestamp",
              "type": "dateTime",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Related Contact",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Related Contact",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "upsert"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a3d54194-cfb0-4497-8600-95399203959d",
      "name": "Log Result",
      "type": "n8n-nodes-base.code",
      "position": [
        768,
        400
      ],
      "parameters": {
        "jsCode": "// Collect metadata + Drive result\nconst driveFile = $input.first().json;\nconst prev = $('Normalize Recording Data').item.json;\n\nreturn {\n  json: {\n    ...prev,\n    saved_to_drive: true,\n    drive_file_id: driveFile.id,\n    drive_link: driveFile.webViewLink\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "03064eac-432f-452b-8170-6e661b7f39b0",
      "name": "Upload to Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        576,
        400
      ],
      "parameters": {
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "fede097e-50ae-452c-b317-819629e31d97",
      "name": "Download Recording",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        368,
        400
      ],
      "parameters": {
        "url": "={{ $json.file_url }}",
        "options": {}
      },
      "typeVersion": 4.1
    },
    {
      "id": "606783f7-091d-488b-bef8-12d25b88a42a",
      "name": "Normalize Recording Data",
      "type": "n8n-nodes-base.code",
      "position": [
        176,
        400
      ],
      "parameters": {
        "jsCode": "// Normalize Zoom webhook payload\nconst event = $input.first().json;\nconst recording = event.payload.object.recording_files[0];\n\nreturn {\n  json: {\n    meeting_id: event.payload.object.id,\n    topic: event.payload.object.topic,\n    host: event.payload.object.host_email,\n    file_url: recording.download_url,\n    file_type: recording.file_type,\n    file_size: recording.file_size,\n    timestamp: new Date().toISOString()\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "e33a40c8-508e-43af-9b4f-991b35ec2f4a",
      "name": "Zoom Recording Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -32,
        400
      ],
      "parameters": {
        "path": "zoom-recording",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 1
    },
    {
      "id": "c82aaea6-6404-456b-991b-59674090864f",
      "name": "Setup Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        192
      ],
      "parameters": {
        "content": "\ud83c\udfa5 **SETUP REQUIRED:**\n\n1. **Zoom Setup:**\n   - Create Zoom App \u2192 enable recording.completed event\n   - Add webhook URL from this workflow\n\n2. **Google Drive:**\n   - Connect OAuth\n   - Replace `YOUR_FOLDER_ID`\n\n3. **Airtable:**\n   - Create base \u2192 Table: `Meeting Logs`\n   - Columns: Meeting ID | Topic | Host | File Type | File Size | Google Drive Saved | Drive Link | Timestamp\n   - Replace `YOUR_AIRTABLE_BASE_ID`\n\n\u26a1 Saves Zoom recordings to Drive + logs metadata in Airtable!"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Log Result": {
      "main": [
        [
          {
            "node": "Create or update a record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Recording": {
      "main": [
        [
          {
            "node": "Upload to Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Google Drive": {
      "main": [
        [
          {
            "node": "Log Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Zoom Recording Webhook": {
      "main": [
        [
          {
            "node": "Normalize Recording Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Recording Data": {
      "main": [
        [
          {
            "node": "Download Recording",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}