8
n8n 한국어amn8n.com

전자상거래 제품 최적화 - Bright Data와 OpenAI

중급

이것은AI분야의자동화 워크플로우로, 9개의 노드를 포함합니다.주로 Code, HttpRequest, ManualTrigger, Agent, OpenAi 등의 노드를 사용하며인공지능 기술을 결합하여 스마트 자동화를 구현합니다. Bright Data와 OpenAI를 사용한 전자상거래 제품 최적화

사전 요구사항
  • 대상 API의 인증 정보가 필요할 수 있음
  • OpenAI API Key

카테고리

워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "meta": {
    "instanceId": "8212eef3ce503a3ff3b5a20b8326474820fb627fc1c3dc8486795debd39d8d25",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "93bc29f2-3004-4daa-8def-89cf9b4ad46a",
      "name": "워크플로우 실행 시",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "8a6e68ec-ff87-4c6b-b629-34021258a582",
      "name": "BrightData",
      "type": "@brightdata/n8n-nodes-brightdata.brightData",
      "position": [
        220,
        0
      ],
      "parameters": {
        "urls": "[\n  {\"url\":\"https://www.amazon.com/AmazonBasics-Multipurpose-Copy-Printer-Paper/dp/B01FV0F8H8/ref=zg_bs_g_office-products_d_sccl_1/142-6608713-4877828?psc=1\"},\n  {\"url\":\"https://www.amazon.com/Scotch-Shipping-Packaging-Dispenser-142-6/dp/B000J07BRQ/ref=zg_bs_g_office-products_d_sccl_2/142-6608713-4877828?psc=1\"},\n  {\"url\":\"https://www.amazon.com/Amazon-Basics-Premium-Colored-Multicolor/dp/B07D93R5HV/ref=zg_bs_g_office-products_d_sccl_3/142-6608713-4877828?psc=1\"},\n  {\"url\":\"https://www.amazon.com/HP-Cartridge-Black-3YM57AN-Tri-Color/dp/B08412PTS8/ref=zg_bs_g_office-products_d_sccl_4/142-6608713-4877828?psc=1\"},\n  {\"url\":\"https://www.amazon.com/HP-Printer-Paper-Print20-200060R/dp/B001AFL8GY/ref=zg_bs_g_office-products_d_sccl_5/142-6608713-4877828?psc=1\"},\n  {\"url\":\"https://www.amazon.com/Scotch-Shipping-Packaging-Dispenser-142L/dp/B000MVV6AA/ref=zg_bs_g_office-products_d_sccl_6/142-6608713-4877828?psc=1\"},\n  {\"url\":\"https://www.amazon.com/Amazon-Basics-50-Sheet-Legal-Inches/dp/B00QSR9URI/ref=zg_bs_g_office-products_d_sccl_7/142-6608713-4877828?psc=1\"},\n  {\"url\":\"https://www.amazon.com/Sharpie-Permanent-Markers-Resistant-Coloring/dp/B00006IFHD/ref=zg_bs_g_office-products_d_sccl_8/142-6608713-4877828?psc=1\"},\n  {\"url\":\"https://www.amazon.com/AmazonBasics-Thermal-Laminating-Plastic-Laminator/dp/B079KL4C91/ref=zg_bs_g_office-products_d_sccl_9/142-6608713-4877828?psc=1\"},\n  {\"url\":\"https://www.amazon.com/YSAGi-Leather-Protector-Non-Slip-Waterproof/dp/B0BMTPC44X/ref=zg_bs_g_office-products_d_sccl_10/142-6608713-4877828?psc=1\"},\n  {\"url\":\"https://www.amazon.com/EZlifego-Multipurpose-Removable-Transparent-Household/dp/B07VNSXY31/ref=zg_bs_g_office-products_d_sccl_11/142-6608713-4877828?psc=1\"},\n  {\"url\":\"https://www.amazon.com/BIC-Highlighter-Chisel-Assorted-5-Count/dp/B000Q5ZGIA/ref=zg_bs_g_office-products_d_sccl_12/142-6608713-4877828?psc=1\"},\n  {\"url\":\"https://www.amazon.com/Academic-Planner-2025-2026-Monthly-Calendar/dp/B0DXPSZDP9/ref=zg_bs_g_office-products_d_sccl_22/142-6608713-4877828?psc=1\"}\n]\n",
        "resource": "webScrapper",
        "dataset_id": {
          "__rl": true,
          "mode": "list",
          "value": "gd_l1vijixj9g2vp7563",
          "cachedResultName": "Amazon best seller products"
        },
        "requestOptions": {}
      },
      "credentials": {
        "brightdataApi": {
          "id": "YOUR_BRIGHTDATA_CREDENTIAL_ID",
          "name": "BrightData account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7a817929-aa8a-4813-9fd0-e778c46ad173",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        440,
        0
      ],
      "parameters": {
        "jsCode": "// get all incoming items\nconst allInputItems = $input.all(); \n\nlet jsonlString = \"\";\n// define the training prompt\nconst systemMessage = \"You are an expert marketing assistant specializing in writing compelling and informative product descriptions.\";\n\n// loop through each item retrieved from the input\nfor (const item of allInputItems) {\n  const product = item.json; \n\n  // validate if the product data exists and is an object\n  if (!product || typeof product !== 'object') {\n    console.warn('Skipping an item because product data is missing or not an object:', item);\n    continue;\n  }\n\n  // extract product data\n  const title = product.title || \"N/A\";\n  const brand = product.brand || \"N/A\";\n  let featuresString = \"Not specified\";\n  if (product.features && Array.isArray(product.features) && product.features.length > 0) {\n    featuresString = product.features.slice(0, 5).join(', '); \n  }\n  // create a snippet of the original product description for training\n  const originalDescSnippet = (product.description || \"No original description available.\").substring(0, 250) + \"...\";\n  // create prompt with specific details about the product\n  const userPrompt = `Generate a product description for the following item. Title: ${title}. Brand: ${brand}. Key Features: ${featuresString}. Original Description Snippet: ${originalDescSnippet}.`;\n\n  // create template for the kind of description the AI should generate\n  let idealDescription = `Discover the ${title} from ${brand}, a top-choice for discerning customers. `;\n  idealDescription += `Key highlights include: ${featuresString}. `;\n  if (product.rating) {\n    idealDescription += `Boasting an impressive customer rating of ${product.rating} out of 5 stars! `;\n  }\n  idealDescription += `This product, originally described as \"${originalDescSnippet}\", is perfect for anyone seeking quality and reliability. `;\n  idealDescription += `Don't miss out on the ${product.availability === \"In Stock\" ? \"readily available\" : \"upcoming\"} ${title} – enhance your collection today!`;\n\n  // create a training example object in the format expected by OpenAI\n  const trainingExample = {\n    messages: [\n      { role: \"system\", content: systemMessage },\n      { role: \"user\", content: userPrompt },\n      { role: \"assistant\", content: idealDescription }\n    ]\n  };\n  jsonlString += JSON.stringify(trainingExample) + \"\\n\";\n}\n\n// remove any leading or trailing whitespace\nconst fileContentString = jsonlString.trim();\n\n// check if any product data was actually processed\nif (fileContentString.length === 0) {\n  console.warn(\"No product data was processed, outputting empty file content.\");\n  return [{ \n    json: { error: \"No products processed\", fileNameToUse: \"data.jsonl\" },\n    binary: {} \n  }];\n}\n\n// convert the final JSONL string into a Buffer (raw binary data)\nconst buffer = Buffer.from(fileContentString, 'utf-8');\n// define the filename that will be used when this data is sent to OpenAI\nconst actualFileNameForOpenAI = \"data.jsonl\";\n// define the MIME type for the file\nconst mimeType = 'application/jsonl'; \n\n// prepare the binary data for output\nconst binaryData = await this.helpers.prepareBinaryData(buffer, actualFileNameForOpenAI, mimeType);\n\n// return the processed data\nreturn [{\n  json: {\n    processedFileName: actualFileNameForOpenAI \n  },\n  binary: {\n    // the \"Input Data Field Name\" in the OpenAI node\n    \"data.jsonl\": binaryData \n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "9e8f8656-79c5-4d8a-8e27-f07907ba852e",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        660,
        0
      ],
      "parameters": {
        "options": {
          "purpose": "fine-tune"
        },
        "resource": "file",
        "binaryPropertyName": "data.jsonl"
      },
      "credentials": {
        "openAiApi": {
          "id": "YOUR_OPENAI_CREDENTIAL_ID",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "f391f934-1804-41ad-9ad5-303c613999b6",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        840,
        0
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/fine_tuning/jobs",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"training_file\": \"{{ $json.id }}\",\n  \"model\": \"gpt-4o-mini-2024-07-18\"\n} ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "openAiApi"
      },
      "credentials": {
        "openAiApi": {
          "id": "YOUR_OPENAI_CREDENTIAL_ID",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "add8279c-fdaf-4e6c-9b6b-242a85295cf5",
      "name": "채팅 메시지 수신 시",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        0,
        200
      ],
      "webhookId": "aa97eb0d-e190-40b8-aecd-f36f239f7ad1",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "72c8af8d-45e0-4ae8-b10b-723e8bf1f61c",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        220,
        200
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "392b85ba-0ded-4838-ba17-df858e7f922d",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        260,
        420
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_FINE_TUNED_MODEL_ID"
        },
        "options": {
          "responseFormat": "text"
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "YOUR_OPENAI_CREDENTIAL_ID",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cab8fbc8-5cff-4b14-a36d-d7d89a83cf6e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -480
      ],
      "parameters": {
        "width": 280,
        "height": 1080,
        "content": "This n8n workflow automates scraping Amazon product data and uses it for fine-tuning a custom OpenAI model for marketing copy.\n\n## Steps Overview\n\n1. **Manual Trigger:**  \n   The workflow starts when you click \"Execute workflow\" in n8n.\n\n2. **Bright Data Node:**  \n   Scrapes product data from a list of Amazon URLs using Bright Data's web scraper integration.\n\n3. **Code Node:**  \n   Processes the scraped product data:\n   - Generates training examples (system prompt, user prompt, assistant response) for each product.\n   - Aggregates these examples into a `.jsonl` file formatted for OpenAI fine-tuning.\n\n4. **OpenAI File Upload Node:**  \n   Uploads the `.jsonl` training file to OpenAI, declaring it for use in fine-tuning.\n\n5. **HTTP Request Node:**  \n   Starts a fine-tuning job for an OpenAI GPT model using the uploaded file.\n\n6. **Chat/Agent Subworkflow:**  \n   Contains a chat trigger and an AI agent. This uses the newly fine-tuned OpenAI model to generate product descriptions or marketing content via chat.\n\n---\n\n**Important:**  \nYou must replace the placeholder API credentials and IDs in the workflow (Bright Data API, OpenAI API, and the fine-tuned model ID in the agent node) with your own valid keys and model identifiers for the workflow to function correctly.\n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "7a817929-aa8a-4813-9fd0-e778c46ad173": {
      "main": [
        [
          {
            "node": "9e8f8656-79c5-4d8a-8e27-f07907ba852e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9e8f8656-79c5-4d8a-8e27-f07907ba852e": {
      "main": [
        [
          {
            "node": "f391f934-1804-41ad-9ad5-303c613999b6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8a6e68ec-ff87-4c6b-b629-34021258a582": {
      "main": [
        [
          {
            "node": "7a817929-aa8a-4813-9fd0-e778c46ad173",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "392b85ba-0ded-4838-ba17-df858e7f922d": {
      "ai_languageModel": [
        [
          {
            "node": "72c8af8d-45e0-4ae8-b10b-723e8bf1f61c",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "add8279c-fdaf-4e6c-9b6b-242a85295cf5": {
      "main": [
        [
          {
            "node": "72c8af8d-45e0-4ae8-b10b-723e8bf1f61c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "93bc29f2-3004-4daa-8def-89cf9b4ad46a": {
      "main": [
        [
          {
            "node": "8a6e68ec-ff87-4c6b-b629-34021258a582",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

이 워크플로우를 어떻게 사용하나요?

위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.

이 워크플로우는 어떤 시나리오에 적합한가요?

중급 - 인공지능

유료인가요?

이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.

워크플로우 정보
난이도
중급
노드 수9
카테고리1
노드 유형9
난이도 설명

일정 경험을 가진 사용자를 위한 6-15개 노드의 중간 복잡도 워크플로우

저자
Daniel Shashko

Daniel Shashko

@tomax

AI automation specialist and a marketing enthusiast. More than 6 years of experience in SEO/GEO. Senior SEO at Bright Data.

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34