{
  "name": "PII-Shielded Dental & Med-Spa Appointment Booking AI Agent (reversemask)",
  "nodes": [
    {
      "parameters": {},
      "id": "start",
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [250, 300]
    },
    {
      "parameters": {
        "url": "https://reversemask.onrender.com/mask",
        "method": "POST",
        "jsonParameters": true,
        "options": {},
        "bodyParametersJson": "={\n  \"text\": \"{{ $json.body }}\",\n  \"known_pii\": {\n    \"name\": \"{{ $json.contact.name }}\",\n    \"email\": \"{{ $json.contact.email }}\",\n    \"phone\": \"{{ $json.contact.phone }}\"\n  }\n}"
      },
      "id": "mask",
      "name": "reversemask /mask",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [500, 200],
      "credentials": {}
    },
    {
      "parameters": {
        "model": "gpt-4o-mini",
        "messages": [
          {
            "role": "system",
            "content": "You are a helpful assistant for booking appointments. Use the book_appointment tool when the user provides their details."
          },
          {
            "role": "user",
            "content": "={{ $json.masked_text }}"
          }
        ],
        "tools": [
          {
            "name": "book_appointment",
            "description": "Book an appointment for a lead",
            "parameters": {
              "type": "object",
              "properties": {
                "name": { "type": "string", "description": "Lead name" },
                "email": { "type": "string", "description": "Lead email" },
                "phone": { "type": "string", "description": "Lead phone" },
                "preferred_time": { "type": "string", "description": "Preferred appointment time" }
              },
              "required": ["name", "email"]
            }
          }
        ],
        "options": {}
      },
      "id": "llm",
      "name": "LLM Agent (OpenAI)",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1.2,
      "position": [750, 200],
      "credentials": {
        "openAiApi": "openAiApi"
      }
    },
    {
      "parameters": {
        "url": "https://reversemask.onrender.com/unmask",
        "method": "POST",
        "jsonParameters": true,
        "options": {},
        "bodyParametersJson": "={\n  \"payload\": {{ $json.toolCalls }},\n  \"vault_bundle\": \"{{ $json.vault_bundle }}\"\n}"
      },
      "id": "unmask",
      "name": "reversemask /unmask",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [1000, 200],
      "credentials": {}
    },
    {
      "parameters": {
        "url": "https://your-ghl-instance.com/api/v1/calendar/events",
        "method": "POST",
        "jsonParameters": true,
        "options": {},
        "bodyParametersJson": "={{ $json.unmasked_payload }}"
      },
      "id": "ghl_calendar",
      "name": "GoHighLevel - Book Appointment",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [1250, 200],
      "credentials": {}
    }
  ],
  "connections": {
    "Start": {
      "main": [["reversemask /mask"]]
    },
    "reversemask /mask": {
      "main": [["LLM Agent (OpenAI)"]]
    },
    "LLM Agent (OpenAI)": {
      "main": [["reversemask /unmask"]]
    },
    "reversemask /unmask": {
      "main": [["GoHighLevel - Book Appointment"]]
    }
  },
  "active": false,
  "settings": {},
  "versionId": "1.0.0"
}