{
  "name": "Feedback sentiment with Slack alerts",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyX",
              "value": 3,
              "unit": "hours"
            }
          ]
        },
        "documentId": {
          "__rl": true,
          "value": "",
          "mode": "url"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1"
        },
        "event": "rowAdded",
        "options": {}
      },
      "id": "afae4e29-a273-5a37-9242-358d1f6d881a",
      "name": "New form response",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "typeVersion": 1,
      "position": [
        200,
        300
      ]
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-4.1-mini",
          "mode": "list",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "messages": {
          "values": [
            {
              "content": "=Classify this customer feedback. Return JSON only: {\"sentiment\": \"positive\" | \"neutral\" | \"negative\", \"reason\": \"one short sentence\"}.\n\nFeedback: {{ $json.Feedback }}"
            }
          ]
        },
        "options": {},
        "jsonOutput": true
      },
      "id": "c605cd3a-6958-54c2-a2d9-8fe5dcd25961",
      "name": "Rate the sentiment",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        420,
        300
      ]
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "",
          "mode": "url"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Timestamp": "={{ $('New form response').item.json.Timestamp }}",
            "sentiment": "={{ $json.message.content.sentiment }}",
            "reason": "={{ $json.message.content.reason }}"
          },
          "matchingColumns": [
            "Timestamp"
          ],
          "schema": [
            {
              "id": "Timestamp",
              "displayName": "Timestamp",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "sentiment",
              "displayName": "sentiment",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "reason",
              "displayName": "reason",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ]
        },
        "options": {}
      },
      "id": "3d30580b-962c-5a1a-9bee-2ea295c0525c",
      "name": "Save sentiment",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        640,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "ea5b7c61-ef21-4c22-9a25-3e7fe69808ff",
              "leftValue": "={{ $('Rate the sentiment').item.json.message.content.sentiment }}",
              "rightValue": "negative",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "28a6c5d9-be60-512f-88cc-09e8b729ff52",
      "name": "Is it negative?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        860,
        300
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "#general",
          "mode": "name"
        },
        "text": "=Unhappy customer feedback:\n> {{ $('New form response').item.json.Feedback }}\nWhy: {{ $('Rate the sentiment').item.json.message.content.reason }}",
        "otherOptions": {}
      },
      "id": "421ff43c-1321-53f6-9af8-628d6729aa4d",
      "name": "Alert in Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        1080,
        300
      ]
    },
    {
      "parameters": {
        "content": "## Draft, not yet tested\nThis workflow was written by Automation Recipes and has NOT been run end to end yet.\n\nAfter importing: open each node, connect your own accounts (credentials), and fill in anything left blank (sheet URL, Slack channel, label names). Then run it once by hand with test data before turning it on.\n\nAssumes your form question column is called Feedback. Rename it in the AI and Slack steps if yours is different.",
        "height": 260,
        "width": 420
      },
      "id": "c0e1a311-d6bd-516e-99a7-0a6b1d9db8b1",
      "name": "Read me",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        20
      ]
    }
  ],
  "connections": {
    "New form response": {
      "main": [
        [
          {
            "node": "Rate the sentiment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rate the sentiment": {
      "main": [
        [
          {
            "node": "Save sentiment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save sentiment": {
      "main": [
        [
          {
            "node": "Is it negative?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is it negative?": {
      "main": [
        [
          {
            "node": "Alert in Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}