{
  "name": "Airtable UGC queue \u2192 TokPortal videos",
  "nodes": [
    {
      "parameters": {
        "content": "## Airtable UGC queue \u2192 TokPortal videos\nEvery hour, pick Airtable records with `Status = Approved`, configure them on the bundle stored in `Bundle ID` / `Position`, publish, and mark the record `Scheduled`.\n\n**Airtable fields:** `Video URL`, `Caption`, `Publish Date` (YYYY-MM-DD), `Bundle ID`, `Position`, `Status`",
        "height": 240,
        "width": 620,
        "color": 4
      },
      "id": "tp-035",
      "name": "Sticky Notetp-034",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -40,
        -260
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 1
            }
          ]
        }
      },
      "id": "tp-036",
      "name": "Every Hour",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        60
      ]
    },
    {
      "parameters": {
        "operation": "search",
        "base": {
          "__rl": true,
          "mode": "url",
          "value": "https://airtable.com/REPLACE_BASE_ID"
        },
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "UGC Queue"
        },
        "filterByFormula": "{Status} = 'Approved'",
        "options": {}
      },
      "id": "tp-037",
      "name": "Airtable: Approved Videos",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2.1,
      "position": [
        220,
        60
      ],
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "video",
        "operation": "configure",
        "bundleId": "={{ $json.fields[\"Bundle ID\"] }}",
        "position": "={{ Number($json.fields[\"Position\"]) }}",
        "videoType": "video",
        "targetPublishDate": "={{ $json.fields[\"Publish Date\"] }}",
        "videoUrl": "={{ $json.fields[\"Video URL\"] }}",
        "description": "={{ $json.fields[\"Caption\"] }}",
        "additionalFields": {
          "external_ref": "={{ \"airtable-\" + $json.id }}",
          "auto_publish": true
        }
      },
      "id": "tp-038",
      "name": "Configure Video Slot",
      "type": "n8n-nodes-tokportal.tokPortal",
      "typeVersion": 1,
      "position": [
        460,
        60
      ],
      "credentials": {
        "tokPortalApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "base": {
          "__rl": true,
          "mode": "url",
          "value": "https://airtable.com/REPLACE_BASE_ID"
        },
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "UGC Queue"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "id": "={{ $(\"Airtable: Approved Videos\").item.json.id }}",
            "Status": "Scheduled",
            "TokPortal Video ID": "={{ $json.id || $json.video_id }}"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "displayName": "Status",
              "type": "string"
            },
            {
              "id": "TokPortal Video ID",
              "displayName": "TokPortal Video ID",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "tp-039",
      "name": "Airtable: Mark Scheduled",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2.1,
      "position": [
        700,
        60
      ],
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Every Hour": {
      "main": [
        [
          {
            "node": "Airtable: Approved Videos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Airtable: Approved Videos": {
      "main": [
        [
          {
            "node": "Configure Video Slot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configure Video Slot": {
      "main": [
        [
          {
            "node": "Airtable: Mark Scheduled",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": [
    {
      "name": "TokPortal"
    }
  ]
}