Create & send GA4 report with insights via email
Who’s it for
Marketing, growth, and analytics teams who want a decision-ready GA4 summary—automatically calculated, clearly color-coded, and emailed as a polished HTML report.
How it works / What it does
- Get Client (Form Trigger) collects GA4 Property ID (“Account ID”), Key Event, date ranges (current & previous), Client Name, and recipient email.
- Overall Metrics This Period / Previous Period (GA4 Data API) pull sessions, users, engagement, bounce rate, and more for each range.
- Form Submits This Period / Previous Period (GA4 Data API) fetch key-event counts for conversion comparisons.
- Code normalizes form dates for API requests.
- AI Agent builds a valid HTML email:
- Calculates % deltas, applies green for positive (
#10B981) and red for negative (#EF4444) changes. - Writes summary and recommendations.
- Produces the final HTML only.
- Calculates % deltas, applies green for positive (
- Send a message (Gmail) sends the formatted HTML report to the specified email address with a contextual subject.
How to set up
- Add credentials: Google Analytics OAuth2, OpenAI (Chat), Gmail OAuth2.
- Ensure the form fields match your GA4 property and event names; “Account ID” = GA4 Property ID. Property ID - https://take.ms/vO2MG Key event - https://take.ms/hxwQi
- Publish the form URL and run a test submission.
Requirements
GA4 property access (Viewer/Analyst) • OpenAI API key • Gmail account with send permission.
Resources
Google OAuth2 (GA4) – https://docs.n8n.io/integrations/builtin/credentials/google/oauth-generic/
OpenAI credentials – https://docs.n8n.io/integrations/builtin/credentials/openai/
Gmail OAuth2 – https://docs.n8n.io/integrations/builtin/credentials/google/
GA4 Data API overview – https://developers.google.com/analytics/devguides/reporting/data/v1
Create and Send GA4 Report with Insights via Email
This n8n workflow automates the process of generating a Google Analytics 4 (GA4) report, extracting insights using an AI agent, and then sending a summary email. It simplifies data analysis and reporting for GA4 users.
What it does
- Triggers on Form Submission: The workflow starts when a form is submitted, likely containing parameters for the GA4 report generation.
- Makes an HTTP Request: It sends an HTTP request, presumably to an API endpoint that generates the GA4 report data.
- Processes Report Data: A Code node then processes the raw report data received from the HTTP request. This step likely formats or extracts key information from the GA4 report.
- Generates AI Insights: An AI Agent, utilizing an OpenAI Chat Model and a Calculator tool, analyzes the processed GA4 report data to extract meaningful insights. It also uses a "Think" tool, suggesting a multi-step reasoning process.
- Sends Email with Insights: Finally, the workflow sends an email via Gmail, containing the generated GA4 report insights.
Prerequisites/Requirements
- n8n Instance: A running n8n instance.
- Google Analytics 4 (GA4) API Access: Access to the GA4 API, configured to generate reports via an HTTP endpoint. (The specific endpoint and authentication details would be configured within the HTTP Request node).
- OpenAI API Key: An API key for OpenAI to power the AI Agent and Chat Model.
- Gmail Account: A configured Gmail credential in n8n to send emails.
Setup/Usage
- Import the workflow: Import the provided JSON into your n8n instance.
- Configure Credentials:
- HTTP Request: Configure the HTTP Request node with the appropriate URL, authentication, and body for your GA4 report generation API.
- OpenAI Chat Model: Set up your OpenAI API key credential for the "OpenAI Chat Model" node.
- Gmail: Configure your Gmail credential for the "Gmail" node.
- Configure Form Trigger: Customize the "On form submission" node to define the input fields required for initiating the report generation (e.g., GA4 property ID, date range, specific metrics/dimensions).
- Customize Code Node: Adjust the "Code" node's JavaScript to parse and prepare the GA4 report data as needed for the AI agent.
- Refine AI Agent Prompt: Modify the prompt within the "AI Agent" node to guide the AI in extracting the desired insights from your GA4 data.
- Customize Gmail Content: Adjust the "Gmail" node to define the recipient, subject, and body of the email, incorporating the insights generated by the AI Agent.
- Activate the workflow: Once configured, activate the workflow. It will now run automatically upon form submissions.
Related Templates
Create a branded AI chatbot for websites with Flowise multi-agent chatflows
This workflow integrates Flowise Multi-Agent Chatflows into a custom-branded n8n chatbot, enabling real-time interaction between users and AI agents powered by large language models (LLMs). --- Key Advantages: ✅ Easy Integration with Flowise: Uses a low-code HTTP node to send user questions to Flowise's API (/api/v1/prediction/FLOWISE_ID) and receive intelligent responses. Supports multi-agent chatflows, allowing for complex, dynamic interactions. 🎨 Customizable Chatbot UI: Includes pre-built JavaScript for embedding the n8n chatbot into any website. Provides customization options such as welcome messages, branding, placeholder text, chat modes (e.g., popup or embedded), and language support. 🔐 Secure & Configurable: Authorization via Bearer token headers for Flowise API access. Clearly marked notes in the workflow for setting environment variables like FLOWISEURL and FLOWID. --- How It Works Chat Trigger: The workflow starts with the When chat message received node, which acts as a webhook to receive incoming chat messages from users. HTTP Request to Flowise: The received message is forwarded to the Flowise node, which sends a POST request to a Flowise API endpoint (https://FLOWISEURL/api/v1/prediction/FLOWISEID). The request includes the user's input as a JSON payload ({"question": "{{ $json.chatInput }}"}) and uses HTTP header authentication (e.g., Authorization: Bearer FLOWSIEAPI). Response Handling: The response from Flowise is passed to the Edit Fields node, which maps the output ($json.text) for further processing or display. Set Up Steps Configure Flowise Integration: Replace FLOWISEURL and FLOWISE_ID in the HTTP Request node with your Flowise instance URL and flow ID. Ensure the Authorization header is set correctly in the credentials (e.g., Bearer FLOWSIE_API). Embed n8n Chatbot: Use the provided JavaScript snippet in the sticky notes to embed the n8n chatbot on your website. Replace YOURPRODUCTIONWEBHOOK_URL with the webhook URL generated by the When chat message received node. Customize the chatbot's appearance and behavior (e.g., welcome messages, language, UI elements) using the createChat configuration options. Optional Branding: Adjust the sticky note examples to include branding details, such as custom messages, colors, or metadata for the chatbot. Activate Workflow: Toggle the workflow to "Active" in n8n and test the chat functionality end-to-end. --- Ideal Use Cases: Embedding branded AI assistants into websites. Connecting Flowise-powered agents with customer support chatbots. Creating dynamic, smart conversational flows with LLMs via n8n automation. ---- Need help customizing? Contact me for consulting and support or add me on Linkedin.
Send personalized healthcare joke emails with OpenAI, Gmail, and Google Sheets
Healthcare Email Autoresponder - Daily Outreach 📧 A production-ready n8n workflow for automated healthcare email marketing with AI-powered personalization. 🎯 What This Workflow Does This automated email system sends daily personalized healthcare-themed emails to your contact list. Perfect for: Healthcare professionals building patient relationships Medical practices maintaining client engagement Wellness coaches staying connected with clients Health educators sharing daily motivation ✨ Key Features AI-Powered Personalization: Uses OpenAI to customize each email with recipient's name Smart Rate Limiting: Random 2-5 minute delays between emails to avoid spam filters Batch Processing: Limits to 10 emails per run for better deliverability Email Tracking: Updates Google Sheets to prevent duplicates and track progress Professional Templates: Healthcare-themed content with customizable signatures Automated Scheduling: Runs daily at 1 PM (customizable) 🛠️ Setup Instructions Prerequisites n8n instance (cloud or self-hosted) Gmail account for sending emails Google Sheets for contact management OpenAI API key Step 1: Import the Workflow Download the HealthcareEmailAutoresponderCommunityTemplate.json file In n8n, go to Templates and click "Import from File" Select the downloaded JSON file The workflow will be imported as inactive Step 2: Configure Credentials Gmail OAuth2 Setup: Click on the "Send Email" node Create new Gmail OAuth2 credential Follow n8n's Gmail setup guide Test the connection Google Sheets Setup: Click on the "HealthcareContactList" node Create new Google Sheets OAuth2 credential Replace YOURGOOGLESHEETIDHERE with your actual sheet ID Ensure your sheet has these columns: First Name Email Emailed (for tracking timestamps) OpenAI API Setup: Click on the "OpenAI Chat Model" node Create new OpenAI credential Add your OpenAI API key Select your preferred model (gpt-4o-mini recommended for cost efficiency) Step 3: Customize Your Email Template Click on the "AI Email Generator" node Edit the system message to include your details: Replace [YOUR NAME HERE] with your actual name Replace [YOUR TITLE HERE] with your professional title Replace [YOUR COMPANY HERE] with your company name Replace [YOUR PHONE NUMBER] with your phone number Replace [YOUR EMAIL] with your email address Replace [YOUR WEBSITE] with your website URL Step 4: Prepare Your Contact List Create a Google Sheet with the following structure: | First Name | Email | Emailed | |------------|-------------------|------------| | John | john@example.com | | | Jane | jane@example.com | | Important Notes: Leave the "Emailed" column empty initially The workflow will populate timestamps as emails are sent Only contacts with empty "Emailed" cells will receive emails Step 5: Test and Activate Test the workflow with a few sample contacts Check that emails are being generated and sent correctly Verify that Google Sheets is being updated with timestamps Once satisfied, activate the workflow 📊 Google Sheets Structure Your contact sheet should include these columns: First Name (required): Used for personalization Email (required): Recipient email address Emailed (required): Timestamp tracking (leave empty initially) Optional columns you can add: Last Name Company Phone Notes ⚙️ Customization Options Change Email Frequency Edit the "Daily Trigger (1 PM)" node Modify the schedule (hourly, daily, weekly) Set preferred time zones Adjust Batch Size Edit the "Limit to 10 Contacts" node Change maxItems value (recommend staying under 50) Modify Wait Times Edit the "Random Wait (2-5min)" node Adjust the random delay formula Current: {{ Math.floor(Math.random() * 4) + 2 }} (2-5 minutes) Update Email Content Edit the system message in "AI Email Generator" node Change the joke, signature, or entire email structure Add seasonal content or special promotions 🔧 Troubleshooting Common Issues: Emails not sending Verify Gmail credentials are active Check email quota limits Ensure recipient emails are valid Google Sheets not updating Confirm sheet ID is correct Check column names match exactly Verify Google Sheets credentials AI not generating content Validate OpenAI API key Check API quota and billing Test with different model if needed Rate limiting issues Increase wait times between emails Reduce batch size Check Gmail sending limits 📈 Best Practices Start Small: Begin with 5-10 contacts to test deliverability Monitor Metrics: Track open rates and responses Respect Privacy: Include unsubscribe options Stay Relevant: Update content regularly Follow Regulations: Comply with CAN-SPAM and GDPR 🤝 Contributing to the Community This template is designed to be: Easy to understand: Clear node names and documentation Production ready: Includes error handling and rate limiting Customizable: Template placeholders for personalization Well documented: Comprehensive setup instructions Feel free to adapt this workflow for your specific healthcare niche! 📄 License This workflow template is provided free to the n8n community under MIT License. 🆘 Support For questions or issues: Check the n8n community forum Review n8n's official documentation Test each node individually to isolate problems --- Made with ❤️ for the n8n community
Automatic Notion database backup to Google Drive with Telegram notifications
🔍 Workflow Overview What This Workflow Does This workflow automatically saves copies of all your Notion databases to Google Drive. It's like creating a safety backup of your important Notion information, similar to saving important documents in a filing cabinet. Target Audience: Anyone who uses Notion and wants to protect their data by creating automatic backups to Google Drive. --- Prerequisites (What You Need Before Starting) Required Accounts Notion Account - Where your databases are stored Google Account - For Google Drive storage Telegram Account - To receive backup notifications (free messaging app) Required Software n8n Community Edition v2.0.0 installed on your computer or server Web browser (Chrome, Firefox, Safari, or Edge) --- Step-by-Step Configuration Guide PART 1: Setting Up Notion Access Step 1: Create a Notion Integration Step 2: Share Your Databases with the integration --- PART 2: Setting Up Google Drive Access Step 1: Create a Google Drive Folder Step 2: Connect Google Drive to n8n --- PART 3: Setting Up Telegram Notifications Step 1: Create a Telegram Bot Step 2: Get Your Chat ID Step 3: Connect Telegram to n8n --- PART 4: Installing the Workflow in n8n Step 1: Import the Workflow Step 2: Configure Credentials For Notion nodes (Get All Databases, Get Database Pages) For Google Drive nodes (Create Backup Folder, Upload Backup File, etc.) For Telegram node (Send Telegram Notification) Step 3: Configure the Workflow Settings --- PART 5: Testing Your Workflow Step 1: Run a Test Step 2: Verify the Backup If Something Goes Wrong Red X marks on nodes: Check that all credentials are properly connected "Not found" errors: Make sure you shared your Notion databases with the integration No Telegram message: Verify your Chat ID is correct No files in Google Drive: Check your Folder ID is correct