{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "f4bb496b-81f7-4f01-9ec4-f70853b470dd",
      "name": "Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3440,
        -1552
      ],
      "parameters": {
        "color": 3,
        "width": 460,
        "height": 428,
        "content": "## Insurance Quote Request \u2192 SMS + AI Voice Agent Qualification\n\n**How it works:**\n1. Receives quote request from website form or lead vendor\n2. Normalizes prospect data + insurance type, coverage status, urgency, ZIP\n3. Creates contact in Aloware with quote details in custom fields\n4. Sends instant quote acknowledgment SMS\n5. Routes by urgency: urgent \u2192 AI Voice Agent call, standard \u2192 nurture drip\n\n**Setup:**\n- Set n8n Variables: `ALOWARE_API_TOKEN`, `ALOWARE_LINE_PHONE`, `ALOWARE_AI_SEQUENCE_ID`, `ALOWARE_NURTURE_SEQUENCE_ID`, `AGENCY_NAME`, `AGENT_NAME`\n- Create 2 Aloware Sequences (AI Voice Agent + Nurture)\n- Connect quote form to POST to this webhook URL"
      },
      "typeVersion": 1
    },
    {
      "id": "9861cddd-b699-4230-9548-ff2d92f24cfb",
      "name": "Receive & Create Contact",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4064,
        -1456
      ],
      "parameters": {
        "color": 5,
        "width": 944,
        "height": 276,
        "content": "### \ud83d\udce5 Receive Quote & Create Contact"
      },
      "typeVersion": 1
    },
    {
      "id": "d4f090a4-136e-4d92-a7f7-dfe9478f2e53",
      "name": "Urgency Routing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5072,
        -1520
      ],
      "parameters": {
        "color": 4,
        "width": 660,
        "height": 412,
        "content": "### \ud83d\udd00 Route by Urgency"
      },
      "typeVersion": 1
    },
    {
      "id": "ca03918b-1694-4386-afca-237b65ab4536",
      "name": "AI Voice Tip",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5312,
        -1632
      ],
      "parameters": {
        "width": 400,
        "height": 80,
        "content": "AI Voice Agent should qualify: current coverage, renewal date, coverage amount, # drivers/vehicles, preferred time"
      },
      "typeVersion": 1
    },
    {
      "id": "2f4720c2-8a27-4296-bd4a-ec3c51010f42",
      "name": "Quote Request Received",
      "type": "n8n-nodes-base.webhook",
      "position": [
        4128,
        -1376
      ],
      "parameters": {
        "path": "insurance-quote-request",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "afff34a6-1993-4f06-b209-7cd89dfdf913",
      "name": "Normalize Quote Data",
      "type": "n8n-nodes-base.set",
      "position": [
        4352,
        -1376
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a001",
              "name": "prospectPhone",
              "type": "string",
              "value": "={{ $json.body?.phone || $json.phone || $json.contact?.phone || '' }}"
            },
            {
              "id": "a002",
              "name": "prospectFirstName",
              "type": "string",
              "value": "={{ $json.body?.first_name || $json.first_name || $json.name?.split(' ')[0] || 'there' }}"
            },
            {
              "id": "a003",
              "name": "prospectLastName",
              "type": "string",
              "value": "={{ $json.body?.last_name || $json.last_name || $json.name?.split(' ').slice(1).join(' ') || '' }}"
            },
            {
              "id": "a004",
              "name": "prospectEmail",
              "type": "string",
              "value": "={{ $json.body?.email || $json.email || '' }}"
            },
            {
              "id": "a005",
              "name": "insuranceType",
              "type": "string",
              "value": "={{ $json.body?.insurance_type || $json.insurance_type || $json.type || $json.product || 'General' }}"
            },
            {
              "id": "a006",
              "name": "currentlyInsured",
              "type": "string",
              "value": "={{ $json.body?.currently_insured || $json.currently_insured || 'Unknown' }}"
            },
            {
              "id": "a007",
              "name": "urgency",
              "type": "string",
              "value": "={{ $json.body?.urgency || $json.urgency || $json.timeline || 'standard' }}"
            },
            {
              "id": "a008",
              "name": "leadSource",
              "type": "string",
              "value": "={{ $json.body?.source || $json.source || $json.utm_source || 'Website' }}"
            },
            {
              "id": "a009",
              "name": "zipCode",
              "type": "string",
              "value": "={{ $json.body?.zip || $json.zip || $json.zip_code || '' }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "92a97498-8f90-4323-9f97-317c43a872b2",
      "name": "Aloware: Create Contact with Quote Details",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4576,
        -1376
      ],
      "parameters": {
        "url": "https://app.aloware.com/api/v1/webhook/forms",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "api_token",
              "value": "={{ $vars.ALOWARE_API_TOKEN }}"
            },
            {
              "name": "phone_number",
              "value": "={{ $json.prospectPhone }}"
            },
            {
              "name": "first_name",
              "value": "={{ $json.prospectFirstName }}"
            },
            {
              "name": "last_name",
              "value": "={{ $json.prospectLastName }}"
            },
            {
              "name": "email",
              "value": "={{ $json.prospectEmail }}"
            },
            {
              "name": "lead_source",
              "value": "={{ $json.leadSource }}"
            },
            {
              "name": "csf1",
              "value": "={{ 'Insurance Type: ' + $json.insuranceType }}"
            },
            {
              "name": "csf2",
              "value": "={{ 'Currently Insured: ' + $json.currentlyInsured }}"
            },
            {
              "name": "csf3",
              "value": "={{ $json.zipCode ? 'ZIP: ' + $json.zipCode : '' }}"
            },
            {
              "name": "notes",
              "value": "={{ $json.insuranceType + ' quote request from ' + $json.leadSource + '. Urgency: ' + $json.urgency }}"
            },
            {
              "name": "force_update",
              "value": "=true"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1cd8a2c5-e2d3-4dda-868c-05147e8bc67a",
      "name": "Aloware: Send Quote Acknowledgment SMS",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4784,
        -1376
      ],
      "parameters": {
        "url": "https://app.aloware.com/api/v1/webhook/sms-gateway/send",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "api_token",
              "value": "={{ $vars.ALOWARE_API_TOKEN }}"
            },
            {
              "name": "from",
              "value": "={{ $vars.ALOWARE_LINE_PHONE }}"
            },
            {
              "name": "to",
              "value": "={{ $('Normalize Quote Data').item.json.prospectPhone }}"
            },
            {
              "name": "message",
              "value": "=Hi {{ $('Normalize Quote Data').item.json.prospectFirstName }}! This is {{ $vars.AGENT_NAME }} from {{ $vars.AGENCY_NAME }}. We received your {{ $('Normalize Quote Data').item.json.insuranceType }} insurance quote request. I'll be reaching out shortly to help you find the best rate. Reply anytime if you have questions!"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "196851de-9cb8-41cb-800f-f30c3908c430",
      "name": "Is Urgent Quote?",
      "type": "n8n-nodes-base.if",
      "position": [
        5152,
        -1376
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "cond_001",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $('Normalize Quote Data').item.json.urgency.toLowerCase() }}",
              "rightValue": "urgent"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "e039ff68-6753-47eb-a56e-f750bc60a429",
      "name": "Aloware: Enroll in AI Voice Agent Sequence",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        5472,
        -1488
      ],
      "parameters": {
        "url": "https://app.aloware.com/api/v1/webhook/sequence-enroll",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "api_token",
              "value": "={{ $vars.ALOWARE_API_TOKEN }}"
            },
            {
              "name": "sequence_id",
              "value": "={{ $vars.ALOWARE_AI_SEQUENCE_ID }}"
            },
            {
              "name": "phone_number",
              "value": "={{ $('Normalize Quote Data').item.json.prospectPhone }}"
            },
            {
              "name": "source",
              "value": "n8n-insurance-urgent"
            },
            {
              "name": "force_enroll",
              "value": "=true"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "19a0109e-9d9a-427c-b2fc-68b41924e579",
      "name": "Aloware: Enroll in Nurture Sequence",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        5472,
        -1280
      ],
      "parameters": {
        "url": "https://app.aloware.com/api/v1/webhook/sequence-enroll",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "api_token",
              "value": "={{ $vars.ALOWARE_API_TOKEN }}"
            },
            {
              "name": "sequence_id",
              "value": "={{ $vars.ALOWARE_NURTURE_SEQUENCE_ID }}"
            },
            {
              "name": "phone_number",
              "value": "={{ $('Normalize Quote Data').item.json.prospectPhone }}"
            },
            {
              "name": "source",
              "value": "n8n-insurance-nurture"
            },
            {
              "name": "force_enroll",
              "value": "=false"
            }
          ]
        }
      },
      "typeVersion": 4.2
    }
  ],
  "connections": {
    "Is Urgent Quote?": {
      "main": [
        [
          {
            "node": "Aloware: Enroll in AI Voice Agent Sequence",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Aloware: Enroll in Nurture Sequence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Quote Data": {
      "main": [
        [
          {
            "node": "Aloware: Create Contact with Quote Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Quote Request Received": {
      "main": [
        [
          {
            "node": "Normalize Quote Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aloware: Send Quote Acknowledgment SMS": {
      "main": [
        [
          {
            "node": "Is Urgent Quote?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aloware: Create Contact with Quote Details": {
      "main": [
        [
          {
            "node": "Aloware: Send Quote Acknowledgment SMS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}