{
  "id": "s5rkGHiTGnf7F9PT",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Restaurant Virtual Receptionist & Table Booking with VAPI and n8n",
  "tags": [],
  "nodes": [
    {
      "id": "aa3b9f79-7923-47df-87d8-72ceaa3f0127",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -580,
        -380
      ],
      "parameters": {
        "width": 420,
        "height": 200,
        "content": "\ud83d\udcdd Description\n\nHandles incoming calls for the restaurant using VAPI to collect user details (name, booking time, number of people), checks table availability in a PostgreSQL database via n8n, books the table if available, sends confirmation to VAPI, and provides hotel service details via VAPI.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0cc6d135-9098-4be1-8de3-fe027653d3d9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        20
      ],
      "parameters": {
        "color": 3,
        "width": 780,
        "height": 280,
        "content": "                             \ud83d\udfe2 Availability Check Flow\n"
      },
      "typeVersion": 1
    },
    {
      "id": "511c9929-3614-4d09-b1b6-27c14ce304a7",
      "name": "Query Table Availability (Postgres)",
      "type": "n8n-nodes-base.postgres",
      "position": [
        220,
        100
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "table_id"
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "options": {},
        "operation": "select"
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.6
    },
    {
      "id": "08671a05-f26e-477a-80ab-b6885e10dfd6",
      "name": "Respond: Availability Status (VAPI)",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        440,
        100
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={\n    \"results\": [\n        {\n            \"toolCallId\": \"{{ $('Trigger: Booking Request (VAPI)\t').item.json.body.message.toolCalls[0].id }}\",\n            \"result\":  \"{{ $json.available }}\"\n        }\n    ]\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "3efaa272-9bdb-4db1-bb63-94ffca5a161e",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        -260
      ],
      "parameters": {
        "color": 4,
        "width": 780,
        "height": 280,
        "content": "                                 \ud83d\udd35 Booking Flow\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0fbfd74a-e2a4-4666-9055-c5d588ad6cff",
      "name": "Trigger: Booking Request (VAPI)\t",
      "type": "n8n-nodes-base.webhook",
      "position": [
        0,
        100
      ],
      "parameters": {
        "path": "027f0f14-93f4-42ff-90a7-715f23316a86",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "13d32034-198f-4429-9515-f71275ff2333",
      "name": "Upsert Booking in Postgres\t",
      "type": "n8n-nodes-base.postgres",
      "position": [
        220,
        -160
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "table_id"
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "upsert"
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.6
    },
    {
      "id": "16c88128-1e44-42df-bbd3-2cd7b1c2e6b0",
      "name": "Respond: Booking Confirmation (VAPI)\t",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        440,
        -160
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={\n    \"results\": [\n        {\n            \"toolCallId\": \"{{ $('Trigger: Booking Request (VAPI)\t1').item.json.body.message.toolCalls[0].id }}\",\n            \"result\": \"{{ $json.status }}\"\n        }\n    ]\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "ee35e567-9de8-4518-a66f-0d168a973544",
      "name": "Trigger: Booking Request (VAPI)\t1",
      "type": "n8n-nodes-base.webhook",
      "position": [
        0,
        -160
      ],
      "parameters": {
        "path": "2f7eff83-2e85-45ee-b544-7f889ca3ad07",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "settings": {
    "timezone": "Asia/Kolkata",
    "callerPolicy": "workflowsFromSameOwner",
    "executionOrder": "v1"
  },
  "versionId": "50da786a-d8c6-4453-9bbe-835b7b673c43",
  "connections": {
    "Upsert Booking in Postgres\t": {
      "main": [
        [
          {
            "node": "Respond: Booking Confirmation (VAPI)\t",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger: Booking Request (VAPI)\t": {
      "main": [
        [
          {
            "node": "Query Table Availability (Postgres)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger: Booking Request (VAPI)\t1": {
      "main": [
        [
          {
            "node": "Upsert Booking in Postgres\t",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query Table Availability (Postgres)": {
      "main": [
        [
          {
            "node": "Respond: Availability Status (VAPI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}