{
  "id": "bAczIXMBSsZulax7",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Customer Feedback Loop Analyzer",
  "tags": [],
  "nodes": [
    {
      "id": "0aeba1ed-f179-4a69-ad06-23bdf6ed1c4d",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        220,
        100
      ],
      "parameters": {
        "options": {},
        "formTitle": "Customer Review",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Name",
              "requiredField": true
            },
            {
              "fieldLabel": "Review",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1e5cb96f-9467-47ab-b060-8600ee901582",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        528,
        220
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-1.5-flash"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0c13ebb7-14ba-4c3b-aa44-b2b22ea72c3f",
      "name": "Send Report",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1256,
        100
      ],
      "parameters": {
        "sendTo": "",
        "message": "=Your monthly energy report is as follows  {{ $json.url }}",
        "options": {
          "appendAttribution": true
        },
        "subject": "Energy Report",
        "emailType": "text"
      },
      "credentials": {},
      "typeVersion": 2.1
    },
    {
      "id": "d0abc9c5-7591-4f63-b097-f1682ffaa006",
      "name": "Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1256,
        -100
      ],
      "parameters": {
        "text": "=User  {{ $json.candidate_name }} has already applied for {{ $json.role_applied }}",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "select": "user",
        "otherOptions": {}
      },
      "typeVersion": 2.3
    },
    {
      "id": "9151ff73-9062-4bb3-8776-1e299636b9ef",
      "name": "Receive review/feedbak",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        0,
        -100
      ],
      "parameters": {
        "filters": {
          "labelIds": [
            "Label_536806471971916762"
          ]
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {},
      "typeVersion": 1.2
    },
    {
      "id": "c4312796-7756-4a1a-bad8-5af5f2377b69",
      "name": "Extract details",
      "type": "n8n-nodes-base.code",
      "position": [
        220,
        -100
      ],
      "parameters": {
        "jsCode": "    const fromEmail = $input.first().json.From // Assuming 'from' field holds the full \"From\" string\n    let name = '';\n\n    // Check if the name is enclosed in angle brackets\n    if (fromEmail.includes('<') && fromEmail.includes('>')) {\n        name = fromEmail.substring(0, fromEmail.indexOf('<')).trim();\n    } else {\n        // If no angle brackets, assume the whole \"From\" field is the name\n        name = fromEmail.trim();\n    }\n\n    return { json: { name: name ,Review : $input.first().json.snippet} };"
      },
      "typeVersion": 2
    },
    {
      "id": "e1525399-3ac3-4dc0-8b9b-79261b2f9c63",
      "name": "Transform and summarise",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        440,
        0
      ],
      "parameters": {
        "text": "={{ $json.Review }}",
        "options": {
          "systemPromptTemplate": "=You are a feedback analyst. Categorize the following user feedback into one of:\n- Bug\n- Feature Request\n- UX Issue\n- Other\n\nAlso extract the core complaint or suggestion in a concise sentence.\n\nFeedback:  {{ $json.Review }}"
        },
        "schemaType": "fromJson",
        "jsonSchemaExample": "{\n  \"category\": \"Feature Request\",\n  \"summary\": \"User wants dark mode support\",\n  \"sentiment\": \"Positive\",\n  \"Feedback text\": \"Original review\"\n\n}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "13155178-e7b0-4329-95b5-eddd560d0fe5",
      "name": "Review data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        816,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "summary": "={{ $json.output.summary }}",
            "category": "={{ $json.output.category }}",
            "Timestamp": "={{ $json.output.Timestamp }}",
            "sentiment": "={{ $json.output.sentiment }}",
            "Feedback text": "={{ $json.output[\"Feedback text\"] }}"
          },
          "schema": [
            {
              "id": "category",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sentiment",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "sentiment",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Feedback text",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Feedback text",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "output"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {},
        "documentId": {}
      },
      "credentials": {},
      "typeVersion": 4.6
    },
    {
      "id": "66b9626b-dd32-4e12-8eda-1a85f8436a40",
      "name": "Categories",
      "type": "n8n-nodes-base.switch",
      "position": [
        1036,
        0
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f245286d-696d-43c2-9717-838befcc4064",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.category }}",
                    "rightValue": "Bug"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "394c07bc-9828-4d4d-a434-33cb4a96cddb",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.category }}",
                    "rightValue": "Feature Request"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "a8490c26-d635-4a74-9c90-04d33e94f85e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        380
      ],
      "parameters": {
        "width": 1520,
        "height": 420,
        "content": "**Purpose:**\nAutomatically capture customer reviews from forms or emails, analyze them with AI to detect category and sentiment, and notify the right channels while logging everything in Google Sheets.\n\n\n**Core Logic:**\n\n1. **Form submission trigger** captures customer name and review text.\n2. **Gmail trigger** listens for incoming feedback emails.\n3. **Extract details (Code node)** parses reviewer name and feedback text.\n4. **AI analysis** summarizes the review, detects sentiment, and assigns a category (Bug, Feature Request, UX Issue, Other).\n5. **Google Gemini (optional)** provides advanced summarization/classification.\n6. **Google Sheets** logs the categorized feedback for tracking.\n7. **Switch node** routes feedback into different branches based on category.\n8. **Slack notification** alerts the team about critical issues like Bugs.\n9. **Email report** sends categorized summaries (e.g., Feature Requests) to stakeholders.\n\n\n**Outcome:**\nCreates a streamlined feedback loop where customer input is captured, structured, categorized, and routed automatically \u2014 ensuring issues are quickly acted on, feature requests are tracked, and all feedback is stored for long-term analysis.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a57683e3-5304-4a50-8aec-0ac86427b929",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -82,
        -240
      ],
      "parameters": {
        "color": 5,
        "width": 1520,
        "height": 600,
        "content": "## Customer Feedback Loop Analyzer"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1277749b-2809-4280-a59e-17998a61a482",
  "connections": {
    "Categories": {
      "main": [
        [
          {
            "node": "Slack",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Review data": {
      "main": [
        [
          {
            "node": "Categories",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract details": {
      "main": [
        [
          {
            "node": "Transform and summarise",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Transform and summarise",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive review/feedbak": {
      "main": [
        [
          {
            "node": "Extract details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transform and summarise": {
      "main": [
        [
          {
            "node": "Review data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Transform and summarise",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}