Back to Catalog

Generate marketing campaign ROI reports with Google Sheets, GPT-4o and Email

Robert BreenRobert Breen
671 views
2/3/2026
Official Page

This n8n workflow pulls campaign data from Google Sheets, summarizes it using OpenAI, and sends a performance recap via Outlook email.


✅ Step 1: Connect Google Sheets

  1. In n8n, go to Credentials → click New Credential
  2. Select Google Sheets OAuth2 API
  3. Log in with your Google account and authorize
  4. Use a spreadsheet with:
    • Column names in the first row
    • Data in rows 2–100
  5. Example format: 📄 Sample Marketing Sheet

✅ Step 2: Connect OpenAI

  1. Go to OpenAI API Keys
  2. Make sure you have a payment method set under Billing
  3. In n8n, create a new OpenAI API credential
  4. Paste your API key and save

📬 Need Help?

Feel free to contact me if you run into issues:

  • 📧 robert@ynteractive.com
  • 🔗 LinkedIn

Generate Marketing Campaign ROI Reports with Google Sheets, GPT-4o, and Email

This n8n workflow automates the process of generating detailed Return on Investment (ROI) reports for marketing campaigns. It fetches campaign data from Google Sheets, uses an AI agent (powered by OpenAI's GPT-4o) to analyze the data and generate a comprehensive report, and then aggregates the results.

What it does

This workflow performs the following steps:

  1. Manual Trigger: Initiates the workflow when manually executed.
  2. Google Sheets: Reads data from a specified Google Sheet, likely containing marketing campaign performance metrics.
  3. Code: Processes the data retrieved from Google Sheets. This node likely formats or transforms the data before it's sent to the AI agent.
  4. AI Agent (GPT-4o):
    • Utilizes a Structured Output Parser to define the expected structure of the AI's output.
    • Employs an OpenAI Chat Model (specifically GPT-4o, given the directory name context) to analyze the Google Sheets data and generate an ROI report based on predefined instructions and the structured output format.
  5. Merge: Combines the original data from Google Sheets with the AI-generated report.
  6. Aggregate: Collects and groups the processed data and AI reports.
  7. Summarize: Provides a summary of the aggregated data, likely extracting key insights or metrics from the generated reports.
  8. Sticky Note: A note within the workflow, likely for documentation or explanation of a specific part of the flow.

Prerequisites/Requirements

To use this workflow, you will need:

  • n8n Instance: A running n8n instance.
  • Google Sheets Account: Access to a Google Sheet containing your marketing campaign data.
  • OpenAI API Key: An API key for OpenAI, with access to models like GPT-4o.
  • n8n Credentials: Configured credentials for Google Sheets and OpenAI within your n8n instance.

Setup/Usage

  1. Import the Workflow: Download the provided JSON and import it into your n8n instance.
  2. Configure Credentials:
    • Google Sheets Node (ID: 18): Set up your Google Sheets OAuth2 or API Key credentials. Specify the Spreadsheet ID and Sheet Name where your campaign data resides.
    • OpenAI Chat Model Node (ID: 1153): Configure your OpenAI API Key credentials.
  3. Review and Customize Nodes:
    • Code Node (ID: 834): Examine the JavaScript code to understand how it processes your Google Sheets data. Adjust it if your sheet structure or data requires different parsing.
    • AI Agent Node (ID: 1119): Review the prompt and instructions given to the AI agent. Customize them to ensure the AI generates the specific type of ROI analysis and report you need. Pay attention to the Structured Output Parser settings to ensure the AI's output matches your desired format.
    • Merge, Aggregate, and Summarize Nodes (IDs: 24, 1236, 1241): Adjust these nodes as needed to combine, group, and summarize the data and AI-generated reports according to your reporting requirements.
  4. Execute the Workflow: Click the "Execute workflow" button (triggered by the "Manual Trigger" node) to run the automation.

This workflow provides a robust foundation for automating marketing ROI reporting, leveraging the power of AI to generate insightful analyses from your raw campaign data.

Related Templates

Competitor intelligence agent: SERP monitoring + summary with Thordata + OpenAI

Who this is for? This workflow is designed for: Marketing analysts, SEO specialists, and content strategists who want automated intelligence on their online competitors. Growth teams that need quick insights from SERP (Search Engine Results Pages) without manual data scraping. Agencies managing multiple clients’ SEO presence and tracking competitive positioning in real-time. What problem is this workflow solving? Manual competitor research is time-consuming, fragmented, and often lacks actionable insights. This workflow automates the entire process by: Fetching SERP results from multiple search engines (Google, Bing, Yandex, DuckDuckGo) using Thordata’s Scraper API. Using OpenAI GPT-4.1-mini to analyze, summarize, and extract keyword opportunities, topic clusters, and competitor weaknesses. Producing structured, JSON-based insights ready for dashboards or reports. Essentially, it transforms raw SERP data into strategic marketing intelligence — saving hours of research time. What this workflow does Here’s a step-by-step overview of how the workflow operates: Step 1: Manual Trigger Initiates the process on demand when you click “Execute Workflow.” Step 2: Set the Input Query The “Set Input Fields” node defines your search query, such as: > “Top SEO strategies for e-commerce in 2025” Step 3: Multi-Engine SERP Fetching Four HTTP request tools send the query to Thordata Scraper API to retrieve results from: Google Bing Yandex DuckDuckGo Each uses Bearer Authentication configured via “Thordata SERP Bearer Auth Account.” Step 4: AI Agent Processing The LangChain AI Agent orchestrates the data flow, combining inputs and preparing them for structured analysis. Step 5: SEO Analysis The SEO Analyst node (powered by GPT-4.1-mini) parses SERP results into a structured schema, extracting: Competitor domains Page titles & content types Ranking positions Keyword overlaps Traffic share estimations Strengths and weaknesses Step 6: Summarization The Summarize the content node distills complex data into a concise executive summary using GPT-4.1-mini. Step 7: Keyword & Topic Extraction The Keyword and Topic Analysis node extracts: Primary and secondary keywords Topic clusters and content gaps SEO strength scores Competitor insights Step 8: Output Formatting The Structured Output Parser ensures results are clean, validated JSON objects for further integration (e.g., Google Sheets, Notion, or dashboards). Setup Prerequisites n8n Cloud or Self-Hosted instance Thordata Scraper API Key (for SERP data retrieval) OpenAI API Key (for GPT-based reasoning) Setup Steps Add Credentials Go to Credentials → Add New → HTTP Bearer Auth* → Paste your Thordata API token. Add OpenAI API Credentials* for the GPT model. Import the Workflow Copy the provided JSON or upload it into your n8n instance. Set Input In the “Set the Input Fields” node, replace the example query with your desired topic, e.g.: “Google Search for Top SEO strategies for e-commerce in 2025” Execute Click “Execute Workflow” to run the analysis. How to customize this workflow to your needs Modify Search Query Change the search_query variable in the Set Node to any target keyword or topic. Change AI Model In the OpenAI Chat Model nodes, you can switch from gpt-4.1-mini to another model for better quality or lower cost. Extend Analysis Edit the JSON schema in the “Information Extractor” nodes to include: Sentiment analysis of top pages SERP volatility metrics Content freshness indicators Export Results Connect the output to: Google Sheets / Airtable for analytics Notion / Slack for team reporting Webhook / Database for automated storage Summary This workflow creates an AI-powered Competitor Intelligence System inside n8n by blending: Real-time SERP scraping (Thordata) Automated AI reasoning (OpenAI GPT-4.1-mini) Structured data extraction (LangChain Information Extractors)

Ranjan DailataBy Ranjan Dailata
632

Automate Instagram complaint handling with Claude AI, tickets & SLA management

This enterprise-grade n8n workflow automates the Instagram complaint handling process — from detection to resolution — using Claude AI, dynamic ticket assignment, and SLA enforcement. It converts customer complaints in comments into actionable support tickets with auto-assignment, escalation alerts, and full audit trails, ensuring timely responses and improved customer satisfaction with zero manual intervention. Key Features Real-time Instagram polling for new comments AI-powered complaint detection using Claude 3.5 Sonnet for sentiment and issue classification Automatic ticket creation in Google Sheets (or integrable with Zendesk/Jira) Round-robin assignment to team members from a dynamic roster SLA timer and monitoring (e.g., 24-hour response window with escalation at 80% elapsed) Escalation engine notifies managers via Slack if near breach Multi-channel notifications: Slack for assignees and escalations Audit-ready: Logs ticket details, assignments, and actions Scalable triggers: Webhook or scheduled polling Workflow Process | Step | Node | Description | | ---- | ----------------------------------- | -------------------------------------------------------- | | 1 | Schedule Trigger | Runs every 15 minutes or via webhook (/complaint-handler) | | 2 | Get Instagram Posts | Fetches recent posts from Instagram Graph API | | 3 | Get Comments | Retrieves comments for the latest post | | 4 | Loop Over Comments | Processes each comment individually to avoid rate limits | | 5 | Detect Complaint (Claude AI) | Uses AI to classify if complaint, extract issue/severity | | 6 | IF Complaint | Branches: Proceed if yes, end if no | | 7 | Get Team Members | Loads team roster from TeamMembers sheet | | 8 | Assign Ticket | Sets assignee via round-robin logic | | 9 | Create Ticket (Google Sheet) | Appends new ticket with details and SLA due date | | 10 | Notify Assignee (Slack) | Alerts assigned team member | | 11 | Wait for SLA Check | Delays to near-SLA-breach point (e.g., 20 hours) | | 12 | Check Ticket Status | Looks up ticket status in sheet | | 13 | IF SLA Breach Near | Checks if unresolved; escalates if yes | | 14 | Escalate to Manager (Slack) | Notifies manager for urgent action | | 15 | End (Non-Complaint Path) | Terminates non-complaint branches | Setup Instructions Import Workflow Open n8n → Workflows → Import from Clipboard Paste the JSON workflow Configure Credentials | Integration | Details | | ----------------- | -------------------------------------------------- | | Instagram API | Access token from Facebook Developer Portal | | Claude AI | Anthropic API key for claude-3-5-sonnet-20241022 | | Google Sheets | Service account with spreadsheet access | | Slack | Webhook or OAuth app | Update Spreadsheet IDs Ensure your Google Sheets include: SupportTickets TeamMembers Set Triggers Webhook: /webhook/complaint-handler (for real-time Instagram notifications if set up) Schedule: Every 15 minutes Run a Test Use manual execution to confirm: Ticket creation in sheet Slack notifications SLA wait and escalation logic (simulate by shortening wait time) Google Sheets Structure SupportTickets | ticketId | commentText | user | createdAt | assignedTo | status | slaDue | issueType | severity | |--------------|-------------|----------|--------------------|--------------------|--------|--------------------|---------------|----------| | TKT-12345678 | Sample complaint text | user123 | 2023-10-01T12:00:00Z | john@team.com | Open | 2023-10-02T12:00:00Z | Product Issue | Medium | TeamMembers | name | email | |-----------|-------------------| | John Doe | john@team.com | | Jane Smith| jane@team.com | System Requirements | Requirement | Version/Access | | --------------------- | ---------------------------------------------- | | n8n | v1.50+ (AI integrations supported) | | Claude AI API | claude-3-5-sonnet-20241022 | | Instagram Graph API| Business account access token | | Google Sheets API | https://www.googleapis.com/auth/spreadsheets | | Slack Webhook | Required for notifications | Optional Enhancements Integrate Zendesk/Jira for professional ticketing instead of Google Sheets Add email notifications to customers acknowledging complaints Use sentiment thresholds for prioritizing high-severity tickets Connect Twilio for SMS escalations Enable multi-platform support (e.g., Twitter/Facebook comments) Add reporting dashboard via Google Data Studio Implement auto-resolution for simple complaints using AI responses Result: A single automated system that detects, tickets, assigns, and enforces SLAs on Instagram complaints — with full AI intelligence and zero manual work. Explore More AI Workflows: Get in touch with us for custom n8n automation!

Oneclick AI SquadBy Oneclick AI Squad
161

Client review collection & sentiment analysis with HighLevel, GPT-4o, Gmail & Slack

📘 Description: This automation streamlines client review collection and sentiment summarization for Techdome using HighLevel CRM, Azure OpenAI GPT-4o, Gmail, Slack, and Google Sheets. It starts by pulling recently won deals from HighLevel, then generates and sends AI-written HTML review request emails with built-in Google Review and feedback form links. After waiting 24 hours, it fetches the client’s reply thread, summarizes the sentiment using GPT-4o, and posts a clean update to Slack for team visibility. Any failures—API errors, empty responses, or data validation issues—are logged automatically to Google Sheets for full transparency and QA. The result: a fully hands-free Client Appreciation + Feedback Intelligence Loop, improving brand perception and internal responsiveness. ⚙️ What This Workflow Does (Step-by-Step) ▶️ When Clicking ‘Execute Workflow’ (Manual Trigger) Allows on-demand execution or scheduled testing of the workflow. Initiates the fetch for all newly “Won” deals from HighLevel CRM. 🏆 Fetch All Won Deals from HighLevel Retrieves all opportunities labeled “won” in HighLevel, gathering essential client details such as name, email, and deal information to personalize outgoing emails. 🔍 Validate Deal Fetch Success (IF Node) Checks each record for a valid id field. ✅ True Path: Moves ahead to generate AI email content. ❌ False Path: Logs the event to Google Sheets under the error log sheet. 🧠 Configure GPT-4o Model (Azure OpenAI) Initializes the GPT-4o engine that powers all language-generation tasks in this workflow—ensuring precise tone, correct formatting, and safe structured HTML output. 💌 Generate Personalized Review Request Email (AI Agent) Uses GPT-4o to create a tailored, HTML-formatted email thanking the client for their business and requesting feedback. Includes two clickable CTA buttons: ⭐ Google Review Link: 📝 Internal Feedback Form: Google Form link for in-depth feedback Each email maintains Techdome’s friendly, brand-consistent voice with clean inline CSS styling. 📨 Send Review Request Email to Client (Gmail Node) Automatically sends the AI-generated email to the client’s registered address through Gmail. Ensures timely post-service communication without manual follow-ups. ⏳ Wait for 24 Hours Before Next Action Pauses the workflow for 24 hours to give clients time to read and respond to the review request. 📥 Retrieve Email Thread for Response (Gmail Node) After the waiting period, fetches the Gmail thread associated with the initial email to capture client replies or feedback messages. 🧠 Configure GPT-4o Model (Summarization Engine) Prepares another GPT-4o instance specialized for summarizing client replies into concise, sentiment-aware Slack messages. 💬 Summarize Client Feedback (AI Agent) Analyzes the Gmail thread and produces a short Slack-formatted summary using this structure: 🎉 New Client Review Received!Client: <Name> Feedback: <Message snippet> Sentiment: Positive / Neutral / Negative Focuses on tone clarity and quick readability for internal teams. 📢 Announce Review Summary in Slack Posts the AI-generated summary in a designated Slack channel, keeping success and support teams instantly informed of client sentiments and feedback trends. 📊 Log Errors in Google Sheets Appends all failures—including fetch issues, missing fields, or parsing errors—to the Google Sheets “error log sheet,” maintaining workflow reliability and accountability. 🧩 Prerequisites HighLevel CRM OAuth credentials (to fetch deals) Azure OpenAI GPT-4o access (for AI-driven writing and summarization) Gmail API connection (for sending & reading threads) Slack API integration (for posting summaries) Google Sheets access (for error logging) 💡 Key Benefits ✅ Automates personalized review outreach after project completion ✅ Waits intelligently before analyzing responses ✅ Uses GPT-4o to summarize client sentiment in human tone ✅ Sends instant Slack updates for real-time visibility ✅ Keeps audit logs of all errors for debugging 👥 Perfect For Client Success and Account Management Teams Agencies using HighLevel CRM for project delivery Teams aiming to collect consistent client feedback and reviews Businesses wanting AI-assisted sentiment insights in Slack

Rahul JoshiBy Rahul Joshi
159