{
  "name": "Process customer feedback with OpenAI, PDF reports, Gmail & Slack notifications",
  "nodes": [
    {
      "id": "1673a4f2-dac3-4a2f-89cf-8c95d02c0fc6",
      "name": "Sticky Note - Credentials Setup1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -7264,
        -880
      ],
      "parameters": {
        "width": 389,
        "height": 656,
        "content": "## 🔐 CREDENTIALS SETUP REQUIRED\n\n**Before running this workflow, configure these credentials:**\n\n1. **OpenAI Account**\n   - Model: GPT-3.5-turbo (cost-effective) or GPT-4 (more accurate)\n\n2. **Gmail O"
      }
    },
    {
      "id": "4959077e-1f6a-43f8-ad2c-30bd0baa7c8f",
      "name": "Sticky Note - Trigger1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -6160,
        -864
      ],
      "parameters": {
        "width": 392,
        "height": 657,
        "content": "## STEP 1: WEBHOOK TRIGGER\n\n**Expected Input Format:**\n```json\n{\n  \"name\": \"Customer Name\",\n  \"email\": \"email@example.com\",\n  \"rating\": 1-5,\n  \"comments\": \"Feedback text\",\n  \"suggestions\": \"Improvemen"
      }
    },
    {
      "id": "14577162-c367-452e-8fcc-0d444ea3ce14",
      "name": "Webhook - Receive Feedback1",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -6032,
        -368
      ]
    },
    {
      "id": "4457ca3c-f600-407e-aa74-562cbb6ffe4d",
      "name": "Sticky Note - Clean Data1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -5744,
        -656
      ],
      "parameters": {
        "width": 392,
        "height": 449,
        "content": "## STEP 2: DATA CLEANING\n\n**Data Transformations:**\n- Empty name → \"Anonymous\"\n- Invalid email → empty string + flag false\n- Missing rating → 0\n- Missing comments → \"No comments provided\"\n- Missing su"
      }
    },
    {
      "id": "525aaa53-9a12-4379-8baa-47c91cabc443",
      "name": "Clean & Normalize Data1",
      "type": "n8n-nodes-base.code",
      "position": [
        -5664,
        -368
      ]
    },
    {
      "id": "bee6365c-320f-426d-b90d-d421e15e2c4a",
      "name": "Sticky Note - AI Analysis1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -5328,
        -816
      ],
      "parameters": {
        "width": 408,
        "height": 609,
        "content": "## STEP 3: AI ANALYSIS\n\n**AI Instructions:**\nAnalyzes feedback and returns JSON with:\n1. **sentiment**: \"Positive\" | \"Neutral\" | \"Negative\"\n2. **highlights**: Array of 2-3 key points\n3. **suggestions*"
      }
    },
    {
      "id": "7359e419-7366-4629-b78d-9b3e6eb8e963",
      "name": "Generate AI Summary1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -5168,
        -368
      ]
    },
    {
      "id": "176eab7c-6456-459b-b295-1b4952562509",
      "name": "Sticky Note - Parse Response1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4896,
        -816
      ],
      "parameters": {
        "width": 360,
        "height": 593,
        "content": "## STEP 4: PARSE AI RESPONSE\n\n**Key Operations:**\n1. **Extracts** AI response from `message.content`\n2. **Cleans** markdown code blocks if present\n3. **Parses** JSON string to object\n4. **Validates** "
      }
    },
    {
      "id": "c4deea1d-d92a-4afa-9cb1-ff35adb28393",
      "name": "Parse AI Response1",
      "type": "n8n-nodes-base.code",
      "position": [
        -4736,
        -368
      ]
    },
    {
      "id": "6c726077-7bca-4b66-864d-79074e097c2b",
      "name": "Sticky Note - HTML Generation1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4512,
        -1008
      ],
      "parameters": {
        "width": 424,
        "height": 785,
        "content": "## STEP 5: BUILD HTML REPORT\n\n**HTML Components:**\n1. **Header Section**\n   - Gradient purple background\n   - \"📊 Feedback Report\" title\n   - Subtitle: \"AI-Powered Customer Feedback Analysis\"\n\n2. **Use"
      }
    },
    {
      "id": "35382397-13ee-46d0-9eaf-41aae3e4cce9",
      "name": "Build HTML Report1",
      "type": "n8n-nodes-base.code",
      "position": [
        -4320,
        -368
      ]
    },
    {
      "id": "06215d6b-d83c-4ef6-9560-6bad2005f079",
      "name": "Sticky Note - PDF Generation1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4064,
        -784
      ],
      "parameters": {
        "width": 376,
        "height": 561,
        "content": "## STEP 6: GENERATE PDF\n\n**API Response:**\n```json\n{\n  \"success\": true,\n  \"pdf_url\": \"https://generated-image.s3.ap-south-1.amazonaws.com/pdfs/[uuid].pdf\",\n  \"file_size_bytes\": 136164,\n  \"file_deletio"
      }
    },
    {
      "id": "d10efd0f-df5c-43f1-b744-4287a0d32a02",
      "name": "Sticky Note - Process PDF1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3664,
        -688
      ],
      "parameters": {
        "width": 392,
        "height": 465,
        "content": "## STEP 7: MERGE PDF METADATA\n\n**Key Operations:**\n1. **Retrieves** previous feedback data from \"Build HTML Report\" node\n2. **Extracts** PDF metadata from current node:\n   - pdf_url: Direct link to ge"
      }
    },
    {
      "id": "ede437b3-bbcc-4ac4-8848-d92d7a351cf8",
      "name": "Process PDF Response1",
      "type": "n8n-nodes-base.code",
      "position": [
        -3552,
        -368
      ]
    },
    {
      "id": "8f4b800d-8889-46c8-8fb0-234d4728f6b4",
      "name": "Sticky Note - Email Validation1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3232,
        -672
      ],
      "parameters": {
        "width": 392,
        "height": 434,
        "content": "## STEP 8: EMAIL VALIDATION CHECK\n\n**Condition:**\n- Checks: `hasValidEmail` boolean flag\n- Operation: Equals `true`\n\n**🟢 TRUE Branch (Valid Email):**\n- Routes to \"Email User Report\" node\n- Sends perso"
      }
    },
    {
      "id": "171bdb6d-4c98-49d9-9928-0f7c11a0eb57",
      "name": "Check Valid Email1",
      "type": "n8n-nodes-base.if",
      "position": [
        -3136,
        -368
      ]
    },
    {
      "id": "70c0fcc0-cb4b-4ffc-8a5a-bab1f0e71c3e",
      "name": "Email User Report1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -2688,
        -384
      ]
    },
    {
      "id": "f9b4ca97-21e0-4a4f-9b42-43e1390a87c8",
      "name": "Sticky Note - Log Data1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2480,
        -768
      ],
      "parameters": {
        "width": 424,
        "height": 546,
        "content": "## STEP 10: LOG TO GOOGLE SHEETS\n\n\n**Columns Logged:**\n1. **Submission ID** - Unique identifier\n2. **Timestamp** - ISO 8601 date/time\n3. **Name** - Customer name\n4. **Email** - Customer email\n5. **Rat"
      }
    },
    {
      "id": "1d12b1e5-a8cb-436a-8a7f-4e093faaf42b",
      "name": "Log Feedback Data1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -2336,
        -384
      ]
    },
    {
      "id": "c0c1f555-140d-448f-ba78-399971e374a6",
      "name": "Sticky Note - Team Alert1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2032,
        -800
      ],
      "parameters": {
        "width": 520,
        "height": 578,
        "content": "## STEP 11: SLACK TEAM NOTIFICATION\n\n**Message Contents:**\n1. **Header** - \"🆕 New Feedback Received!\"\n2. **Customer Info**\n   - Name\n   - Email address\n3. **Feedback Metrics**\n   - Star rating (X/5 ⭐)"
      }
    },
    {
      "id": "6deba6a0-a406-4865-8254-694ab11bd1e0",
      "name": "Notify Team1",
      "type": "n8n-nodes-base.slack",
      "position": [
        -1920,
        -384
      ]
    },
    {
      "id": "a569c084-e6ac-4ca0-8060-f952fa7e0589",
      "name": "Sticky Note - Final Response1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1472,
        -864
      ],
      "parameters": {
        "width": 568,
        "height": 642,
        "content": "## STEP 12: WEBHOOK RESPONSE\n\n**Response Structure:**\n```json\n{\n  \"success\": true,\n  \"message\": \"Thank you for your feedback! We've sent you a detailed report via email.\",\n  \"data\": {\n    \"submissionI"
      }
    },
    {
      "id": "3b59493a-e441-49ac-9627-9dd157254c3f",
      "name": "Send Success Response1",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -1184,
        -384
      ]
    },
    {
      "id": "0fc941d8-3ae3-4334-aaad-456b75177c35",
      "name": "Sticky Note - Testing Guide1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -6768,
        -880
      ],
      "parameters": {
        "width": 549,
        "height": 600,
        "content": "## 🚀 TESTING YOUR WORKFLOW\n\n**Step-by-Step Testing Guide:**\n\n**1. Initial Setup**\n- ✅ Verify all credentials are configured\n- ✅ Check Google Sheet has correct columns\n- ✅ Confirm Slack bot is in chann"
      }
    },
    {
      "id": "749a54d2-50ac-40ab-b3a0-792e9fdc4387",
      "name": "HTML to PDF1",
      "type": "n8n-nodes-htmlcsstopdf.htmlcsstopdf",
      "position": [
        -3936,
        -368
      ]
    },
    {
      "id": "f210d49f-ebe2-4e23-823e-e29412a330e8",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2800,
        -528
      ],
      "parameters": {
        "width": 288,
        "height": 304,
        "content": "## STEP 9:EMAIL USER REPORT\n\nSends an email user report to the email id of the user"
      }
    }
  ],
  "connections": {
    "HTML to PDF1": {
      "main": [
        [
          {
            "node": "Process PDF Response1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Team1": {
      "main": [
        [
          {
            "node": "Send Success Response1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build HTML Report1": {
      "main": [
        [
          {
            "node": "HTML to PDF1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Valid Email1": {
      "main": [
        [
          {
            "node": "Email User Report1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email User Report1": {
      "main": [
        [
          {
            "node": "Log Feedback Data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Feedback Data1": {
      "main": [
        [
          {
            "node": "Notify Team1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Response1": {
      "main": [
        [
          {
            "node": "Build HTML Report1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate AI Summary1": {
      "main": [
        [
          {
            "node": "Parse AI Response1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process PDF Response1": {
      "main": [
        [
          {
            "node": "Check Valid Email1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean & Normalize Data1": {
      "main": [
        [
          {
            "node": "Generate AI Summary1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook - Receive Feedback1": {
      "main": [
        [
          {
            "node": "Clean & Normalize Data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}