{
  "name": "Outscraper - AI Agent review triage",
  "nodes": [
    {
      "parameters": {},
      "id": "3c35f4b9-0278-4915-ac63-43587bf7446f",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        112,
        240
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "place_url",
              "name": "place_url",
              "type": "string",
              "value": "https://www.google.com/maps/place/%D0%A3%D0%BE%D0%BB%D0%B4%D0%BE%D1%80%D1%84-%D0%90%D1%81%D1%82%D0%BE%D1%80%D0%B8%D1%8F/@40.7315435,-74.0846167,12z/data=!3m1!5s0x89c258fce483579d:0x2d04dcb1e8a8aedd!4m12!1m2!2m1!1z0JPQvtGB0YLQuNC90LjRhtGL!3m8!1s0x89c258fc55ba384f:0x7ebcd3b680ebd80e!5m2!4m1!1i2!8m2!3d40.7564821!4d-73.9734562!16zL20vMDJneXpj?entry=ttu&g_ep=EgoyMDI2MDQyNy4wIKXMDSoASAFQAw%3D%3D"
            },
            {
              "id": "reviews_limit",
              "name": "reviews_limit",
              "type": "number",
              "value": 25
            }
          ]
        },
        "options": {}
      },
      "id": "34cbba6c-4f91-4a14-bba1-00b416ff98ee",
      "name": "Set Place",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        336,
        240
      ]
    },
    {
      "parameters": {
        "operation": "reviews",
        "query": "={{$json.place_url}}",
        "reviewsLimit": "={{$json.reviews_limit}}",
        "requestOptions": {}
      },
      "id": "68687735-146c-48f0-a652-47117e399023",
      "name": "Outscraper - Google Maps Reviews",
      "type": "n8n-nodes-outscraper.outscraper",
      "typeVersion": 2,
      "position": [
        576,
        240
      ],
      "credentials": {
        "outscraperApi": {
          "id": "8AvSJfwIww0gbyf7",
          "name": "Outscraper account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "function isReview(v){return v&&typeof v==='object'&&!Array.isArray(v)&&(v.review_text||v.text||v.review||v.rating);} function collect(v,out=[]){if(!v)return out; if(Array.isArray(v)){for(const x of v)collect(x,out); return out;} if(isReview(v)){out.push(v); return out;} if(typeof v==='object'){for(const key of ['data','reviews','results','items']) if(key in v) collect(v[key],out);} return out;} const reviews=$input.all().flatMap(i=>collect(i.json)).slice(0,50).map(r=>({rating:r.rating||r.review_rating||null, text:r.review_text||r.text||r.review||'', author:r.author_title||r.author||r.name||'', date:r.review_datetime_utc||r.date||r.review_date||''})); return [{json:{review_count:reviews.length, reviews}}];"
      },
      "id": "aa484859-eb11-4e31-926f-52971a82e3b5",
      "name": "Normalize Reviews for Agent",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        816,
        240
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Analyze these Outscraper reviews. Use the connected structured output parser and return only the requested JSON shape. Focus on actionable customer-experience signals, urgent response priorities, and owner reply guidance. Input JSON: {{ JSON.stringify($json) }}",
        "hasOutputParser": true,
        "options": {
          "enableStreaming": false
        }
      },
      "id": "ad236cc6-2122-4300-b58a-8db3f28b4e6b",
      "name": "AI Agent - Review Triage",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        1104,
        240
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-5.4-mini",
          "mode": "list",
          "cachedResultName": "gpt-5.4-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "id": "b1601d02-1e91-46b6-aa17-f6b596b005ae",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        1056,
        448
      ],
      "credentials": {
        "openAiApi": {
          "id": "cF6D8w13EQm9nSZt",
          "name": "OpenAI account"
        }
      }
    },
    {
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"additionalProperties\": false,\n  \"required\": [\"sentiment_summary\", \"overall_sentiment\", \"urgent_issues\", \"common_praise\", \"common_complaints\", \"reply_priorities\", \"suggested_owner_message\"],\n  \"properties\": {\n    \"sentiment_summary\": { \"type\": \"string\" },\n    \"overall_sentiment\": {\n      \"type\": \"string\",\n      \"enum\": [\"positive\", \"mixed\", \"negative\", \"insufficient_data\"]\n    },\n    \"urgent_issues\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"additionalProperties\": false,\n        \"required\": [\"issue\", \"severity\", \"evidence\"],\n        \"properties\": {\n          \"issue\": { \"type\": \"string\" },\n          \"severity\": {\n            \"type\": \"string\",\n            \"enum\": [\"low\", \"medium\", \"high\"]\n          },\n          \"evidence\": { \"type\": \"string\" }\n        }\n      }\n    },\n    \"common_praise\": {\n      \"type\": \"array\",\n      \"items\": { \"type\": \"string\" }\n    },\n    \"common_complaints\": {\n      \"type\": \"array\",\n      \"items\": { \"type\": \"string\" }\n    },\n    \"reply_priorities\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"additionalProperties\": false,\n        \"required\": [\"priority\", \"review_type\", \"recommended_action\"],\n        \"properties\": {\n          \"priority\": { \"type\": \"number\" },\n          \"review_type\": { \"type\": \"string\" },\n          \"recommended_action\": { \"type\": \"string\" }\n        }\n      }\n    },\n    \"suggested_owner_message\": { \"type\": \"string\" }\n  }\n}"
      },
      "id": "cc0ba5e0-1571-4049-95c6-75823153238a",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        1312,
        448
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Set Place",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Place": {
      "main": [
        [
          {
            "node": "Outscraper - Google Maps Reviews",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Outscraper - Google Maps Reviews": {
      "main": [
        [
          {
            "node": "Normalize Reviews for Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Reviews for Agent": {
      "main": [
        [
          {
            "node": "AI Agent - Review Triage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - Review Triage",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent - Review Triage",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "versionId": "f773b976-1152-4f21-ad34-5db1f0d9fa7a",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "bd51ba3d599fc63602ae14309acd27ef3912f3068784a786f28ba05657ba8dbb"
  },
  "id": "pIbZgZjtI7o12DPs",
  "tags": []
}
