AutomationFlowsData & Sheets › Claude API Single Record Analysis

Claude API Single Record Analysis

02 - Claude API Single Record Analysis. Uses httpRequest, googleSheets. Event-driven trigger; 9 nodes.

Event trigger★★★★☆ complexity9 nodesHTTP RequestGoogle Sheets
Data & Sheets Trigger: Event Nodes: 9 Complexity: ★★★★☆ Added:

This workflow follows the Google Sheets → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "02 - Claude API Single Record Analysis",
  "nodes": [
    {
      "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f11",
      "name": "\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u043e\u0440\u043a\u0444\u043b\u043e\u0443",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -240,
        -340
      ],
      "parameters": {
        "content": "Workflow 02 \u2014 \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 AI-\u0430\u043d\u0430\u043b\u0438\u0437. n8n \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u043e\u0444\u0444\u0435\u0440\u0430 \u0432 Claude API, Claude \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a Marketing Scout Agent \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u0433\u0438\u0439 JSON. \u0417\u0430\u0442\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0444\u0438\u043b\u044c\u0442\u0440 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 Google Sheets.",
        "height": 180,
        "width": 1000,
        "color": 4
      }
    },
    {
      "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f12",
      "name": "Manual Start",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        100,
        60
      ],
      "parameters": {}
    },
    {
      "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f13",
      "name": "Set Test Competitor Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        380,
        60
      ],
      "parameters": {
        "mode": "manual",
        "assignments": {
          "assignments": [
            {
              "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f21",
              "name": "platform",
              "value": "manual_test",
              "type": "string"
            },
            {
              "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f22",
              "name": "source_url",
              "value": "https://example.com/secured-auto-loan-test",
              "type": "string"
            },
            {
              "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f23",
              "name": "source_type",
              "value": "manual_test",
              "type": "string"
            },
            {
              "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f24",
              "name": "company_name",
              "value": "\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442",
              "type": "string"
            },
            {
              "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f25",
              "name": "profile_name",
              "value": "\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c",
              "type": "string"
            },
            {
              "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f26",
              "name": "profile_url",
              "value": "https://example.com/profile",
              "type": "string"
            },
            {
              "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f27",
              "name": "region",
              "value": "\u041c\u043e\u0441\u043a\u0432\u0430",
              "type": "string"
            },
            {
              "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f28",
              "name": "published_at",
              "value": "",
              "type": "string"
            },
            {
              "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f29",
              "name": "parsed_at",
              "value": "2026-06-05",
              "type": "string"
            },
            {
              "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f30",
              "name": "text_context",
              "value": "\u041a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043a\u0440\u0435\u0434\u0438\u0442 \u043f\u043e\u0434 \u0437\u0430\u043b\u043e\u0433 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044f. \u041e\u0431\u0435\u0449\u0430\u044e\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430 1 \u0434\u0435\u043d\u044c, \u0434\u0435\u043d\u044c\u0433\u0438 \u0432 \u0434\u0435\u043d\u044c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u043e \u041c\u043e\u0441\u043a\u0432\u0435 \u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u0438. \u041d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0435\u0441\u0442\u044c \u0430\u043a\u0446\u0435\u043d\u0442 \u043d\u0430 \u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u0437\u0430\u0439\u043c\u044b \u043f\u043e\u0434 \u041f\u0422\u0421 \u0438 \u043f\u043e\u043c\u043e\u0449\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u0441 \u043f\u043b\u043e\u0445\u043e\u0439 \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439.",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f14",
      "name": "Build Claude Request",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        660,
        60
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const item = $input.first().json;\nconst now = new Date().toISOString();\n\nconst systemPrompt = `You are Marketing Scout Agent v1 \u2014 a market intelligence analyst specialized in the Russian secured lending market.\n\nYour role is to analyze a single public market record and extract structured competitive intelligence.\n\nINDUSTRY CONTEXT: The secured lending market in Russia includes loans secured by car titles (\u0437\u0430\u0439\u043c \u043f\u043e\u0434 \u0437\u0430\u043b\u043e\u0433 \u041f\u0422\u0421/\u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044f), real estate (\u0437\u0430\u0439\u043c \u043f\u043e\u0434 \u0437\u0430\u043b\u043e\u0433 \u043d\u0435\u0434\u0432\u0438\u0436\u0438\u043c\u043e\u0441\u0442\u0438), refinancing, mortgage-adjacent services, and pawn-style auto lending (\u0430\u0432\u0442\u043e\u043b\u043e\u043c\u0431\u0430\u0440\u0434\u044b).\n\nOUTPUT FORMAT \u2014 CRITICAL RULES:\nYou MUST respond with ONLY a valid JSON object.\nNo explanation, no markdown, no code fences, no backticks.\nThe first character must be { and the last must be }.\nAll string values in the same language as the source text.\nAll field names exactly as specified \u2014 no aliases, no additions.\n\nSKIP CONDITIONS \u2014 return status=\"skipped\" with quality_score=1 if ANY is true:\n- text_context has fewer than 40 meaningful characters\n- text_context is navigation boilerplate (e.g. \"\u0413\u043b\u0430\u0432\u043d\u0430\u044f | \u041e \u043d\u0430\u0441 | \u041a\u043e\u043d\u0442\u0430\u043a\u0442\u044b | \u0426\u0435\u043d\u044b\")\n- text_context is empty, whitespace-only, or placeholder\n- content is unrelated to financial services, lending, or business\n- published_at is more than 180 days old with no freshness signals\nNEVER invent company names, contacts, prices, regions, or dates not present in the text.\nUse empty string \"\" for any field that cannot be determined.\n\nFRESHNESS (compare published_at to parsed_at):\n\"fresh\" = within 7 days | \"recent\" = 8-30 days | \"old\" = over 30 days | \"unknown\" = no date\n\nENTITY TYPES:\n\"competitor\" \u2014 actively offering secured lending products\n\"lead_signal\" \u2014 actively seeking a secured loan\n\"market_signal\" \u2014 news, regulation, or industry trend\n\"content_idea\" \u2014 topic revealing client pain points\n\"irrelevant\" \u2014 no connection to secured lending\n\nSERVICE TYPES (use exactly one):\n\"secured_auto_loan\" | \"secured_real_estate_loan\" | \"pts_loan\" | \"refinancing\" | \"mortgage_adjacent\" | \"generic_lending\" | \"unknown\"\n\nSCORING \u2014 integers 1-100:\nquality_score: 80-100 rich/actionable; 60-79 good with gaps; 40-59 partial; 20-39 sparse; 1-19 skip\nlead_signal_score: 80-100 explicit need+urgency; 60-79 clear need; 40-59 ambiguous; 20-39 weak; 1-19 none\ncontent_idea_score: 80-100 specific pain point for content; 60-79 clear angle; 40-59 usable; 20-39 generic; 1-19 none\ncompetitor_strength: 80-100 strong brand+pricing; 60-79 established; 40-59 moderate; 20-39 weak; 1-19 not a competitor\nBe conservative. Most records score 35-70 on quality_score. A score of 80+ must be exceptional.\n\nRECOMMENDED ACTION (use exactly one):\n\"monitor\" | \"contact\" | \"create_content\" | \"ignore\" | \"investigate\"\n\nREQUIRED JSON OUTPUT \u2014 all fields required, empty string for unknown strings:\n{\n  \"created_at\": \"<ISO 8601 datetime>\",\n  \"source_type\": \"<manual_test|scraped_web|apify|firecrawl|social|classified|unknown>\",\n  \"platform\": \"<from input>\",\n  \"source_url\": \"<from input>\",\n  \"parsed_at\": \"<from input>\",\n  \"published_at\": \"<from input or empty string>\",\n  \"freshness_status\": \"<fresh|recent|old|unknown>\",\n  \"entity_type\": \"<competitor|lead_signal|market_signal|content_idea|irrelevant>\",\n  \"company_name\": \"<string or empty>\",\n  \"profile_name\": \"<string or empty>\",\n  \"profile_url\": \"<from input or empty>\",\n  \"region\": \"<string or empty>\",\n  \"service_type\": \"<secured_auto_loan|secured_real_estate_loan|pts_loan|refinancing|mortgage_adjacent|generic_lending|unknown>\",\n  \"offer_text\": \"<1 sentence>\",\n  \"terms\": \"<string or empty>\",\n  \"contact_public\": \"<only from text, or empty>\",\n  \"text_context\": \"<cleaned summary max 300 chars>\",\n  \"detected_need\": \"<1 sentence or empty>\",\n  \"competitor_strength\": <integer 1-100>,\n  \"lead_signal_score\": <integer 1-100>,\n  \"content_idea_score\": <integer 1-100>,\n  \"quality_score\": <integer 1-100>,\n  \"reason\": \"<2-3 sentences explaining scores>\",\n  \"recommended_action\": \"<monitor|contact|create_content|ignore|investigate>\",\n  \"status\": \"<analyzed|skipped>\"\n}`;\n\nconst inputRecord = {\n  source_url: item.source_url || '',\n  platform: item.platform || 'unknown',\n  source_type: item.source_type || 'manual_test',\n  company_name: item.company_name || '',\n  profile_name: item.profile_name || '',\n  profile_url: item.profile_url || '',\n  region: item.region || '',\n  published_at: item.published_at || '',\n  parsed_at: item.parsed_at || now.substring(0, 10),\n  text_context: item.text_context || ''\n};\n\nconst userMessage = 'Analyze this market record. Return JSON only. No explanation, no markdown, no code fences.\\n\\n' + JSON.stringify(inputRecord, null, 2);\n\nreturn [{\n  json: {\n    model: 'claude-sonnet-4-6',\n    max_tokens: 1200,\n    temperature: 0.2,\n    system: systemPrompt,\n    messages: [\n      {\n        role: 'user',\n        content: userMessage\n      }\n    ]\n  }\n}];"
      }
    },
    {
      "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f15",
      "name": "Claude API Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        940,
        60
      ],
      "parameters": {
        "method": "POST",
        "url": "https://aiprimetech.io/v1/messages",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "anthropic-version",
              "value": "2023-06-01"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={{ JSON.stringify($json) }}",
        "options": {}
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f16",
      "name": "Parse Claude JSON Response",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1220,
        60
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "try {\n  const contentItems = $json.content;\n  if (!Array.isArray(contentItems)) {\n    throw new Error('Response has no content array');\n  }\n  const textItem = contentItems.find(c => c.type === 'text');\n  if (!textItem || !textItem.text) {\n    throw new Error('No text content item found in response');\n  }\n  let raw = textItem.text.trim();\n  raw = raw.replace(/^```json\\s*/i, '').replace(/\\s*```\\s*$/, '').trim();\n  raw = raw.replace(/^```\\s*/, '').replace(/\\s*```\\s*$/, '').trim();\n  const parsed = JSON.parse(raw);\n  if (!parsed.status) parsed.status = 'analyzed';\n  if (typeof parsed.quality_score !== 'number') parsed.quality_score = 1;\n  if (!parsed.entity_type) parsed.entity_type = 'irrelevant';\n  parsed.created_at = new Date().toISOString();\n  return [{ json: { ...parsed } }];\n} catch (err) {\n  return [{\n    json: {\n      created_at: new Date().toISOString(),\n      status: 'skipped',\n      quality_score: 1,\n      entity_type: 'irrelevant',\n      source_type: 'manual_test',\n      platform: '',\n      source_url: '',\n      parsed_at: '',\n      published_at: '',\n      freshness_status: 'unknown',\n      company_name: '',\n      profile_name: '',\n      profile_url: '',\n      region: '',\n      service_type: 'unknown',\n      offer_text: '',\n      terms: '',\n      contact_public: '',\n      text_context: '',\n      detected_need: '',\n      competitor_strength: 1,\n      lead_signal_score: 1,\n      content_idea_score: 1,\n      reason: 'Failed to parse Claude response: ' + err.message,\n      recommended_action: 'ignore',\n      raw_response_preview: JSON.stringify($json.content || '').substring(0, 500)\n    }\n  }];\n}"
      }
    },
    {
      "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f17",
      "name": "Quality Gate",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        1500,
        60
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f31",
              "leftValue": "={{ $json.status }}",
              "rightValue": "analyzed",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            },
            {
              "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f32",
              "leftValue": "={{ $json.quality_score }}",
              "rightValue": 60,
              "operator": {
                "type": "number",
                "operation": "gte"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f18",
      "name": "Append Row to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4,
      "position": [
        1780,
        0
      ],
      "parameters": {
        "authentication": "serviceAccount",
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "PASTE_SPREADSHEET_ID_HERE",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "results",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": []
        },
        "options": {}
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 5000
    },
    {
      "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f19",
      "name": "\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1500,
        300
      ],
      "parameters": {
        "content": "\u041f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0432\u044b\u0431\u0435\u0440\u0438 credential Claude API - Marketing Scout \u0432 HTTP Request node \u0438 Google Sheets credential \u0432 Append Row node. \u0423\u043a\u0430\u0436\u0438 Spreadsheet ID \u0442\u0430\u0431\u043b\u0438\u0446\u044b Marketing Scout Results. \u0423\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u2014 \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441 AI-\u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043b\u0438\u0441\u0442\u0435 results.",
        "height": 200,
        "width": 560,
        "color": 5
      }
    }
  ],
  "connections": {
    "Manual Start": {
      "main": [
        [
          {
            "node": "Set Test Competitor Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Test Competitor Data": {
      "main": [
        [
          {
            "node": "Build Claude Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Claude Request": {
      "main": [
        [
          {
            "node": "Claude API Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude API Request": {
      "main": [
        [
          {
            "node": "Parse Claude JSON Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Claude JSON Response": {
      "main": [
        [
          {
            "node": "Quality Gate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Quality Gate": {
      "main": [
        [
          {
            "node": "Append Row to Google Sheets",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f02",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "d6e7f8a9-b0c1-4d2e-3f4a-5b6c7d8e9f00",
  "tags": []
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

02 - Claude API Single Record Analysis. Uses httpRequest, googleSheets. Event-driven trigger; 9 nodes.

Source: https://github.com/CodeVinci8/vinci-ai-pilot/blob/main/n8n/workflows/02_claude_api_single_record_analysis.json — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

TrackCollect_deeper. Uses googleSheets, httpRequest, @n-octo-n/n8n-nodes-json-database, itemLists. Event-driven trigger; 80 nodes.

Google Sheets, HTTP Request, @N Octo N/N8N Nodes Json Database +1
Data & Sheets

This template is ideal for solo store owners, eCommerce marketers, automation beginners, or anyone using Shopify and Gmail who wants to recover lost revenue without coding.

HTTP Request, Gmail, Twilio +3
Data & Sheets

PCN. Uses googleSheets, httpRequest, @n-octo-n/n8n-nodes-json-database, itemLists. Event-driven trigger; 60 nodes.

Google Sheets, HTTP Request, @N Octo N/N8N Nodes Json Database +3
Data & Sheets

Product Ad Machine. Uses googleDrive, googleSheets, httpRequest, @ffmpeg-micro/n8n-nodes-ffmpeg-micro. Event-driven trigger; 60 nodes.

Google Drive, Google Sheets, HTTP Request +2
Data & Sheets

Basic AI SEO KW Research n8n DataForSEO Gumroad 030125. Uses googleSheets, googleDrive, httpRequest. Event-driven trigger; 56 nodes.

Google Sheets, Google Drive, HTTP Request