{
  "name": "Create real estate listing video ads with Videotok",
  "nodes": [
    {
      "parameters": {
        "content": "## Real estate listing video ads\n\nTurns a property listing into a vertical video ad, caption, and review handoff using OpenAI and the Videotok API.\n\nReplace the sample listing with your CRM, Airtable, Google Sheets, MLS export, or website scraper.\n\nRequired variables: VIDEOTOK_API_KEY, OPENAI_API_KEY, VIDEOTOK_BRAND_KIT_ID.",
        "height": 340,
        "width": 520,
        "color": 7
      },
      "id": "note-overview",
      "name": "Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [-700, -300]
    },
    {
      "parameters": {},
      "id": "manual",
      "name": "Manual listing test",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [-620, 120]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "address",
              "name": "address",
              "type": "string",
              "value": "Via Torino 21, Milan"
            },
            {
              "id": "details",
              "name": "listing_details",
              "type": "string",
              "value": "Bright two-bedroom apartment, renovated kitchen, balcony, close to metro and parks."
            },
            {
              "id": "images",
              "name": "listing_image_urls",
              "type": "array",
              "value": [
                "https://example.com/living-room.jpg",
                "https://example.com/kitchen.jpg"
              ]
            }
          ]
        }
      },
      "id": "listing-source",
      "name": "Replace with real estate listing source",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [-360, 120]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.openai.com/v1/responses",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{$vars.OPENAI_API_KEY}}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\"model\":\"gpt-4.1-mini\",\"input\":\"Create real-estate video ad JSON. Include title, hook, script, generation_prompt, caption, compliance_notes. Avoid unsupported claims. Input: \" + JSON.stringify($json)}"
      },
      "id": "openai-real-estate",
      "name": "OpenAI writes listing ad",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [-80, 120]
    },
    {
      "parameters": {
        "jsCode": "const listing = $('Replace with real estate listing source').first().json;\nconst raw = $input.first().json.output_text || '{}';\nlet brief;\ntry { brief = JSON.parse(raw); } catch { brief = { title: listing.address, generation_prompt: raw, caption: raw }; }\nreturn [{ json: { type: 'video_ad', template_slug: 'viral-video-ads', prompt: brief.generation_prompt, aspect_ratio: '9:16', duration: 8, quality_tier: 'high', reference_image_urls: listing.listing_image_urls || [], brand_kit_id: $vars.VIDEOTOK_BRAND_KIT_ID, idempotency_key: `real-estate-listing-${$execution.id}`, caption: brief.caption, compliance_notes: brief.compliance_notes } }];"
      },
      "id": "prepare-listing",
      "name": "Prepare Videotok listing payload",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [220, 120]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://videotok.app/api/v1/generations",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{$vars.VIDEOTOK_API_KEY}}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Idempotency-Key",
              "value": "={{$json.idempotency_key}}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{$json}}"
      },
      "id": "create-listing-ad",
      "name": "Create Videotok listing ad",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [540, 120]
    }
  ],
  "connections": {
    "Manual listing test": {
      "main": [
        [
          {
            "node": "Replace with real estate listing source",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Replace with real estate listing source": {
      "main": [
        [{ "node": "OpenAI writes listing ad", "type": "main", "index": 0 }]
      ]
    },
    "OpenAI writes listing ad": {
      "main": [
        [
          {
            "node": "Prepare Videotok listing payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Videotok listing payload": {
      "main": [
        [{ "node": "Create Videotok listing ad", "type": "main", "index": 0 }]
      ]
    }
  },
  "pinData": {},
  "settings": { "executionOrder": "v1" },
  "tags": ["videotok", "openai", "real estate", "listing ads"],
  "active": false,
  "versionId": "videotok-real-estate-listing-video-ads-1"
}
