{
  "name": "Voice AI Appointment Booking (Cal.com)",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "appointment-webhook",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -920,
        -300
      ],
      "id": "3e06b563-87a9-4005-8149-8f39fac47ecb",
      "name": "Webhook",
      "webhookId": "6bf58670-db19-4610-b58f-3f76c258151a"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.2,
      "position": [
        -220,
        -300
      ],
      "id": "adf810f0-b269-4c6a-9982-bfc2d32e799d",
      "name": "Respond to Webhook"
    },
    {
      "parameters": {
        "url": "https://api.cal.com/v1/slots",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "calApi",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "startTime",
              "value": "={{ $json.body.startTime }}"
            },
            {
              "name": "endTime",
              "value": "={{DateTime.fromISO($json.body.startTime, { zone: 'America/New_York' })\n  .set({ hour: 18, minute: 0, second: 0 })\n.format(\"yyyy-MM-dd'T'HH:mm:ssZZ\")}}"
            },
            {
              "name": "eventTypeId",
              "value": "event_type_id"
            },
            {
              "name": "timeZone",
              "value": "America/New_York"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -500,
        -400
      ],
      "id": "3485a1b7-ab24-426d-9563-6907b10c8bbd",
      "name": "Check available slot in Cal.com",
      "credentials": {
        "calApi": {
          "id": "BPZVCd8ig7dnGmbI",
          "name": "Cal account"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.cal.com/v1/bookings",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "calApi",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"eventTypeId\": event_type_id,\n  \"start\": \"{{ $json.body.startTime }}\",\n  \"end\": \"{{ DateTime.fromISO($json.body.startTime).plus({ minutes: 30 }).format(\"yyyy-MM-dd'T'HH:mm:ssZZ\") }}\",\n  \"responses\": {\n    \"name\": \"{{ $json.body.name }}\",\n    \"email\": \"{{ $json.body.email }}\"\n  },\n  \"timeZone\": \"America/New_York\",\n  \"language\": \"en\",\n  \"title\": \"Test\",\n\"metadata\":{}\n} ",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -500,
        -200
      ],
      "id": "32acbf55-6490-4e40-a9c4-cbac270ee248",
      "name": "Book an Appointment",
      "credentials": {
        "calApi": {
          "id": "BPZVCd8ig7dnGmbI",
          "name": "Cal account"
        }
      }
    },
    {
      "parameters": {
        "content": "## ElevenLabs Setup\n\n### First Message:\n- Thanks for calling to Forgent Systems. How can i help you?\n\n### System Prompt:\n\n#### 1. Personality\nYou are a clear, helpful, and respectful assistant focused solely on **booking appointments** for clients.\n- **Identity**: A virtual appointment scheduler.\n- **Core Traits**: Polite, efficient, conversational, respectful.\n- **Role**: Guide users through choosing a time, checking availability, and finalizing the booking.\n\n#### 2. Tone\nYour tone is polite, professional, and engaging-friendly enough to feel human, but focused enough to stay on task.\n- Use conversational cues like “Okay,” “Got it,” “Sounds good,” etc.  \n- Maintain a warm but efficient pacing.  \n- Speak clearly and respectfully at all times.  \n- Ensure the conversation is helpful and pleasant while staying on-topic.\n#### 3. Goal\nYour task is to **book an appointment** for the client.\n#### Step-by-step Conversation Flow\n1. **Greeting & Purpose**\n   - Greet politely and state purpose.\n   - Example: “Hi! I’m here to help you book an appointment.”\n2. **Request Preferred Time**\n   - Ask: “Can you please tell me your preferred time slot for the appointment?”\n   - Understand user's date and if not clear then ask full date with month and year.\n3. **Check Availability**\n   - Use the `checkAvailableSlot` tool with the user’s preferred time.\n   - If the slot **is available**:\n     - Confirm with the user: “That slot is available. Should I go ahead and book it for you?”\n     - If user agrees → Use `bookSlot`.\n   - If the slot **is not available**:\n     - Say: “It looks like that time isn’t available... Would you like to look for the same time on the next day?”\n4. **Handle Next-Day Option**\n   - If the user agrees, check availability for the same time on the next day using `checkAvailableSlot`.\n     - If available → confirm and use `bookSlot`.\n     - If not → politely inform and ask for a different time.\n\n5. **Close the Call**\n   - Confirm the booking if done.\n   - Example: “Great! Your appointment is booked. Thank you and have a wonderful day!”\n#### 4. Guardrails\n- **Do not** discuss anything unrelated to appointment booking.\n- If the user asks for something outside your scope:\n  - Say: “I’m only here to help with appointment bookings. For other questions, please contact our support team.”\n- Never speculate about unavailable data or functions.\n- Never ask date format from User like Say date in Day Month and Year format. If you can't understand user date then say Please speak full date.\n\n#### 5. Tools\nYou can use the following tools to help book appointments:\n- `checkAvailableSlot`: Use this to check if the user’s requested time is open.\n- `bookSlot`: Use this to confirm the appointment after the user agrees.\n\n#### End call\n- Always says Thanks for reaching with us. Have a nice day.",
        "height": 1480,
        "width": 760
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2260,
        -640
      ],
      "typeVersion": 1,
      "id": "14b29f46-6526-4f69-89b7-91227125fec1",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## Tool Setup \n1. Name: bookSlot\n#### Description:\n- Use this tool when user confirm their slot and appointment. When you have proper name and email of their. \n\n#### POST: webhook_url\n\n2. Name: checkAvailableSlot\n#### Description:\n- Use this slot for check Available slots in our calender.\n#### POST: webhook_url",
        "height": 340,
        "width": 480,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1480,
        -400
      ],
      "typeVersion": 1,
      "id": "3b9a28d0-f4ce-45c4-94bd-b626b0cedfc8",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "249d32bd-5a1d-44fe-8b33-975827cef795",
              "leftValue": "={{ $json.body.tool }}",
              "rightValue": "checkAvailableSlot",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -720,
        -300
      ],
      "id": "2147f80e-0110-4b4b-8952-585aeefb2509",
      "name": "Check Is Request For Available Slot"
    },
    {
      "parameters": {
        "content": "## Cal.com  Setup\n\n- Go to cal.com and generate API Key.\n- Create new Cal API credentials in n8n.\n- Set this API Key in this credentials.",
        "width": 480
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1480,
        -40
      ],
      "typeVersion": 1,
      "id": "27c47a37-c44f-47b9-ab90-fb03919e912d",
      "name": "Sticky Note2"
    }
  ],
  "pinData": {},
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Check Is Request For Available Slot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check available slot in Cal.com": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Book an Appointment": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Is Request For Available Slot": {
      "main": [
        [
          {
            "node": "Check available slot in Cal.com",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Book an Appointment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5370a5d4-c070-4a98-b703-612a15c6582f",
  "meta": {
    "instanceId": "f1c26778ec36097a9722a22c47c5e9c01f00b8862dadd0121ec118026a370fa6"
  },
  "id": "YxjYqzSdfVeBWmbl",
  "tags": []
}