{
  "id": "vCNxezEYdPFetZfT",
  "meta": {
    "builderVariant": "mcp",
    "aiBuilderAssisted": true
  },
  "name": "Scrape Amazon products with Apify and enrich them with AI in Google Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "d42db076-bb26-4ae9-bc0d-5631c1124dd9",
      "name": "When clicking 'Test workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        16,
        256
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a8ee52cb-218e-4e0e-904d-cb854649937d",
      "name": "Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        304,
        256
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "amazon_search_url",
              "type": "string",
              "value": "https://www.amazon.com/s?k=wireless+earbuds"
            },
            {
              "id": "a2",
              "name": "apify_actor",
              "type": "string",
              "value": "junglee~amazon-crawler"
            },
            {
              "id": "a3",
              "name": "max_products",
              "type": "number",
              "value": 10
            },
            {
              "id": "a4",
              "name": "proxy_country",
              "type": "string",
              "value": "AUTO_SELECT_PROXY_COUNTRY"
            },
            {
              "id": "a5",
              "name": "openai_model",
              "type": "string",
              "value": "gpt-4o"
            },
            {
              "id": "a6",
              "name": "analysis_language",
              "type": "string",
              "value": "English"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f2071803-7f5d-4f6b-af6c-1546249773e1",
      "name": "Scrape Amazon products via Apify",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        640,
        256
      ],
      "parameters": {
        "url": "=https://api.apify.com/v2/acts/{{ $(\"Configuration\").item.json.apify_actor }}/run-sync-get-dataset-items",
        "method": "POST",
        "options": {
          "timeout": 300000
        },
        "jsonBody": "={{ { \"categoryOrProductUrls\": [ { \"url\": $(\"Configuration\").item.json.amazon_search_url } ], \"maxItemsPerStartUrl\": $(\"Configuration\").item.json.max_products, \"proxyCountry\": $(\"Configuration\").item.json.proxy_country, \"maxOffers\": 0 } }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "4129b6d1-17ac-4047-8320-171d06f5f841",
      "name": "Keep valid products",
      "type": "n8n-nodes-base.filter",
      "position": [
        960,
        256
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c1",
              "operator": {
                "type": "string",
                "operation": "notEmpty"
              },
              "leftValue": "={{ $json.title }}",
              "rightValue": ""
            },
            {
              "id": "c2",
              "operator": {
                "type": "string",
                "operation": "empty"
              },
              "leftValue": "={{ $json.error }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4c8fb059-3717-4d47-b024-fd9330b4ed50",
      "name": "Analyze product with AI",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1232,
        208
      ],
      "parameters": {
        "text": "=Analyze this Amazon product and respond in {{ $(\"Configuration\").item.json.analysis_language }}.\n\nTitle: {{ $json.title }}\nBrand: {{ $json.brand }}\nPrice: {{ $json.price?.value }} {{ $json.price?.currency }}\nRating: {{ $json.stars }} stars\nReviews: {{ $json.reviewsCount }}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "You are an e-commerce product analyst. For each Amazon product, return a compact structured analysis: a product category, one concise key selling feature (max 12 words), a one-sentence buyer verdict, and a value-for-money score from 1 (poor) to 10 (excellent) based on price, rating and review volume. Never invent data that is not provided."
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "98fe9166-a6dc-4d91-ba50-c2abe0566476",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1232,
        384
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $(\"Configuration\").item.json.openai_model }}"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "b21ad75a-7cb1-4a0f-aa10-035aea2a219e",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1392,
        368
      ],
      "parameters": {
        "jsonSchemaExample": "{ \"category\": \"Electronics\", \"key_feature\": \"40h battery life with active noise cancelling\", \"buyer_verdict\": \"Solid mid-range pick for commuters who value long battery life.\", \"value_score\": 8 }"
      },
      "typeVersion": 1.3
    },
    {
      "id": "f5a12c12-53ad-42b3-82bd-8dae6b9a3eea",
      "name": "Build result row",
      "type": "n8n-nodes-base.set",
      "position": [
        1744,
        256
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "r1",
              "name": "name",
              "type": "string",
              "value": "={{ $(\"Scrape Amazon products via Apify\").item.json.title }}"
            },
            {
              "id": "r2",
              "name": "asin",
              "type": "string",
              "value": "={{ $(\"Scrape Amazon products via Apify\").item.json.asin }}"
            },
            {
              "id": "r3",
              "name": "brand",
              "type": "string",
              "value": "={{ $(\"Scrape Amazon products via Apify\").item.json.brand }}"
            },
            {
              "id": "r4",
              "name": "price",
              "type": "string",
              "value": "={{ $(\"Scrape Amazon products via Apify\").item.json.price?.value }}"
            },
            {
              "id": "r5",
              "name": "currency",
              "type": "string",
              "value": "={{ $(\"Scrape Amazon products via Apify\").item.json.price?.currency }}"
            },
            {
              "id": "r6",
              "name": "rating",
              "type": "string",
              "value": "={{ $(\"Scrape Amazon products via Apify\").item.json.stars }}"
            },
            {
              "id": "r7",
              "name": "reviews",
              "type": "string",
              "value": "={{ $(\"Scrape Amazon products via Apify\").item.json.reviewsCount }}"
            },
            {
              "id": "r8",
              "name": "product_url",
              "type": "string",
              "value": "={{ $(\"Scrape Amazon products via Apify\").item.json.url }}"
            },
            {
              "id": "r9",
              "name": "category",
              "type": "string",
              "value": "={{ $json.output.category }}"
            },
            {
              "id": "r10",
              "name": "key_feature",
              "type": "string",
              "value": "={{ $json.output.key_feature }}"
            },
            {
              "id": "r11",
              "name": "buyer_verdict",
              "type": "string",
              "value": "={{ $json.output.buyer_verdict }}"
            },
            {
              "id": "r12",
              "name": "value_score",
              "type": "number",
              "value": "={{ $json.output.value_score }}"
            },
            {
              "id": "r13",
              "name": "scraped_at",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "44b291fc-c50f-4671-897b-51f62f6cb865",
      "name": "Save products to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2080,
        256
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "asin",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "asin",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "brand",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "brand",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "currency",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "currency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "rating",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "rating",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "reviews",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "reviews",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "product_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "product_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "key_feature",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "key_feature",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "buyer_verdict",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "buyer_verdict",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "value_score",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "value_score",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "scraped_at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "scraped_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "0",
          "cachedResultName": "amazon_products"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "1qbApWH0bKd3G5B1TR41sbUzcWBvc7FgRrMOe8CcZTJU",
          "cachedResultName": "amazon-products-sheet"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "499275c7-9387-43a9-9d61-812719bab694",
      "name": "Sticky Note 52bfd46b",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -672,
        -432
      ],
      "parameters": {
        "color": 4,
        "width": 560,
        "height": 1820,
        "content": "# Scrape Amazon products with Apify and enrich them with AI in Google Sheets\n\n# \ud83d\udce5  [Open full documentation on Notion](https://automatisation.notion.site/Course-Scrape-Amazon-products-with-Apify-and-enrich-them-with-AI-in-Google-Sheets-39d3d6550fd981c1b2a7e5c45c7adb12)\n\n## How it works\nTurn any Amazon search or category page into a clean, AI-enriched product sheet.\n1. **Configuration** \u2013 set your Amazon search URL, the Apify actor, how many products to pull, the proxy country, the OpenAI model and the analysis language, all in one node.\n2. **Scrape (Apify)** \u2013 an HTTP Request calls the Apify Amazon actor (run-sync-get-dataset-items) and returns structured products (title, ASIN, brand, price, rating, reviews) \u2014 no fragile HTML parsing.\n3. **Keep valid products** \u2013 a Filter drops empty or error rows returned by the scraper.\n4. **AI analysis** \u2013 a Basic LLM Chain (OpenAI) adds a category, a key selling feature, a one-line buyer verdict and a 1\u201310 value score for each product.\n5. **Save** \u2013 every enriched product is appended as a row in Google Sheets.\n\n## Setup\n1. Open **Configuration** and set amazon_search_url (an Amazon /s?k=... search page) and max_products.\n2. On **Scrape Amazon products via Apify**, select your **Apify API** credential (Header Auth: Authorization = Bearer YOUR_APIFY_TOKEN).\n3. On **OpenAI Chat Model**, select your **OpenAi account** credential.\n4. On **Save products to Google Sheets**, pick the spreadsheet and tab, then run.\n\n## Requirements\n- An **Apify** account + API token (used as a Header Auth credential). Default actor: junglee~amazon-crawler (paid); switch to a free actor via the apify_actor field.\n- An **OpenAI** API key (credential named OpenAi account).\n- A **Google Sheets** OAuth credential and a target spreadsheet.\n\n## Customization\n- Change amazon_search_url to any Amazon search, category or best-seller URL.\n- Swap apify_actor for another Amazon actor.\n- Edit the system prompt in **Analyze product with AI** to change what the AI returns (pros/cons, target audience, price tier).\n- Route the output to Airtable, Notion or a database instead of Google Sheets.\n\n---\nNeed help customizing?\nContact me for consulting and support : [Linkedin](https://www.linkedin.com/in/doctor-firass/)\n\n# MY NEW YOUTUBE CHANNEL\n\ud83d\udc49 [Subscribe to my new YouTube channel](https://www.youtube.com/@DrFiras_AI). Here I will share videos and Shorts with practical tutorials and FREE templates for n8n.\n\n[![The AI Doctor](https://www.dr-firas.com/the-ai-doctor.png)](https://www.youtube.com/@DrFiras_AI)"
      },
      "typeVersion": 1
    },
    {
      "id": "fb3a8d08-e416-4fe1-8eb5-b1f64ee63eea",
      "name": "Sticky Note de095981",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 540,
        "height": 392,
        "content": "## 1. Configuration\nSet your Amazon search URL, actor, product count, proxy country, model and language here \u2014 the only node you must edit before running."
      },
      "typeVersion": 1
    },
    {
      "id": "5f8b5f35-56cf-4d78-8199-a62cfc5563b4",
      "name": "Sticky Note 346e2c08",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 392,
        "content": "## 2. Scrape Amazon (Apify)\nCalls the Apify Amazon actor and returns structured products. Select your Apify API credential. Timeout is raised to 5 min for larger runs."
      },
      "typeVersion": 1
    },
    {
      "id": "9a5bc67d-975b-4c4f-beb4-218bced10329",
      "name": "Sticky Note c3bb41c3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 392,
        "content": "## 3. Keep valid products\nDrops empty rows and scraper error items before the AI step."
      },
      "typeVersion": 1
    },
    {
      "id": "4cc269b4-8442-4e11-b5cb-661f263e1d2c",
      "name": "Sticky Note f9dc3d42",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 388,
        "content": "## 4. AI product analysis\nBasic LLM Chain + OpenAI add a category, key feature, buyer verdict and 1\u201310 value score per product."
      },
      "typeVersion": 1
    },
    {
      "id": "b0ba80b1-cf46-4faf-b07e-2661cfb46d3f",
      "name": "Sticky Note e97bb1fd",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 540,
        "height": 392,
        "content": "## 5. Save to Google Sheets\nAppends each enriched product as a new row. Pick your spreadsheet and tab."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": true,
    "executionOrder": "v1"
  },
  "versionId": "4a928742-d10a-4e91-99d3-336045ae416c",
  "nodeGroups": [],
  "connections": {
    "Configuration": {
      "main": [
        [
          {
            "node": "Scrape Amazon products via Apify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build result row": {
      "main": [
        [
          {
            "node": "Save products to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze product with AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Keep valid products": {
      "main": [
        [
          {
            "node": "Analyze product with AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze product with AI": {
      "main": [
        [
          {
            "node": "Build result row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Analyze product with AI",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "When clicking 'Test workflow'": {
      "main": [
        [
          {
            "node": "Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Amazon products via Apify": {
      "main": [
        [
          {
            "node": "Keep valid products",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}