{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "452e8637-a994-4b8c-b3b1-a6fcab3a577f",
      "name": "Reply to review",
      "type": "n8n-nodes-base.googleBusinessProfile",
      "position": [
        10560,
        5808
      ],
      "parameters": {
        "reply": "={{ $('AI Agent').item.json.output }}",
        "review": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Code in JavaScript1').item.json.reviewId }}"
        },
        "account": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "location": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "resource": "review",
        "operation": "reply",
        "requestOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "3d37bdf6-b7ef-4219-8546-6250a0aedc4a",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        9760,
        5888
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "03e039e5-81a1-40fb-962a-a87a8f6c21f8",
              "name": "reviewerName ",
              "type": "string",
              "value": "={{ $json.reviewer.displayName }}"
            },
            {
              "id": "888a7065-5ca0-44a1-a3df-f3969d53be9e",
              "name": "reviewText ",
              "type": "string",
              "value": "={{ $json.comment }}"
            },
            {
              "id": "9d660669-19c7-4353-bacc-81ce554015a1",
              "name": "rating ",
              "type": "string",
              "value": "={{ $json.starRating }}"
            },
            {
              "id": "b07acd94-ea41-4782-9c78-5a0df01a0bea",
              "name": "reviewName ",
              "type": "string",
              "value": "={{ $json.name }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "4442b283-8672-4a30-bd15-e5dd4e863a79",
      "name": "Groq Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        9968,
        6080
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "cb661599-108a-4000-94f7-22d6bf3e9c9a",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        10304,
        5888
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "6e998bf9-6256-4a46-9cd3-c96683b87df7",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Edit Fields').item.json[\"rating \"] }}",
              "rightValue": "FOUR"
            },
            {
              "id": "563a368d-3223-40ab-b9df-303b1d10a281",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Edit Fields').item.json[\"rating \"] }}",
              "rightValue": "FIVE"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "19508f3f-c9b1-4335-abf8-d2ee3396bb3f",
      "name": "Send message and wait for response",
      "type": "n8n-nodes-base.slack",
      "position": [
        10560,
        6000
      ],
      "parameters": {
        "select": "channel",
        "message": "=\ud83d\udea8 *New Review Needs Approval*\n\n\ud83d\udc64 *Customer:* {{ $('Edit Fields').item.json['reviewerName '] }} \n\n\u2b50 *Rating:* {{ $('Edit Fields').item.json['rating '] }}  \n\n\ud83d\udcdd *Review:*  {{ $('Edit Fields').item.json['reviewText '] }}\n\n\n\ud83e\udd16 *AI Suggested Reply:*  {{ $('AI Agent').item.json.output }}\n\n\n\ud83d\udc49 Please review and take action below:",
        "options": {},
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SLACK_CHANNEL_ID",
          "cachedResultName": "your-channel-name"
        },
        "operation": "sendAndWait",
        "authentication": "oAuth2",
        "approvalOptions": {
          "values": {
            "approvalType": "double"
          }
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "08a9c8e0-735d-4f40-a8f8-bfe7d7895839",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        10784,
        6000
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "ea1deebd-8132-48ea-a376-2f7a47bcc0f2",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "89b2d934-4b71-4b01-a116-d3f70b2547a7",
      "name": "Reply to review1",
      "type": "n8n-nodes-base.googleBusinessProfile",
      "position": [
        11008,
        6000
      ],
      "parameters": {
        "reply": "={{ $('AI Agent').item.json.output }}",
        "review": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Code in JavaScript1').item.json.reviewId }}"
        },
        "account": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "location": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "resource": "review",
        "operation": "reply",
        "requestOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "6cb967df-4a29-4697-a38d-88f91e678cb6",
      "name": "Fetch New Reviews",
      "type": "n8n-nodes-base.googleBusinessProfileTrigger",
      "position": [
        9536,
        5888
      ],
      "parameters": {
        "account": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "location": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "88b1b5b4-1973-4692-942b-9c9ec4f4ae44",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        8752,
        5600
      ],
      "parameters": {
        "width": 672,
        "height": 656,
        "content": "# Product Review Monitoring & AI Response Bot\n\nThis workflow automates how businesses handle Google reviews by combining real-time triggers, AI-generated responses, and optional human approval. Whenever a new review is posted, the workflow captures the data, generates a professional reply using AI, and decides whether to post it automatically or send it for manual approval via Slack.\n\nThis approach ensures fast responses for positive reviews while maintaining control over sensitive or negative feedback. It helps businesses improve customer engagement, maintain brand tone, and save time without compromising quality.\n\n### How it works\n- Trigger fires when a new Google review is added  \n- Review data is cleaned and structured  \n- AI generates a contextual reply  \n- Positive reviews \u2192 auto-reply  \n- Negative reviews \u2192 sent to Slack for approval  \n- Based on approval \u2192 reply is posted  \n\n### Setup\n- Connect Google Business Profile credentials  \n- Add AI model credentials (Groq/OpenAI)  \n- Connect Slack account for approval flow  \n- Configure IF conditions for rating logic  \n- Ensure correct mapping for review name & reply fields  "
      },
      "typeVersion": 1
    },
    {
      "id": "92c2aa6a-7d1a-4546-a324-537d9c9357a7",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        9456,
        5600
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 656,
        "content": "## Step 1 : Capture & Prepare Review Data\n\nFetch new Google reviews and extract key fields like name, rating, and comment to prepare clean input for AI processing."
      },
      "typeVersion": 1
    },
    {
      "id": "4ba5b1bd-bc94-4b85-855e-f35a28b7e859",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        9920,
        5600
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 656,
        "content": "## Step 2 : Generate AI Reply\n\nAI creates a professional, human-like response based on review content, rating, and business tone guidelines."
      },
      "typeVersion": 1
    },
    {
      "id": "f6a94702-2d32-47a5-af11-20d6539c0a3e",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        10272,
        5600
      ],
      "parameters": {
        "color": 7,
        "width": 944,
        "height": 656,
        "content": "## Step 3 : Decision & Response Handling\n\nPositive reviews are auto-replied. Negative reviews are sent to Slack for approval before posting the final response."
      },
      "typeVersion": 1
    },
    {
      "id": "bd4511d8-119c-4370-a600-e24c591e7c6d",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        9968,
        5888
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Reply to review",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send message and wait for response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Reply to review1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fetch New Reviews": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send message and wait for response": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}