{
  "name": "Voice Agent — BookSlots tool",
  "nodes": [
    {
      "parameters": { "httpMethod": "POST", "path": "voice/book-slot", "responseMode": "responseNode" },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "name": "Vapi Tool Call",
      "position": [240, 300]
    },
    {
      "parameters": {
        "operation": "create",
        "calendar": "primary",
        "start": "={{ $json.body.start }}",
        "end": "={{ $json.body.end }}",
        "summary": "=Appt: {{ $json.body.caller_name }}",
        "description": "=Booked by AI voice agent. Phone: {{ $json.body.caller_phone }}. Consent to record: {{ $json.body.consent }}"
      },
      "type": "n8n-nodes-base.googleCalendar",
      "typeVersion": 1,
      "name": "Create Event",
      "position": [520, 300]
    },
    {
      "parameters": {
        "operation": "create",
        "base": "={{ $env.AIRTABLE_BASE }}",
        "table": "Calls",
        "columns": {
          "caller_name": "={{ $json.body.caller_name }}",
          "phone": "={{ $json.body.caller_phone }}",
          "booked_for": "={{ $json.body.start }}",
          "consent_to_record": "={{ $json.body.consent }}"
        }
      },
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2,
      "name": "Log Call",
      "position": [800, 300]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={ \"status\": \"booked\", \"start\": \"{{ $json.body.start }}\" }"
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "name": "Respond to Vapi",
      "position": [1080, 300]
    }
  ],
  "connections": {
    "Vapi Tool Call": { "main": [[{ "node": "Create Event", "type": "main", "index": 0 }]] },
    "Create Event": { "main": [[{ "node": "Log Call", "type": "main", "index": 0 }]] },
    "Log Call": { "main": [[{ "node": "Respond to Vapi", "type": "main", "index": 0 }]] }
  }
}
