Amazon Ads Performance Optimization with GPT-4o - n8n Workflow

Automate Amazon Ads optimization using this n8n workflow. Analyze daily reports (search terms, budgets, and bids) with GPT-4o and receive actionable email recommendations instantly. This n8n template simplifies PPC management.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • PPC Managers and Agencies: Seeking to automate the data aggregation and analysis phase of Amazon Sponsored Products campaigns.

  • E-commerce Sellers: Running Amazon FBA or Vendor accounts who need daily, proactive optimization suggestions.

  • Automation Enthusiasts: Looking for advanced n8n templates that combine cloud storage operations, complex data transformation, and large language models.

  • Users of n8n: Who want to implement an advanced, AI-powered n8n workflow for continuous marketing optimization.

Overview

Manually aggregating and analyzing multiple daily Amazon Ads reports (Search Terms, Campaigns, Targeting, Budgets) is time-consuming. This specialized n8n workflow transforms that manual effort into a seamless, intelligent process. By using a powerful n8n node for data retrieval (Google Drive) and a sophisticated AI n8n node (GPT-4o), this solution quickly processes large datasets and outputs precise, actionable recommendations for bid changes, budget scaling, and keyword optimization. This fully automated analysis ensures your campaigns remain optimized without daily human intervention, making this a highly valuable n8n template for performance marketing.

How it Works

The logical flow of this n8n workflow is structured to handle multiple data files and produce a single, insightful output:


  1. Start: The process begins with the When clicking ‘Test workflow’ n8n trigger (which can be replaced by a scheduled n8n trigger node). Initial email settings are defined.

  2. Data Collection: The List Files n8n node polls a specific Google Drive folder where scheduled Amazon Ads reports are delivered (as noted in the sticky note instructions, reports must be generated in the Amazon Ads Console and deposited here).

  3. File Download and Routing: The Get File n8n node downloads the binary data for each report. An is XLSX If n8n node determines the file type (XLSX or CSV).

  4. Data Extraction: The appropriate Extract XLSX Data or Extract CSV Data n8n node handles the binary file, turning the report content into usable JSON data.

  5. Merging and Formatting: All individual reports are combined using the Merge XLSX and CSV n8n node. Crucially, the Format Data Code n8n node then analyzes the filenames to categorize the data (e.g., search_terms, campaigns) and compiles all reports into a single, structured JSON object, which is the perfect input for the AI.

  6. AI Analysis: The AI Analyze n8n node, powered by the OpenAI Chat Model (GPT-4o), receives the compiled data. The node is configured with a detailed system prompt forcing the AI to analyze performance (ACoS, ROAS), generate specific bid, budget, and keyword recommendations, and output the result in a guaranteed JSON structure.

  7. Email Delivery: The Email Optimizations Gmail n8n node executes complex JavaScript to parse the AI's resulting JSON. It calculates projected totals, formats all campaign, keyword, and targeting recommendations into a clean HTML email, and sends the actionable report to the predefined recipient, concluding this powerful n8n workflow.

Installation Guide

To deploy this specialized n8n workflow, follow these steps:


  1. Import: Copy the provided JSON code and paste it into your n8n instance to import the full n8n template.

  2. Credentials Setup:

- Google Drive: Configure or select your Google Drive credential in the List Files and Get File n8n nodes. Ensure this account has access to the folder containing your Amazon reports.
- OpenAI: Configure your OpenAI API Key credential in the OpenAI Chat Model n8n node.
- Gmail: Configure or select your Gmail credential in the Email Optimizations n8n node.

  1. Configuration:

- Email Options: Edit the Email Options Set n8n node to define the send_to address and the subject line.
- Google Drive Folder: In the List Files n8n node parameters, select the specific Google Drive folder where your Amazon Ads reports (Search Terms, Campaign, Budget, etc.) are scheduled to be delivered.
- Reports Scheduling: Schedule the required detailed reports within the Amazon Ads Console as described in the accompanying sticky note.

  1. Activation: Once credentials are set and configurations are validated, activate the n8n workflow. For production use, replace the manual n8n trigger with a time-based schedule or a Google Drive Watch n8n trigger.

Node Details

When clicking ‘Test workflow’ (Manual Trigger): This n8n trigger starts the workflow for testing purposes. It should be replaced by a scheduled n8n trigger for production.
List Files (Google Drive n8n node): Scans the designated Google Drive folder for the latest Amazon Ads report files.
Get File (Google Drive n8n node): Downloads the binary data of each report file found by the previous n8n node.
Set fileName (Set n8n node): Captures and preserves the original file name, which is critical for the later Format Data n8n node to correctly classify the report type (e.g., search term vs. campaign).
is XLSX (If n8n node): A flow control n8n node that checks if the file is an XLSX file based on the file extension.
Extract XLSX Data / Extract CSV Data (Extract From File n8n nodes): These nodes handle the binary input and extract the tabular data into n8n's standard JSON structure.
Format Data (Code n8n node): This crucial custom code n8n node uses regex matching on the filename to categorize and map the different reports (budgets, targeting, search_terms) into a unified JSON structure, preparing the data for the AI analysis.
AI Analyze (Langchain ChainLlm n8n node): The core intelligence n8n node. It passes the structured report data to the GPT-4o model, along with a complex system prompt that dictates the exact analysis and required JSON output format for bid, budget, and keyword recommendations.


  • Email Optimizations (Gmail n8n node): The final action n8n node. It dynamically parses the structured AI output (handling projected spend, ROAS, ACoS), renders it into a highly formatted, actionable HTML email summary, and sends the optimization plan.

Related n8n Workflows

Free

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

Experienced Linux administrator, entrepreneur, and automation enthusiast, I specialize in crafting robust, scalable workflows with n8n. I have a passion for business automation, integrating complex systems seamlessly, and sharing practical templates that empower others to automate effectively.

Featured*