{
  "id": "KosK0MjrN0CVyE2R",
  "name": "N8N workflow for automated inquiry management",
  "tags": [],
  "nodes": [
    {
      "id": "ed1db84e-839b-407e-84e7-30807d8aba4a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1888,
        -144
      ],
      "parameters": {
        "width": 480,
        "height": 528,
        "content": "## N8N workflow for automated inquiry management\n\n### How it works\n\n\nIncoming inquiries are received via **Webhook** or **Gmail** and are first organized into a standardized format. The system then performs a **duplicate check**. If a duplicate inquiry is detected, a notification is immediately sent to the designated **Slack channel**. If no duplicate is found, the inquiry is stored in the database/table.\n\nOnce the inquiry is successfully recorded, an AI agent generates a concise summary of the inquiry and posts it to the **Slack channel** for the team. Finally, the system automatically sends a **confirmation message** to the customer, acknowledging that their inquiry has been received.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "49a00e13-4237-477f-bfc3-9838b69a896c",
      "name": "When Gmail Received",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -1152,
        0
      ],
      "parameters": {
        "filters": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "typeVersion": 1.4
    },
    {
      "id": "6efacddc-2995-4677-9d4d-88b1f0ed679f",
      "name": "Set Gmail Inquiry Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -928,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0aca45e8-41e4-437b-8f51-76bf72bc0b47",
              "name": "={{ $json.From.split('<')[0].trim() }}",
              "type": "string",
              "value": "={{ $json.From.match(/<(.+)>/) ? $json.From.match(/<(.+)>/)[1] : $json.From }}"
            },
            {
              "id": "ae20b8ec-63e4-44a6-998b-2014c0f80187",
              "name": "",
              "type": "string",
              "value": "={{ $json.From.match(/<(.+)>/) ? $json.From.match(/<(.+)>/)[1] : $json.From }}"
            },
            {
              "id": "b832a86b-0de2-46db-ac60-e80c93c28522",
              "name": "message",
              "type": "string",
              "value": "={{ $json.snippet }}"
            },
            {
              "id": "91911571-b86c-493a-8aed-625f6cefc6d1",
              "name": "source",
              "type": "string",
              "value": "Gmail"
            },
            {
              "id": "ff8cd4b4-ef2f-4184-a6c8-ab02ebeb48d0",
              "name": "timestamp",
              "type": "string",
              "value": "={{ $now }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7b8699fa-1a96-445a-963a-6219832d482f",
      "name": "When Form Submitted",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1152,
        192
      ],
      "parameters": {
        "path": "customer-inquiry-form",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "188f519d-e2ba-4d3f-a2e8-3b7c03cc9fef",
      "name": "Set Form Inquiry Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -928,
        192
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a1495e01-ebba-4954-a029-3d9ae87f32ef",
              "name": "name",
              "type": "string",
              "value": "={{ $json.body.name }}"
            },
            {
              "id": "6e343a1a-8ae4-4f2a-898f-e737c186272b",
              "name": "email",
              "type": "string",
              "value": "={{ $json.body.email }}"
            },
            {
              "id": "9c1f5c9f-7904-42b3-987f-23f43ec4d08a",
              "name": "message",
              "type": "string",
              "value": "={{ $json.body.message }}"
            },
            {
              "id": "a3df4ba6-5ead-413e-8c36-e620b0049737",
              "name": "source",
              "type": "string",
              "value": "Website"
            },
            {
              "id": "72a07040-0f16-4c05-8fba-16a431a632d6",
              "name": "timestamp",
              "type": "string",
              "value": "={{ $now }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c6d0b269-b89f-4f8b-88d5-5ca93fa4af1e",
      "name": "If Entry is Duplicate",
      "type": "n8n-nodes-base.if",
      "position": [
        -480,
        96
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d93ed477-fe76-4292-96e3-4b802992b367",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": "="
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "24665358-74b2-4053-baee-1cb164a12721",
      "name": "Add New Entry to Airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -256,
        192
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "apppm0Rx7pxnVtm6q"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblbnvCQsFijBdnOI",
          "cachedResultUrl": "https://airtable.com/apppm0Rx7pxnVtm6q/tblbnvCQsFijBdnOI",
          "cachedResultName": "Inquiries"
        },
        "columns": {
          "value": {
            "Name": "={{ $('Set Gmail Inquiry Fields').isExecuted ? $('Set Gmail Inquiry Fields').item.json.name : $('Set Form Inquiry Fields').item.json.name }}",
            "Email": "={{ $('Set Gmail Inquiry Fields').isExecuted ? $('Set Gmail Inquiry Fields').item.json.email : $('Set Form Inquiry Fields').item.json.email }}",
            "Message": "={{ $('Set Gmail Inquiry Fields').isExecuted ? $('Set Gmail Inquiry Fields').item.json.message : $('Set Form Inquiry Fields').item.json.message }}",
            "Source ": "={{ $('Set Gmail Inquiry Fields').isExecuted ? $('Set Gmail Inquiry Fields').item.json.source : $('Set Form Inquiry Fields').item.json.source }}",
            "Timestamp": "={{ $('Set Gmail Inquiry Fields').isExecuted ? $('Set Gmail Inquiry Fields').item.json.timestamp : $('Set Form Inquiry Fields').item.json.timestamp }}"
          },
          "schema": [
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Message",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Source ",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Source ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create"
      },
      "typeVersion": 2.2
    },
    {
      "id": "a1f3647e-5c3f-4ca3-a55c-a6c509c1235c",
      "name": "Notify Duplicate in Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        -256,
        0
      ],
      "parameters": {
        "text": "=Duplicate inquiry milli hai! Name: {{ $json.fields.Name }} Email: {{ $json.fields.Email }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C0BG86BFB97",
          "cachedResultName": "inquiries"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.5
    },
    {
      "id": "b758d84f-ca41-4be7-94fe-94f92309d790",
      "name": "Inquiry Analysis Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -32,
        192
      ],
      "parameters": {
        "text": "={{ $json.fields.Message }}",
        "options": {
          "systemMessage": "=Summarize this customer inquiry in 1-2 short lines:\n\nName: {{ $('Set Gmail Inquiry Fields').isExecuted ? $('Set Gmail Inquiry Fields').item.json.name : $('Set Form Inquiry Fields').item.json.name }}\nEmail: {{ $('Set Gmail Inquiry Fields').isExecuted ? $('Set Gmail Inquiry Fields').item.json.email : $('Set Form Inquiry Fields').item.json.email }}\nMessage: {{ $('Set Gmail Inquiry Fields').isExecuted ? $('Set Gmail Inquiry Fields').item.json.message : $('Set Form Inquiry Fields').item.json.message }}"
        },
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "3820fdd2-f60e-49c8-a006-fe7daf10c8b4",
      "name": "Groq Model for Inquiries",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        -32,
        448
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "f93eca6a-6871-4a35-808c-acce27e9e337",
      "name": "Send Slack Inquiry Update",
      "type": "n8n-nodes-base.slack",
      "position": [
        320,
        192
      ],
      "parameters": {
        "text": "=New inquiry received!   Name: {{ $('Set Gmail Inquiry Fields').isExecuted ? $('Set Gmail Inquiry Fields').item.json.name : $('Set Form Inquiry Fields').item.json.name }} Email: {{ $('Set Gmail Inquiry Fields').isExecuted ? $('Set Gmail Inquiry Fields').item.json.email : $('Set Form Inquiry Fields').item.json.email }}  Summary: {{ $json.output }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C0BG86BFB97",
          "cachedResultName": "inquiries"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.5
    },
    {
      "id": "0d8d29c5-dce1-4ab5-b6cf-aefaa7107f21",
      "name": "Send Email Inquiry Confirmation",
      "type": "n8n-nodes-base.gmail",
      "position": [
        544,
        192
      ],
      "parameters": {
        "sendTo": "={{ $('Set Gmail Inquiry Fields').isExecuted ? $('Set Gmail Inquiry Fields').item.json.email : $('Set Form Inquiry Fields').item.json.email }}",
        "message": "=Hi {{ $('Set Gmail Inquiry Fields').isExecuted ? $('Set Gmail Inquiry Fields').item.json.name : $('Set Form Inquiry Fields').item.json.name }},\n\nThank you for getting in touch with us! We've received your inquiry and truly appreciate you taking the time to reach out.\n\nOur team is reviewing your message and will get back to you as soon as possible.\n\nIf you have any urgent questions in the meantime, feel free to reply to this email.\n\nBest regards,\nThe Team",
        "options": {},
        "subject": "Thank You for Reaching Out to Us!"
      },
      "typeVersion": 2.2
    },
    {
      "id": "c965d477-c056-483d-ac90-4654acf2a412",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1248,
        -176
      ],
      "parameters": {
        "width": 480,
        "height": 528,
        "content": "## input\n\nIncoming inquiries are received via **Webhook** or **Gmail** and are first organized into a standardized format. \n"
      },
      "typeVersion": 1
    },
    {
      "id": "8f2c6208-eec8-431e-a34a-f1d228862a10",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -736,
        16
      ],
      "parameters": {
        "width": 416,
        "height": 256,
        "content": "## Check Dublicate"
      },
      "typeVersion": 1
    },
    {
      "id": "edfc95f9-1eeb-44ad-b083-3ef7ec5fe425",
      "name": "Check Duplicates in Airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -704,
        96
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "apppm0Rx7pxnVtm6q"
        },
        "limit": 1,
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblbnvCQsFijBdnOI",
          "cachedResultUrl": "https://airtable.com/apppm0Rx7pxnVtm6q/tblbnvCQsFijBdnOI",
          "cachedResultName": "Inquiries"
        },
        "options": {},
        "operation": "search",
        "returnAll": false,
        "filterByFormula": "={Email} = '{{ $json.email }}'"
      },
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "ee180c11-67e0-4f58-88cc-22227773b96a",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        64
      ],
      "parameters": {
        "width": 704,
        "height": 496,
        "content": "Once the inquiry is successfully recorded, an AI agent generates a concise summary of the inquiry and posts it to the **Slack channel** for the team. Finally, the system automatically sends a **confirmation message** to the customer, acknowledging that their inquiry has been received.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "90c6f400-2346-43cd-bc4d-c7ce2ee4d9d6",
  "nodeGroups": [],
  "connections": {
    "When Form Submitted": {
      "main": [
        [
          {
            "node": "Set Form Inquiry Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Gmail Received": {
      "main": [
        [
          {
            "node": "Set Gmail Inquiry Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Entry is Duplicate": {
      "main": [
        [
          {
            "node": "Notify Duplicate in Slack",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Add New Entry to Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Inquiry Analysis Agent": {
      "main": [
        [
          {
            "node": "Send Slack Inquiry Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Form Inquiry Fields": {
      "main": [
        [
          {
            "node": "Check Duplicates in Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Model for Inquiries": {
      "ai_languageModel": [
        [
          {
            "node": "Inquiry Analysis Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Set Gmail Inquiry Fields": {
      "main": [
        [
          {
            "node": "Check Duplicates in Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add New Entry to Airtable": {
      "main": [
        [
          {
            "node": "Inquiry Analysis Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Slack Inquiry Update": {
      "main": [
        [
          {
            "node": "Send Email Inquiry Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Duplicates in Airtable": {
      "main": [
        [
          {
            "node": "If Entry is Duplicate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}