{
  "id": "ZScCHEPi38wDZHiB",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Multi-Channel Customer Support Inquiry Management and Tracking System",
  "tags": [],
  "nodes": [
    {
      "id": "c454d429-cc3f-4b56-8730-c72c81938555",
      "name": "Email Trigger",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        400,
        280
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "c6be407e-9f2e-4011-9141-f80d5cbae5aa",
      "name": "Webhook - Web Form",
      "type": "n8n-nodes-base.webhook",
      "position": [
        400,
        464
      ],
      "parameters": {
        "path": "customer-inquiry",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "lastNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "b67fb3e2-0a16-4044-a741-354e24dfdb46",
      "name": "Extract Email Content",
      "type": "n8n-nodes-base.html",
      "position": [
        624,
        280
      ],
      "parameters": {
        "options": {
          "trimValues": true,
          "cleanUpText": true
        },
        "operation": "extractHtmlContent",
        "dataPropertyName": "={{ $json.html }}",
        "extractionValues": {
          "values": [
            {
              "key": "text",
              "cssSelector": "body"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "95f5f69d-1c14-438b-a996-2448a60387fe",
      "name": "Parse Email Data",
      "type": "n8n-nodes-base.set",
      "position": [
        848,
        280
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "customerName",
              "type": "string",
              "value": "={{ $json.from.name }}"
            },
            {
              "id": "id-2",
              "name": "customerEmail",
              "type": "string",
              "value": "={{ $json.from.address }}"
            },
            {
              "id": "id-3",
              "name": "subject",
              "type": "string",
              "value": "={{ $json.subject }}"
            },
            {
              "id": "id-4",
              "name": "message",
              "type": "string",
              "value": "={{ $json.text }}"
            },
            {
              "id": "id-5",
              "name": "source",
              "type": "string",
              "value": "email"
            },
            {
              "id": "id-6",
              "name": "receivedAt",
              "type": "string",
              "value": "={{ $json.date }}"
            },
            {
              "id": "id-7",
              "name": "inquiryType",
              "type": "string",
              "value": "={{ $json.subject.toLowerCase().includes('urgent') || $json.subject.toLowerCase().includes('\u7dca\u6025') ? 'urgent' : ($json.subject.toLowerCase().includes('billing') || $json.subject.toLowerCase().includes('\u8acb\u6c42') ? 'billing' : 'general') }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "9f2a42ae-c6fc-4ad9-b2d8-dd488b77e380",
      "name": "Parse Webhook Data",
      "type": "n8n-nodes-base.set",
      "position": [
        848,
        472
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "customerName",
              "type": "string",
              "value": "={{ $json.body.name }}"
            },
            {
              "id": "id-2",
              "name": "customerEmail",
              "type": "string",
              "value": "={{ $json.body.email }}"
            },
            {
              "id": "id-3",
              "name": "subject",
              "type": "string",
              "value": "={{ $json.body.subject }}"
            },
            {
              "id": "id-4",
              "name": "message",
              "type": "string",
              "value": "={{ $json.body.message }}"
            },
            {
              "id": "id-5",
              "name": "source",
              "type": "string",
              "value": "webform"
            },
            {
              "id": "id-6",
              "name": "receivedAt",
              "type": "string",
              "value": "={{ $now }}"
            },
            {
              "id": "id-7",
              "name": "inquiryType",
              "type": "string",
              "value": "={{ $json.body.type || 'general' }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "fd42df65-9c60-4472-a712-9be61b81ea56",
      "name": "Merge Inquiries",
      "type": "n8n-nodes-base.merge",
      "position": [
        1072,
        376
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.2
    },
    {
      "id": "f7c07e85-6661-4519-b93a-d030c63bc237",
      "name": "Route by Inquiry Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        1296,
        248
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "General Inquiries",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.inquiryType }}",
                    "rightValue": "general"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Urgent Inquiries",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.inquiryType }}",
                    "rightValue": "urgent"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Billing Inquiries",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.inquiryType }}",
                    "rightValue": "billing"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "7e41903e-b0be-4ef1-ae94-505a0a9e9c36",
      "name": "Save to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1520,
        464
      ],
      "parameters": {
        "columns": {
          "value": {
            "source": "source",
            "message": "message",
            "subject": "subject",
            "receivedAt": "receivedAt",
            "inquiryType": "inquiryType",
            "customerName": "customerName",
            "customerEmail": "customerEmail"
          },
          "schema": [
            {
              "id": "customerName",
              "required": false,
              "displayName": "customerName",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "customerEmail",
              "required": false,
              "displayName": "customerEmail",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "subject",
              "required": false,
              "displayName": "subject",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "message",
              "required": false,
              "displayName": "message",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "source",
              "required": false,
              "displayName": "source",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "receivedAt",
              "required": false,
              "displayName": "receivedAt",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "inquiryType",
              "required": false,
              "displayName": "inquiryType",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [
            "customerEmail"
          ]
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "<__PLACEHOLDER_VALUE__Sheet Name (e.g., Inquiries)__>"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "<__PLACEHOLDER_VALUE__Google Sheets Document ID__>"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "950a8809-813f-4fe4-a261-122c122851ad",
      "name": "Notify Urgent - Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1520,
        80
      ],
      "parameters": {
        "text": "=\ud83d\udea8 *\u7dca\u6025\u554f\u3044\u5408\u308f\u305b* \ud83d\udea8\n\n*\u9867\u5ba2\u540d:* {{ $json.customerName }}\n*\u30e1\u30fc\u30eb:* {{ $json.customerEmail }}\n*\u4ef6\u540d:* {{ $json.subject }}\n*\u5185\u5bb9:* {{ $json.message }}\n*\u53d7\u4fe1\u6642\u523b:* {{ $json.receivedAt }}\n*\u30bd\u30fc\u30b9:* {{ $json.source }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "<__PLACEHOLDER_VALUE__Slack Channel ID for Urgent Alerts__>"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "10357ad4-18b3-492b-a722-7a5ddc53d7bc",
      "name": "Notify General - Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1520,
        272
      ],
      "parameters": {
        "text": "=\ud83d\udce9 *\u65b0\u898f\u554f\u3044\u5408\u308f\u305b*\n\n*\u9867\u5ba2\u540d:* {{ $json.customerName }}\n*\u30e1\u30fc\u30eb:* {{ $json.customerEmail }}\n*\u4ef6\u540d:* {{ $json.subject }}\n*\u5185\u5bb9:* {{ $json.message }}\n*\u53d7\u4fe1\u6642\u523b:* {{ $json.receivedAt }}\n*\u30bd\u30fc\u30b9:* {{ $json.source }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "<__PLACEHOLDER_VALUE__Slack Channel ID for General Inquiries__>"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "950d0a86-1ea9-4a6a-a95f-3ed28a2947b6",
      "name": "Send Auto-Reply Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1296,
        472
      ],
      "parameters": {
        "sendTo": "={{ $json.customerEmail }}",
        "message": "=\u3053\u3093\u306b\u3061\u306f {{ $json.customerName }} \u69d8\u3001\n\n\u304a\u554f\u3044\u5408\u308f\u305b\u3044\u305f\u3060\u304d\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002\n\n\u3054\u9023\u7d61\u3092\u53d7\u3051\u4ed8\u3051\u307e\u3057\u305f\u3002\u62c5\u5f53\u8005\u304c\u78ba\u8a8d\u6b21\u7b2c\u3001\u3067\u304d\u308b\u3060\u3051\u65e9\u304f\u3054\u8fd4\u4fe1\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3059\u3002\n\n\u4f55\u304b\u3054\u4e0d\u660e\u306a\u70b9\u304c\u3054\u3056\u3044\u307e\u3057\u305f\u3089\u3001\u304a\u6c17\u8efd\u306b\u304a\u554f\u3044\u5408\u308f\u305b\u304f\u3060\u3055\u3044\u3002\n\n\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3044\u305f\u3057\u307e\u3059\u3002\n\u30ab\u30b9\u30bf\u30de\u30fc\u30b5\u30dd\u30fc\u30c8\u30c1\u30fc\u30e0",
        "options": {},
        "subject": "=Re: {{ $json.subject }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "6a40ae19-43f5-4659-96c0-eedcd799da14",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        48
      ],
      "parameters": {
        "width": 688,
        "height": 960,
        "content": "## Multi-Channel Customer Support Inquiry Management and Tracking System\n\n\n**Who's it for?**\nCustomer support teams, marketing & sales teams, SMBs, individuals needing efficient inquiry management.\n\n**How it works / What it does**\nThis workflow automates the collection, processing, routing, and tracking of customer inquiries from multiple sources.\n\n1.  **Multi-Channel Input**: Listens for inquiries from incoming emails (IMAP) and web form submissions (Webhook).\n2.  **Data Extraction & Parsing**: Extracts details like customer name, email, subject, message, source, received timestamp, and intelligently determines `inquiryType` (urgent, billing, general) from both email content and web form data.\n3.  **Merge Inquiries**: Combines parsed data from both channels into a single stream for unified processing.\n4.  **Route by Inquiry Type**: Directs inquiries based on their type (`urgent`, `general`, `billing`):\n    *   **Urgent Inquiries**: Notified to a specific Slack channel.\n    *   **General Inquiries**: Notified to another designated Slack channel.\n    *   **Billing Inquiries**: Also routed for notification (e.g., to general channel or a custom one).\n5.  **Save to Google Sheets**: Logs all inquiry details into a central Google Sheet for record-keeping.\n6.  **Send Auto-Reply Email**: Automatically sends a confirmation email to the customer.\n\n**Setup Requirements**\n\n*   **n8n Instance**\n*   **Google Sheets Account**: Create a spreadsheet with `customerName, customerEmail, subject, message, source, receivedAt, inquiryType` headers. Configure Spreadsheet ID and Sheet Name in the 'Save to Google Sheets' node.\n*   **IMAP Email Account**: Set up the 'Email Trigger' node to connect to your IMAP server.\n*   **Webhook-enabled Web Form**: Configure your web form to send JSON data (with `name, email, subject, message, type` fields) to the 'Webhook - Web Form' URL.\n*   **Slack Workspace**: Set up Slack credentials and specify Channel IDs for urgent and general notifications.\n*   **Gmail Account**: Set up Gmail credentials for sending auto-reply emails.\n\n**How to customize the workflow**\n\n*   **Expand Inquiry Types**: Add more specific rules in the 'Route by Inquiry Type' node.\n*   **Integrate Other Notifications**: Connect to MS Teams, Discord, SMS, etc.\n*   **CRM Integration**: Add nodes to push data to Salesforce, HubSpot, or other CRMs.\n*   **Advanced Prioritization**: Implement AI for sentiment analysis or complex escalation logic.\n\n---"
      },
      "typeVersion": 1
    },
    {
      "id": "c856e1b3-46be-4d2e-aec5-97489e752a18",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        128
      ],
      "parameters": {
        "color": 3,
        "height": 480,
        "content": "## Multi-Channel Input \n**Listens for inquiries from incoming emails (IMAP) and web form submissions (Webhook)."
      },
      "typeVersion": 1
    },
    {
      "id": "bd8ae3aa-7797-4b04-bda6-dd5e4ed6c859",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        0
      ],
      "parameters": {
        "color": 4,
        "width": 704,
        "height": 672,
        "content": "## Send Auto-Reply\n"
      },
      "typeVersion": 1
    },
    {
      "id": "db09a2a4-fbd9-4c1e-be9e-63787ceb324b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        80
      ],
      "parameters": {
        "color": 6,
        "width": 368,
        "height": 560,
        "content": "## Data Extraction & Parsing \n**Extracts details like customer name, email, subject, message, source, received timestamp, and intelligently determines inquiryType (urgent, billing, general) from both email content and web form data."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d94a9640-9ad6-424f-a790-18dc46bd1ec7",
  "connections": {
    "Email Trigger": {
      "main": [
        [
          {
            "node": "Extract Email Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Inquiries": {
      "main": [
        [
          {
            "node": "Route by Inquiry Type",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Auto-Reply Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Email Data": {
      "main": [
        [
          {
            "node": "Merge Inquiries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Webhook Data": {
      "main": [
        [
          {
            "node": "Merge Inquiries",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Webhook - Web Form": {
      "main": [
        [
          {
            "node": "Parse Webhook Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Email Content": {
      "main": [
        [
          {
            "node": "Parse Email Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Inquiry Type": {
      "main": [
        [
          {
            "node": "Save to Google Sheets",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify Urgent - Slack",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify General - Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}