{
  "name": "Anhvuwedding Customer Journey - ManyChat DM to Onboarding",
  "id": "anhvuweddingCustomerJourney01",
  "active": false,
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "anhvuwedding-dm-intake",
        "responseMode": "responseNode"
      },
      "id": "dm-webhook",
      "name": "ManyChat DM Intake",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [260, 300]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "id": "name", "name": "name", "value": "={{$json.body.first_name || $json.body.username}}", "type": "string" },
            { "id": "handle", "name": "handle", "value": "={{$json.body.username}}", "type": "string" },
            { "id": "email", "name": "email", "value": "={{$json.body.email || ''}}", "type": "string" },
            { "id": "keyword", "name": "keyword", "value": "={{($json.body.keyword || 'DIRECT DM').toUpperCase()}}", "type": "string" },
            { "id": "location", "name": "location", "value": "={{$json.body.location || ''}}", "type": "string" },
            { "id": "wedding_date", "name": "wedding_date", "value": "={{$json.body.wedding_date || ''}}", "type": "string" },
            { "id": "stage", "name": "stage", "value": "dm_received", "type": "string" }
          ]
        }
      },
      "id": "normalize",
      "name": "Normalize Customer Record",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [500, 300]
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": false },
          "conditions": [
            { "leftValue": "={{$node[\"Normalize Customer Record\"].json.keyword}}", "rightValue": "CINEMA", "operator": { "type": "string", "operation": "equals" } }
          ]
        }
      },
      "id": "keyword-route",
      "name": "Wedding Booking Keyword?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [1220, 300]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "id": "airtable-name", "name": "Client Name", "value": "={{$node[\"Normalize Customer Record\"].json.name}}", "type": "string" },
            { "id": "airtable-contact", "name": "Primary Contact", "value": "={{$node[\"Normalize Customer Record\"].json.handle}}", "type": "string" },
            { "id": "airtable-email", "name": "Email Address", "value": "={{$node[\"Normalize Customer Record\"].json.email}}", "type": "string" },
            { "id": "airtable-preferences", "name": "Client Preferences", "value": "=DM keyword: {{$node[\"Normalize Customer Record\"].json.keyword}} | Location: {{$node[\"Normalize Customer Record\"].json.location}} | Wedding date: {{$node[\"Normalize Customer Record\"].json.wedding_date}} | Stage: dm_received", "type": "string" },
            { "id": "airtable-date", "name": "Date Added", "value": "={{$now.toISODate()}}", "type": "string" }
          ]
        }
      },
      "id": "map-airtable-client",
      "name": "Map Airtable Client Fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [740, 300]
    },
    {
      "parameters": {
        "authentication": "airtableTokenApi",
        "operation": "append",
        "application": "appUBKKVDUvob0lqA",
        "table": "tbl6DmVdeQs5Nocbs",
        "addAllFields": true,
        "options": {}
      },
      "id": "create-airtable-client",
      "name": "Airtable - Create Client",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 1,
      "position": [980, 300],
      "credentials": {
        "airtableTokenApi": {
          "id": "QgnqiIr5EdQFm4bs",
          "name": "Airtable Personal Access Token account"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "reply",
              "name": "reply",
              "value": "Hello {{$node[\"Normalize Customer Record\"].json.name}}. Thank you for connecting with Anhvuwedding. We would love to hear more about your celebration plans and prepare a curated commission recommendation for you.",
              "type": "string"
            },
            {
              "id": "next_action",
              "name": "next_action",
              "value": "qualify_wedding_inquiry",
              "type": "string"
            }
          ]
        }
      },
      "id": "booking-reply",
      "name": "Prepare Booking Reply",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [1460, 220]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "reply",
              "name": "reply",
              "value": "Hello {{$node[\"Normalize Customer Record\"].json.name}}. Thank you for your message. Our studio team will send the most relevant Anhvuwedding resource for your request shortly.",
              "type": "string"
            },
            {
              "id": "next_action",
              "name": "next_action",
              "value": "route_to_studio_resource",
              "type": "string"
            }
          ]
        }
      },
      "id": "resource-reply",
      "name": "Prepare Resource Reply",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [1460, 390]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{$json}}"
      },
      "id": "response",
      "name": "Return Reply to ManyChat",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [1710, 300]
    }
  ],
  "connections": {
    "ManyChat DM Intake": { "main": [[{ "node": "Normalize Customer Record", "type": "main", "index": 0 }]] },
    "Normalize Customer Record": { "main": [[{ "node": "Map Airtable Client Fields", "type": "main", "index": 0 }]] },
    "Map Airtable Client Fields": { "main": [[{ "node": "Airtable - Create Client", "type": "main", "index": 0 }]] },
    "Airtable - Create Client": { "main": [[{ "node": "Wedding Booking Keyword?", "type": "main", "index": 0 }]] },
    "Wedding Booking Keyword?": {
      "main": [
        [{ "node": "Prepare Booking Reply", "type": "main", "index": 0 }],
        [{ "node": "Prepare Resource Reply", "type": "main", "index": 0 }]
      ]
    },
    "Prepare Booking Reply": { "main": [[{ "node": "Return Reply to ManyChat", "type": "main", "index": 0 }]] },
    "Prepare Resource Reply": { "main": [[{ "node": "Return Reply to ManyChat", "type": "main", "index": 0 }]] }
  },
  "settings": {},
  "meta": {
    "templateCredsSetupCompleted": false,
    "setupNote": "Airtable CRM intake is configured for the Client Experience Tracker base and Clients table. Before activation, host n8n at a public HTTPS URL and paste the production webhook URL into a ManyChat External Request."
  }
}
