Searching eBay with AI and Automation using n8n

Intro

Welcome to Part 2 of our tutorial series. Previously (Part 1), we created an automated workflow that takes an image and returns potential item names using Google’s visual search.

In case you missed it, you can find Part 1 here:

Uploading Images and Searching with Google Lens via SerpApi
In this tutorial, we’ll build an automation that identifies an item using visual search. By leveraging Google Lens (via SerpApi) for image recognition, you can quickly determine the exact name of a card or collectible.

Now, we’ll close the loop by integrating AI and price lookup. The goal for this second part is to automatically figure out which of those candidate titles is the correct one for our item, and then find how much it’s selling for on eBay.

We will use AI to pick the best title, and then use SerpApi’s eBay Search API to fetch live pricing data. We’ll also touch on ways to log or store this info for future use.

What You’ll Need

  • n8n: the same n8n setup from Part 1. The workflow will be extended, so have that ready.
  • SerpApi API key: continue using your SerpApi account for the eBay search step. (No new setup if you have it from Part 1.)
  • OpenAI API Key: an OpenAI account (or another supported LLM in n8n). You’ll input this in n8n’s credentials so the AI Agent node can access the model.
  • (optional) Google Sheet or Database: If you want to store the results (item names and prices) for record-keeping or price tracking, you can prepare a Google Sheet or database. This is optional, but we’ll discuss how you could send data to Google Sheets as an example.

Workflow Continuation

Now we will extend the workflow from Part 1. After extracting the list of possible titles, we’ll add steps for AI processing and eBay lookup. Referring to the workflow diagram (from Part 1) for context, our new nodes will come after the “Extract Visual Match Titles” step.

Your workflow should currently look like this:

Using the AI Agent to Refine Results

n8n offers a variety of AI nodes, with capabilities ranging from text summarization to classification. For our use case, we’ll use the AI Agent node, which lets you attach multiple chat models and tools to the agent.

AI Agent node documentation | n8n Docs
Learn how to use the AI Agent node in n8n. Follow technical documentation to integrate AI Agent node into your workflows.

We’ll use the AI Agent to determine the most likely product name based on the title list we generated in the previous blog post.

Add the AI Agent node to your workflow and set the Source for Prompt option to Define below. This allows us to pass our title list to the chatbot and provide it with context.

For the prompt (user message), I’ve used the following:

Here are the top visual matches from a Google Lens search for a product image: {{ $json.titlesList }}

Return the most likely product title from these matches that best describes the specific item in the image.

Do not include bundle listings, condition, or unrelated items.

Next, add a System Message (not shown by default) to give the chatbot additional instructions:

You are an AI assistant that specializes in identifying and generating accurate, search-optimized product titles from visual search data.

Given a list of titles extracted from a reverse image search, return the most likely full product title for the specific item in the image.

Your output should be a clean, concise string that includes the key identifiers (brand, model, year, type, edition, etc.) — formatted like a product listing title someone might search for on a marketplace (e.g., eBay or Amazon).

Only return the title — no explanations or extra words.

Do not include specific model numbers unless they are relevant to the product. For example:

Sony PlayStation 5 Digital Edition Console (Model CFI-1218B)

Can just be:

Sony PlayStation 5 Digital Edition Console

Your AI Agent parameters should now look like this:

We’re not quite done configuring the AI Agent. We still need to add a Chat Model, along with any tools that might help the AI Agent process the data.

To add a Chat Model, click the plus (+) button shown at the bottom of the previous screenshot. I’ll be using an OpenAI chat model, but feel free to experiment with others to see which best suits your use case.

Configuration will vary depending on the model you choose. In most cases, you’ll need to provide an API key. Refer to n8n’s documentation for setup instructions specific to your model.

Once configured, execute the step to ensure the model returns a clear and relevant product title for the input provided:

Searching eBay via SerpApi

Next, we'll use eBay to get a list of recent sales for our product to determine a fair price.

From the SerpApi node, add the Search eBay action to the workflow. From the parameters menu, we'll only need to set the following:

  • Search Query: {{ $json.output }} - This will pass the output from our AI Agent step as the query parameter.
  • Results filter (additional field): Sold - It is important that this parameter is capitalized. This parameter ensures that we only get results back for recently sold items.
  • Disable Caching (optional): true - SerpApi caches queries for 1 hour after they are performed. Meaning, a cached search will be returned if you perform another search with the same exact search parameters within an hour of the initial search. I've chosen to disable this parameter to ensure the freshest data possible.

Once configured, our node should look like this:

Now, lets go ahead and test the step by executing the step:

Saving the Data

n8n offers a multitude of options for working with and saving data returned by the eBay API. You can write directly to a SQL database, push data to cloud-based data warehouses like Snowflake, or simply log it to a Google Sheet. From this point forward, I would recommend exploring n8n to best fit your specific use case, but in this example, we’ll be using Google Sheets.

For each sold item returned, we want to create a row in our sheet to make it easy to filter and sort information such as the title, condition, and price.

First, we need to extract the organic results from the eBay API response using a Code node. I’ve used JavaScript here, but you can also use Python:

const results = $input.first().json.organic_results

return results

This will output each result individually so we can pass them to the Google Sheets node.

Next, configure the Google Sheets node by selecting the “Append row in sheet” operation. Choose the document and sheet you want to write to, and make sure you’ve already added columns for each data point you plan to include. In this example, I’ve added Title, Link, Condition, and Price.

Finally, map the appropriate attributes from n8n to the corresponding columns in your Google Sheet.

If all went well, all of our results should have been written to a Google Sheet:

Wrap-Up

In Part 2, we completed our journey from an image to actionable data. We used an AI agent to refine the search results and pinpoint the exact product name, then tapped into eBay’s data to find its market price. At this point, our “Visual Search to Price Tracking” workflow is fully functional: you can POST an image and get back the likely item name and its price on eBay within seconds.

Ideas for Scaling Further: Now that the basic workflow is done, you can enhance it even more:

  • Batch Processing: Have multiple images? You could modify the workflow to handle an array of images in one go, or simply trigger it multiple times. n8n could even watch an email or folder for new images and process them automatically.
  • Scheduled Price Checks: As mentioned, you could use a Scheduler (Cron) node to periodically run the eBay search for saved item names, building a daily price tracker. This might help you notice trends (e.g., prices going up or down over time).
  • Alerts for Price Drops or Increases: With a slight extension, you could compare the latest price to a previous one (store the last known price in a workflow variable or database). If the price drops by a certain percentage, have n8n send you an alert – useful for deciding when to sell or buy more.
  • Integration into Listing Workflow: If you are a seller, you could integrate this into your listing creation process. For example, when you want to list a new item, run it through this workflow to get the suggested title and price, then automatically draft an eBay listing or a listing in your inventory system with those details.

We hope this two-part tutorial showed the power of combining AI, web scraping and automation. By chaining these tools (image recognition, language understanding, and web data retrieval), you can automate typically monotonous manual tasks. Whether you’re a card collector pricing out your collection or an online seller researching products, this workflow can save you a ton of time.

Resources

n8n - SerpApi
Search engine scraping tutorials, API updates and other tips.
Boost Your n8n Workflows with SerpApi’s Verified Node
Add real-time search to your n8n workflows and AI Agents with SerpApi’s node. Featuring over 20 APIs including Google Search, Google Maps, Bing, and more.
How to Scrape eBay Search Results
In the world of e-commerce, eBay is one of the largest online marketplaces, along with Amazon, Walmart, Etsy, Alibaba, Rakuten... Scraping eBay search results brings massive value to businesses, researchers, and consumers, such as market research and competitor analysis, pricing intelligence, product research and development, consumer insights, and enhancing buying