Amazon Book Data Extraction and Automated Purchase Report Generation - n8n Workflow

Use this powerful n8n workflow to scrape Amazon Bestsellers using Decodo API, extract structured data with an OpenAI agent, and automatically generate detailed PDF purchase reports for Slack and Google Drive.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Market analysts needing real-time price and ranking data from large e-commerce sites.
Operations teams looking for ready-to-use n8n templates for data ingestion and reporting.
Developers utilizing the Decodo Scraper API and LangChain agents within an n8n node environment.
Users seeking high-level, production-ready n8n automation for AI-driven web scraping.

Overview

This advanced n8n workflow provides a complete solution for deep web scraping and automated business intelligence reporting. It addresses the challenge of scraping complex, JavaScript-heavy sites like Amazon by leveraging the Decodo Scraper API for reliable content retrieval. The raw HTML is then passed to an intelligent AI agent using the LangChain n8n node, which performs structured data extraction. Finally, the system compiles the insights into a professional, statistical report (analyzing prices, ratings, and categories), saves it as a Google Doc and PDF, and pushes the final artifact to Slack, showcasing the power of integrated AI and data operations within the n8n ecosystem. This end-to-end n8n workflow template minimizes manual data processing time and delivers actionable insights automatically.

How it Works


  1. The process begins with the When clicking ‘Execute workflow’ n8n trigger, initiating the automation on demand.

  2. The Edit Fields n8n node configures the necessary Decodo API token and the Amazon Best Sellers URL, defining the inputs for the rest of the n8n workflow.

  3. The Scraper API Request HTTP Request n8n node calls the Decodo API to crawl the target URL, handling rendering and headless JavaScript to ensure accurate data capture.

  4. The HTML Response Parser code n8n node cleans the resulting raw HTML, preparing the text for the AI by stripping scripts, styles, and normalizing whitespace.

  5. The Product Analyzer Agent (a LangChain n8n node), utilizing the OpenAI Chat Model and a Structured Output Parser, processes the cleaned text. The parser enforces a strict JSON schema, ensuring consistent extraction of book details like title, author, and price, a core function of this n8n workflow.

  6. The Build 📚 Book Purchase Report code n8n node generates a detailed Markdown report based on the extracted structured JSON data, including KPIs, price distributions, and popularity rankings.

  7. The report is saved to Google Drive: first by setting the folder ID using an n8n node, then uploading the Markdown as a Google Document (Create document file), and finally converting and downloading it as a PDF (Convert document to PDF).

  8. The final step uses the Upload report to Slack n8n node to distribute the PDF file to the designated team channel, completing the automated distribution component of the n8n workflow.

Installation Guide

This n8n workflow requires credentials for four services: Decodo, OpenAI, Google Drive, and Slack.


  1. Import the n8n workflow: Copy the provided JSON data and paste it into your n8n instance (New -> Import from JSON).

  2. Decodo Scraper API: In the starting Edit Fields n8n node, replace the placeholder text in the Authenticate_Token assignment with your actual Decodo API Key.

  3. OpenAI Credentials: Update the OpenAI Chat Model n8n node with your OpenAI API Key credential, ensuring access to a capable model like gpt-4.1-mini.

  4. Google Drive/Docs: Set up an OAuth2 credential for Google Drive/Docs. This is used in the document creation n8n nodes. In the Configure Google Drive Folder n8n node, update the Drive Folder ID assignment to your preferred destination folder.

  5. Slack: Configure an OAuth2 credential for the Slack n8n node, ensuring it has files:write and chat:write scopes. Update the Channel ID in the Upload report to Slack n8n node to target your team's channel.

  6. Test the full n8n workflow execution.

Node Details

When clicking ‘Execute workflow’ (Manual Trigger): This is the primary n8n trigger that starts the execution of the entire n8n workflow.
Edit Fields (Set n8n node): Configures the core input variables, including the Authenticate_Token for Decodo and the Amazon target url (https://www.amazon.com/Best-Sellers-Books/zgbs/books).
Scraper API Request (HTTP Request n8n node): Sends a POST request to the Decodo Scraper API (https://scraper-api.decodo.com/v2/scrape) to retrieve the fully rendered HTML of the Amazon page.
HTML Response Parser (Code n8n node): Uses custom JavaScript to clean the raw HTML, removing JavaScript, CSS, and excessive whitespace, making the output optimal for large language model ingestion.
Product Analyzer Agent (LangChain Agent n8n node): This n8n node leverages the AI model to intelligently extract structured book data (title, price, rank) from the cleaned text using a pre-defined JSON schema.
Structured Output Parser (LangChain n8n node): Ensures the data extracted by the AI adheres strictly to the required JSON format, guaranteeing reliable downstream processing in this n8n workflow.
Build 📚 Book Purchase Report (Code n8n node): Calculates statistical metrics (e.g., average price, median rating, category counts) and formats the data into a high-quality Markdown report.
Create document file (HTTP Request n8n node): Uses the Google Drive API to upload the generated Markdown as a new Google Document file.
Convert document to PDF (Google Drive n8n node): Exports the newly created Google Document into a portable PDF format, ready for distribution.
Upload report to Slack (Slack n8n node): The final step in the n8n workflow, distributing the generated PDF report to a specified Slack channel.

Related n8n Workflows

Free

Nodes: 10 Nodes
Updated: December 26 2025
View all
Created by

Empowering small and medium businesses with smart automation and practical AI, no big tech team required. Youtube channel: youtube.com/@theStackExplorer

Featured*