Back to Catalog

Templates by Jameson Kanakulya

Generate multi-platform content with OpenAI, Tavily Research & Supabase Storage

Automated Content Page Generator with AI, Tavily Research, and Supabase Storage > ⚠️ Self-Hosted Disclaimer: This template requires self-hosted n8n installation and external service credentials (OpenAI, Tavily, Google Drive, NextCloud, Supabase). It cannot run on n8n Cloud due to dependency requirements. Overview Transform simple topic inputs into professional, multi-platform content automatically. This workflow combines AI-powered content generation with intelligent research and seamless storage integration to create website content, blog articles, and landing pages optimized for different audiences. Key Features Automated Research: Uses Tavily's advanced search to gather relevant, up-to-date information Multi-Platform Content: Generates optimized content for websites, blogs, and landing pages Image Management: Downloads from Google Drive and uploads to NextCloud with public URL generation Database Integration: Stores all content in Supabase for easy retrieval Error Handling: Built-in error management workflow for reliability Content Optimization: AI-driven content strategy with trend analysis and SEO optimization Required Services & APIs Core Services n8n: Self-hosted instance (required) OpenAI: GPT-4 API access for content generation Tavily: Research API for content discovery Google Drive: Image storage and retrieval Google Sheets: Content input and workflow triggering NextCloud: Image hosting and public URL generation Supabase: Database storage for generated content Setup Instructions Prerequisites Before setting up this workflow, ensure you have: Self-hosted n8n installation API credentials for all required services Database table created in Supabase Step 1: Service Account Configuration OpenAI Setup Create an OpenAI account at platform.openai.com Generate API key from the API Keys section In n8n, create new OpenAI credentials using your API key Test connection to ensure GPT-4 access Tavily Research Setup Sign up at tavily.com Get your API key from the dashboard Add Tavily credentials in n8n Configure search depth to "advanced" for best results Google Services Setup Create Google Cloud Project Enable Google Drive API and Google Sheets API Create OAuth2 credentials Configure Google Drive and Google Sheets credentials in n8n Share your input spreadsheet with the service account NextCloud Setup Install NextCloud or use hosted solution Create application password for API access Configure NextCloud credentials in n8n Create /images/ folder for content storage Supabase Setup Create Supabase project at supabase.com Create table with the following structure: sql CREATE TABLE works ( id SERIAL PRIMARY KEY, title TEXT NOT NULL, content TEXT NOT NULL, image_url TEXT, category TEXT, created_at TIMESTAMP DEFAULT NOW() ); Get project URL and service key from settings Configure Supabase credentials in n8n Step 2: Google Sheets Input Setup Create a Google Sheets document with the following columns: TITLE: Topic or title for content generation IMAGE_URL: Google Drive sharing URL for associated image Example format: TITLE | IMAGE_URL AI Chatbot Implementation | https://drive.google.com/file/d/your-file-id/view Digital Marketing Trends 2024 | https://drive.google.com/file/d/another-file-id/view Step 3: Workflow Import and Configuration Import the workflow JSON into your n8n instance Configure all credential connections: Link OpenAI credentials to "OpenAIGPT4Model" node Link Tavily credentials to "TavilyResearchAgent" node Link Google credentials to "GoogleSheetsTrigger" and "GoogleDriveImage_Downloader" nodes Link NextCloud credentials to "NextCloudImageUploader" and "NextCloudPublicURL_Generator" nodes Link Supabase credentials to "SupabaseContentStorage" node Update the Google Sheets Trigger node: Set your spreadsheet ID in the documentId field Configure polling frequency (default: every minute) Test each node connection individually before activating Step 4: Error Handler Setup (Optional) The workflow references an error handler workflow (GWQ4UI1i3Z0jp3GF). Either: Create a simple error notification workflow with this ID Remove the error handling references if not needed Update the workflow ID to match your error handler Step 5: Workflow Activation Save all node configurations Test the workflow with a sample row in your Google Sheet Verify content generation and storage in Supabase Activate the workflow for continuous monitoring How It Works Workflow Process Trigger: Google Sheets monitors for new rows with content topics Research: Tavily searches for 3 relevant articles about the topic Content Generation: AI agent creates multi-platform content (website, blog, landing page) Content Cleaning: Text processing removes formatting artifacts Image Processing: Downloads image from Google Drive, uploads to NextCloud URL Generation: Creates public sharing links for images Storage: Saves final content package to Supabase database Content Output Structure Each execution generates: Optimized Title: SEO-friendly, platform-appropriate headline Multi-Platform Content: Website content (professional, authority-building) Blog content (educational, SEO-optimized) Landing page content (conversion-focused) Category Classification: Automated content categorization Image Assets: Processed and publicly accessible images Customization Options Content Strategy Modification Edit the AI agent's system message to change content style Adjust character limits for different platform requirements Modify category classifications for your industry Research Parameters Change Tavily search depth (basic, advanced) Adjust number of research sources (1-10) Modify search topic focus Storage Configuration Update Supabase table structure for additional fields Change NextCloud folder organization Modify image naming conventions Troubleshooting Common Issues Workflow not triggering: Check Google Sheets permissions Verify polling frequency settings Ensure spreadsheet format matches requirements Content generation errors: Verify OpenAI API key and credits Check GPT-4 model access Review system message formatting Image processing failures: Confirm Google Drive sharing permissions Check NextCloud storage space and permissions Verify file formats are supported Database storage issues: Validate Supabase table structure Check API key permissions Review field mapping in storage node Performance Optimization Adjust polling frequency based on your content volume Monitor API usage to stay within limits Consider batch processing for high-volume scenarios Support and Updates This template is designed for self-hosted n8n environments and requires technical setup. For issues: Check n8n community forums Review service-specific documentation Test individual nodes in isolation Monitor execution logs for detailed error information

Jameson KanakulyaBy Jameson Kanakulya
328

Automate interior design lead qualification with AI & human approval to Notion

Overview This automated workflow intelligently qualifies interior design leads, generates personalized client emails, and manages follow-up through a human-approval process. Built with n8n, Claude AI, Telegram approval, and Notion database integration. ⚠️ Hosting Options This template works with both n8n Cloud and self-hosted instances. Most nodes are native to n8n, making it cloud-compatible out of the box. What This Template Does Automated Lead Management Pipeline: Captures client intake form submissions from website or n8n forms AI-powered classification into HOT/WARM/COLD categories based on budget, project scope, and commitment indicators Generates personalized outreach emails tailored to each lead type Human approval workflow via Telegram for quality control Email revision capability for rejected drafts Automated client email delivery via Gmail Centralized lead tracking in Notion database Key Features ✅ Intelligent Lead Scoring: Analyzes 12+ data points including budget (AED), space count, project type, timeline, and style preferences ✅ Personalized Communication: AI-generated emails reference specific client details, demonstrating genuine understanding ✅ Quality Control: Human-in-the-loop approval via Telegram prevents errors before client contact ✅ Smart Routing: Different workflows for qualified leads (meeting invitations) vs. unqualified leads (respectful alternatives) ✅ Revision Loop: Rejected emails automatically route to revision agent for improvements ✅ Database Integration: All leads stored in Notion for pipeline tracking and analytics Use Cases Interior design firms managing high-volume lead intake Architecture practices with complex qualification criteria Home renovation companies prioritizing project value Any service business requiring budget-based lead scoring Sales teams needing approval workflows before client contact Prerequisites Required Accounts & API Keys: Anthropic Claude API - For AI classification and email generation Telegram Bot Token - For approval notifications Gmail Account - For sending client emails (or any SMTP provider) Notion Account - For lead database storage n8n Account - Cloud or self-hosted instance Technical Requirements: Basic understanding of n8n workflows Ability to create Telegram bots via BotFather Gmail app password or OAuth setup Notion database with appropriate properties Setup Instructions Step 1: Clone and Import Template Copy this template to your n8n instance (cloud or self-hosted) All nodes will appear as inactive - this is normal Step 2: Configure Form Trigger Open the Client Intake Form Trigger node Choose your trigger type: For n8n forms: Configure form fields matching the template structure For webhook: Copy webhook URL and integrate with your website form Required form fields: First Name, Second Name, Email, Contact Number Project Address, Project Type, Spaces Included Budget Range, Completion Date, Style Preferences Involvement Level, Previous Experience, Inspiration Links Step 3: Set Up Claude AI Credentials Obtain API key from https://console.anthropic.com In n8n: Create new credential → Anthropic → Paste API key Apply credential to these nodes: AI Lead Scoring Engine Personalized Client Outreach Email Generator Email Revision Agent Step 4: Configure Telegram Approval Bot Create bot via Telegram's @BotFather Copy bot token Get your Telegram Chat ID (use @userinfobot) In n8n: Create Telegram credential with bot token Configure Human-in-the-Loop Email Approval node: Add your Chat ID Customize approval message format if desired Step 5: Set Up Gmail Sending Enable 2-factor authentication on Gmail account Generate app password: Google Account → Security → App Passwords In n8n: Create Gmail credential using app password Configure Client Email Delivery node with sender details Step 6: Connect Notion Database Create Notion integration at https://www.notion.so/my-integrations Copy integration token Create database with these properties: Client Name (Title), Email (Email), Contact Number (Phone) Project Address (Text), Project Type (Multi-select) Spaces Included (Text), Budget (Select), Timeline (Date) Classification (Select: HOT/WARM/COLD), Confidence (Select) Estimated Value (Number), Status (Select) Share database with your integration In n8n: Add Notion credential → Paste token Configure Notion Lead Database Manager with database ID Step 7: Customize Classification Rules (Optional) Open AI Lead Scoring Engine node Review classification criteria in the prompt: HOT: 500k+ AED, full renovations, 2+ spaces WARM: 100k+ AED, 2+ spaces COLD: <100k AED OR single space Adjust thresholds to match your business requirements Modify currency if not using AED Step 8: Personalize Email Templates Open Personalized Client Outreach Email Generator node Customize: Company name and branding Signature placeholders ([Your Name], [Title], etc.) Tone and style preferences Alternative designer recommendations for COLD leads Step 9: Test the Workflow Activate the workflow Submit a test form with sample data Monitor each node execution in n8n Check Telegram for approval message Verify email delivery and Notion database entry Step 10: Set Up Error Handling (Recommended) Add error workflow trigger Configure notifications for failed executions Set up retry logic for API failures Workflow Node Breakdown Client Intake Form Trigger Captures lead data from website forms or n8n native forms with all project details. AI Lead Scoring Engine Analyzes intake data using structured logic: budget validation, space counting, and multi-factor evaluation. Returns HOT/WARM/COLD classification with confidence scores. Lead Classification Router Routes leads into three priority workflows based on AI classification, optimizing resource allocation. Sales Team Email Notifier Sends instant alerts to sales representatives with complete lead details and AI reasoning for internal tracking. Personalized Client Outreach Email Generator AI-powered composer creating tailored responses demonstrating genuine understanding of client vision, adapted by lead type. Latest Email Version Controller Captures most recent email output ensuring only final approved version proceeds to delivery. Human-in-the-Loop Email Approval Telegram-based review checkpoint sending generated emails to team member for quality control before client delivery. Approval Decision Router Evaluates reviewer's response, routing approved emails to client delivery or rejected emails to revision agent. Email Revision Agent AI-powered editor refining rejected emails based on feedback while maintaining personalization and brand voice. Client Email Delivery Sends final approved personalized emails demonstrating understanding of project vision with clear next steps. Notion Lead Database Manager Records all potential clients with complete intake data, classification results, and tracking information for pipeline management. Customization Tips Adjust Classification Thresholds: Modify budget ranges and space requirements in the AI Lead Scoring Engine prompt to match your market and service level. Multi-Language Support: Update all AI agent prompts with instructions for your target language. Claude supports 100+ languages. Additional Routing: Add branches for special cases like urgent projects, VIP clients, or specific geographic regions. CRM Integration: Replace Notion with HubSpot, Salesforce, or Airtable using respective n8n nodes. SMS Notifications: Add Twilio node for immediate HOT lead alerts to mobile devices. Troubleshooting Issue: Telegram approval not received Verify bot token is correct Confirm chat ID matches your Telegram account Check bot is not blocked Issue: Claude API errors Verify API key validity and credits Check prompt length isn't exceeding token limits Review rate limits on your Anthropic plan Issue: Gmail not sending Confirm app password (not regular password) is used Check "Less secure app access" if using older method Verify daily sending limits not exceeded Issue: Notion database not updating Confirm integration has access to database Verify property names match exactly (case-sensitive) Check property types align with data being sent Template Metrics Execution Time: ~30-45 seconds per lead (including AI processing) API Calls: 2-3 Claude requests per lead (classification + email generation, +1 if revision) Cost Estimate: ~$0.05-0.15 per lead processed (based on Claude API pricing) Support & Community n8n Community Forum: https://community.n8n.io Template Issues: Report bugs or suggest improvements via n8n template feedback Claude Documentation: https://docs.anthropic.com Notion API Docs: https://developers.notion.com License This template is provided as-is under MIT license. Modify and adapt freely for your business needs. --- Version: 1.0 Last Updated: October 2025 Compatibility: n8n v1.0+ (Cloud & Self-Hosted), Claude API v2024-10+

Jameson KanakulyaBy Jameson Kanakulya
201

Generate Interior Moodboards with Claude/Gemini Agents, Hugging Face Image Generation, and PDF Export

🎨 Template Overview This comprehensive n8n workflow automates the complete process of generating professional interior design moodboards from concept to client delivery. Users submit a design brief through a form, and the system automatically generates 12 AI-powered images, compiles them into a beautifully formatted two-page PDF moodboard, and emails the final deliverable. Key Features: Form-based design brief submission AI-powered image prompt generation (12 detailed prompts per project) Automated image generation via Hugging Face API Nextcloud cloud storage with public URL sharing Professional two-page HTML/PDF moodboard creation Automated email delivery with PDF attachment Technologies Used: Claude Sonnet 4 (OpenRouter), Google Gemini 2.5 Pro, Hugging Face FLUX.1-schnell, Nextcloud, Gotenberg PDF Service, Gmail --- ⚙️ Self-Hosted Requirements This template requires the following self-hosted or third-party services: Nextcloud Instance - For cloud file storage and public URL generation Gotenberg PDF Service - For HTML to PDF conversion (can be self-hosted via Docker) OpenRouter API Access - For Claude Sonnet 4 AI agent Google Gemini API Access - For secondary AI processing Hugging Face API Access - For FLUX.1-schnell image generation Gmail Account - For email delivery (or any SMTP service) --- 📋 Setup Instructions Step 1: Configure API Credentials OpenRouter (Claude Sonnet 4) Sign up at openrouter.ai Generate an API key Add credentials to the "OpenRouter Chat Model" node Google Gemini API Visit Google AI Studio Create an API key Add credentials to the "Google Gemini Chat Model1" node Hugging Face API Register at huggingface.co Generate an access token from Settings → Access Tokens Add credentials to the "Image Generator" node using HTTP Header Auth Header name: Authorization, Value: Bearer YOUR_TOKEN Nextcloud Set up a Nextcloud instance or use a hosted provider Generate an app password from Settings → Security Configure credentials in all Nextcloud nodes: "Create a folder" "Upload Image" "Share a file" Gotenberg PDF Service Self-host using Docker: docker run --rm -p 3000:3000 gotenberg/gotenberg:8 Or use a hosted instance Update the URL in the "PDF creator" node Configure HTTP Basic Auth credentials if required Gmail Enable 2-Factor Authentication on your Google account Generate an App Password from Google Account settings Add OAuth2 credentials to the "Send PDF" node Step 2: Customize Workflow Settings Email Extractor Node Review the stripPlus variable (default: true) This removes "+tag" portions from email addresses for folder naming Nextcloud Folder Structure Default path: /moodboard/{username}/ Modify in "Create a folder" node if needed Image Generator Settings Model: FLUX.1-schnell (fast generation, good quality) Adjust model in "Image Generator" node if needed Alternative models: FLUX.1-dev, Stable Diffusion XL PDF Generation Settings Default timeout: 360 seconds Page size: A4 (210mm × 297mm) Adjust in "PDF creator" node headers if needed Step 3: Test the Workflow Activate the Form Open the "Moodboard Form" node Copy the webhook URL Access the form in your browser Submit a Test Request Fill in the form fields: Title: Short, descriptive name (e.g., "Modern Minimalist Bedroom") Description: Detailed design brief with colors, materials, mood, lighting Email: Your test email address Submit and monitor workflow execution Verify Each Stage Check Nextcloud folder creation Monitor image generation progress (12 images) Review HTML moodboard generation Confirm PDF creation Check email delivery Step 4: Configure Form Embedding (Optional) Embed the form on your website: html <iframe src="YOURN8NFORMWEBHOOKURL" width="100%" height="800" frameborder="0"> </iframe> --- 🔄 Workflow Structure Form Input & Data Extraction Moodboard Form - Collects project title, description, and user email Email Extractor - Extracts username from email for folder organization Storage Setup Create a Folder - Creates personalized Nextcloud directory using email username AI Concept Generation Conceptualization Agent (Claude Sonnet 4) - Analyzes design brief and generates 12 detailed image prompts (300-500 words each) Images 1-11: Individual design elements (furniture, materials, details, styling) Image 12: Comprehensive 3D rendered view integrating all elements Image Processing Loop Concept Splitter - Separates 12 prompts into individual items Loop Over Items - Processes each prompt sequentially: Image Generator - Sends prompt to Hugging Face FLUX.1-schnell API Upload Image - Stores generated image in Nextcloud folder Share a File - Creates public shareable URL Set Image Title and URL - Formats data for aggregation URL Collection URL Aggregate - Combines all 12 public image URLs Clean URLs - Extracts and formats URLs into a structured list Moodboard Compilation Moodboard Generator Agent (Google Gemini 2.5 Pro) - Creates professional two-page HTML document: Page 1: Visual moodboard with all 12 images (Image 12 prominently featured 2-3x larger) Page 2: Administrative summary with design overview, color palette, materials, and project details PDF Generation & Delivery Binary Converter - Transforms HTML to base64-encoded binary format PDF Creator - Converts HTML to print-ready PDF via Gotenberg service Send PDF - Emails final moodboard PDF to user --- 🎯 Node Descriptions Moodboard Form Collects moodboard generation requests for any design topic. Users input a title, detailed description (colors, materials, patterns, textures, lighting), and email address for delivery. Email Extractor Extracts the username portion from email addresses, optionally stripping "+tags" for clean folder naming and user identification. Create a Folder Creates a dedicated Nextcloud folder using the extracted email username, organizing moodboard outputs by user. Conceptualization Agent AI agent that analyzes design briefs to generate 12 detailed image prompts (300-500 words each). Performs conceptual analysis of styles, colors, materials, and spatial requirements, outputting structured JSON. Concept Splitter Splits the 12 generated image prompts into individual items for parallel processing through the image generation pipeline. Loop Over Items Processes each prompt sequentially, generating images, uploading to Nextcloud, and creating public URLs. Image Generator Sends detailed prompts to Hugging Face FLUX.1-schnell API for AI-powered image generation, transforming written design concepts into high-quality visuals. Upload Image Uploads each generated moodboard image to the user's Nextcloud folder with appropriate naming conventions. Share a File Creates publicly shareable Nextcloud links for each uploaded image, enabling external viewing without authentication. Set Image Title and URL Formats image metadata (title and URL) for downstream aggregation. URL Aggregate Combines all 12 image URLs into a single consolidated output for moodboard compilation. Clean URLs Extracts and formats URLs from the aggregated data into a clean, structured list with count. Moodboard Generator Agent Transforms design concepts into professional two-page HTML moodboards. Analyzes project details and 12 image URLs, selecting appropriate visual styles. Creates artistic Page 1 with Image 12 as hero element, and comprehensive Page 2 with design documentation. Binary Converter Prepares HTML for PDF conversion by transforming it into binary format with proper encoding and filename ("index.html") for Gotenberg compatibility. PDF Creator Converts HTML moodboard into print-ready PDF with proper A4 dimensions, page breaks, and high-quality image resolution. Send PDF Emails the finalized PDF moodboard to the user's submitted email address with project details and PDF attachment. --- 🎨 Customization Options Design Styles The Moodboard Generator Agent automatically selects from 10 layout styles: Modern Sectional Grid Material Board Collage Editorial Magazine Clean Minimalist Split-Screen Dramatic Asymmetric Feature Centered Showcase Modular Block System Organic Flow Layered Depth Image Generation Models Replace FLUX.1-schnell with alternatives in the "Image Generator" node: black-forest-labs/FLUX.1-dev - Higher quality, slower stabilityai/stable-diffusion-xl-base-1.0 - Classic SD XL Email Templates Customize the email message in the "Send PDF" node to include: Brand messaging Next steps Support contact information Pricing information --- 🐛 Troubleshooting Images Not Generating Verify Hugging Face API token is valid Check API rate limits and quotas Increase timeout in "Image Generator" node (default: unlimited) PDF Generation Fails Ensure Gotenberg service is accessible Verify HTML output contains all 12 image URLs Check timeout settings (default: 360s) Review Gotenberg logs for specific errors Nextcloud Upload Errors Confirm folder creation succeeded Verify Nextcloud credentials and permissions Check available storage space Ensure WebDAV is enabled Email Not Received Verify Gmail OAuth2 credentials Check spam/junk folders Confirm email address is valid Review Gmail API quotas --- 📊 Performance Notes Average execution time: 5-8 minutes (depends on image generation) Image generation: ~20-30 seconds per image (12 images = 4-6 minutes) PDF generation: ~30-60 seconds Total data processed: ~15-25 MB per workflow execution --- 🔐 Security Considerations Store all API keys in n8n credentials (never hardcode) Use environment variables for sensitive configuration Implement rate limiting on the form webhook Consider adding CAPTCHA to prevent abuse Regularly rotate API keys and passwords Use HTTPS for all external communications --- 📝 License & Attribution This template is provided as-is for the n8n community. Feel free to modify and adapt to your needs. AI Models Used: Claude Sonnet 4 (Anthropic via OpenRouter) Google Gemini 2.5 Pro (Google) FLUX.1-schnell (Black Forest Labs via Hugging Face) --- 🤝 Support & Contributions For questions or improvements, please reach out through the n8n community forum or submit issues/PRs to enhance this template. Created by: Jameson Kanakulya Template Version: 1.0 Last Updated: November 2025

Jameson KanakulyaBy Jameson Kanakulya
142

Parse & track orders from email with Gemini/GPT & Notion database sync

Automated Email Order Tracking System with AI Classification and Notion Sync Overview ⚠️ Self-Hosted Solution Required This workflow requires a self-hosted n8n instance with active integrations for Gmail, Google Gemini AI, OpenAI, and Notion. API credentials and database IDs must be configured before use. --- Template Image --- Description This intelligent automation system monitors your Gmail inbox for order-related emails, extracts key order information using AI, and automatically syncs the data to a Notion database for centralized order tracking. Perfect for individuals managing multiple e-commerce accounts or small businesses tracking customer orders across various platforms (Amazon, Noon, Namshi, etc.). What This Workflow Does Email Monitoring: Continuously monitors Gmail inbox for new incoming emails Smart Classification: Uses AI to identify order-related emails (confirmations, shipping notifications, delivery updates) Intelligent Extraction: Parses email content to extract order details (order number, items, prices, status, delivery info) Database Synchronization: Automatically creates or updates Notion database records with order information Status Tracking: Monitors order progression through stages (Ordered → Shipped → Out for Delivery → Delivered) Key Features Multi-vendor support: Works with any e-commerce platform (Amazon, Noon, Carrefour, Namshi, etc.) Duplicate prevention: Searches existing records before creating new entries Smart updates: Only modifies records when order status actually changes Status validation: Detects backward status changes (potential returns/reshipments) Graceful error handling: Handles missing data and optional fields intelligently Timestamped history: Maintains audit trail of all status changes Technologies Used Gmail Trigger: Email monitoring JavaScript Code: Email content classification with pattern matching Google Gemini AI / OpenAI: Natural language processing for order extraction Structured Output Parser: JSON formatting and validation Notion API: Database search, create, and update operations --- Prerequisites Before setting up this workflow, ensure you have: Self-hosted n8n instance (version 1.0.0 or higher) Gmail account with IMAP access enabled Google Gemini API key OR OpenAI API key Notion workspace with: Integration access configured Database created with the required schema (see below) Integration token/API key --- Notion Database Schema Create a Notion database with the following properties: Required Properties | Property Name | Type | Description | |--------------|------|-------------| | Name of the Item | Title | Product/item name | | Order Number | Text | Unique order identifier | | Quantity | Number | Number of items | | Expected Date | Date or Text | Expected delivery date | | Order Status | Select | Options: Ordered, Shipped, Out for Delivery, Delivered | Optional Properties (Recommended) | Property Name | Type | Description | |--------------|------|-------------| | Vendor | Select | E-commerce platform (Amazon, Noon, etc.) | | Customer Name | Rich Text | Order recipient name | | Price | Number or Rich Text | Item price | | Order Total | Number | Total order amount | | Currency | Select | Currency code (AED, USD, SAR, etc.) | | Delivery Location | Rich Text | Delivery city/address | | Notes | Rich Text | Status change history | | Created Date | Created Time | Auto-populated by Notion | | Last Updated | Last Edited Time | Auto-populated by Notion | --- Setup Instructions Step 1: Import the Workflow Copy the workflow JSON from this template In your n8n instance, go to Workflows → Add Workflow → Import from File/URL Paste the JSON and click Import --- Step 2: Configure Gmail Trigger Click on the Gmail Trigger node Click Create New Credential Follow the OAuth authentication flow to connect your Gmail account Configure trigger settings: Trigger On: Message Received Filters: (Optional) Add label filters to monitor specific folders --- Step 3: Configure AI Model (Choose One) Option A: Google Gemini AI Click on the Google Gemini AI Model node Click Create New Credential Enter your Gemini API key (obtain from Google AI Studio) Select model: gemini-1.5-pro or gemini-1.5-flash Option B: OpenAI Click on the OpenAI Chat Model node Click Create New Credential Enter your OpenAI API key (obtain from OpenAI Platform) Select model: gpt-4o or gpt-4-turbo --- Step 4: Update Email Classification Node Click on the Check Email Type node (JavaScript code) Review the classification patterns (pre-configured for common e-commerce emails) (Optional) Add custom keywords specific to your vendors --- Step 5: Configure Notion Integration 5.1: Create Notion Integration Go to Notion Integrations Click New Integration Name it (e.g., "n8n Order Tracker") Select your workspace Copy the Internal Integration Token 5.2: Share Database with Integration Open your Notion order database Click Share → Invite Search for your integration name and select it Grant Edit permissions 5.3: Get Database ID Open your Notion database in browser Copy the database ID from the URL: https://notion.so/workspace/DATABASE_ID?v=... ^^^^^^^^^^^^ 5.4: Configure Notion Nodes Click on Search a database in Notion node Click Create New Credential Paste your Integration Token In the node parameters: Database ID: Paste your database ID Filter: Set to search by Order Number property Repeat credential setup for Create a database page in Notion and Update a database page in Notion nodes --- Step 6: Update Agent Prompts Click on the Email Classification and Extraction Agent node Review the system prompt (pre-configured for common order emails) Update the {{$now}} variable if using a different timezone (Optional) Customize extraction rules for specific vendors Click on the Order Database Sync Agent node Replace {{notiondatabaseid}} with your actual database ID in the prompt Review status handling logic --- Step 7: Test the Workflow Click Execute Workflow to activate it Send yourself a test order confirmation email Monitor the execution: Check if email was classified correctly Verify extraction output in the AI agent node Confirm Notion database was updated Review your Notion database for the new/updated record --- Step 8: Activate for Production Click Active toggle in the top-right corner The workflow will now run automatically for new emails Monitor executions in the Executions tab --- Workflow Node Descriptions Email Trigger Monitors Gmail inbox for new incoming emails and triggers the workflow when a message is received. Check Email Type JavaScript code node that analyzes email content using pattern matching to identify order-related emails based on keywords, order numbers, and shipping terminology. Email Router (IF Node) Routes emails based on classification results: TRUE branch: Order-related emails proceed to extraction FALSE branch: Non-order emails are filtered out (no action) Email Classification and Extraction Agent AI-powered parser using Google Gemini or OpenAI to extract structured order information: Order number, items, prices, quantities Order status (Ordered/Shipped/Out for Delivery/Delivered) Customer name, delivery location, expected dates Vendor identification Structured Output Parser Validates and formats AI extraction output into clean JSON for downstream processing. Search a database in Notion Queries the Notion database by order number to check if a record already exists, preventing duplicates. Order Database Sync Agent Intelligent database manager that decides whether to create new records or update existing ones based on search results and status comparison. Create a database page in Notion Adds new order records to Notion when no existing record is found. Update a database page in Notion Modifies existing records when order status changes, appending timestamped notes for audit history. No Action Taken Terminates workflow branch for non-order emails with no further processing. --- Customization Options Add More Vendors Edit the Check Email Type node to add vendor-specific keywords: javascript const customVendors = [ 'your-vendor-name', 'vendor-domain.com' ]; Modify Status Values Update the Email Classification and Extraction Agent prompt to add custom status values or change status progression logic. Add Email Notifications Insert a Send Email node after database sync to receive notifications for status changes. Filter by Labels Configure Gmail Trigger to monitor only specific labels (e.g., "Orders", "Shopping"). Multi-Database Support Duplicate the Notion sync section to route different vendors to separate databases. --- Troubleshooting Email not being classified as order Check the Check Email Type node output Add vendor-specific keywords to the classification patterns Review email content for order indicators AI extraction returning empty data Verify AI model credentials are valid Check if email content is being passed correctly Review the extraction prompt for compatibility with email format Notion database not updating Confirm integration has edit permissions on the database Verify database ID is correct in all Notion nodes Check that property names in the workflow match your Notion schema exactly Duplicate records being created Ensure Search a database in Notion node is filtering by Order Number Verify the search results are being evaluated correctly in the sync agent Status not updating Check if the Order Database Sync Agent is comparing current vs new status Review the status comparison logic in the agent prompt --- Performance Considerations Email Volume: This workflow processes each email individually. For high-volume inboxes, consider adding filters or label-based routing. AI Costs: Each email classification uses AI tokens. Monitor your API usage and costs. Rate Limits: Notion API has rate limits (3 requests/second). The workflow handles this gracefully with built-in error handling. --- Privacy & Security All email content is processed through AI APIs (Google/OpenAI) - review their privacy policies Notion data is stored in your workspace with your configured permissions No data is stored or logged outside your n8n instance, AI provider, and Notion workspace Consider using self-hosted AI models for sensitive order information --- Support & Contributions Found a bug or have a suggestion? Please open an issue or contribute improvements to this template! --- License This template is provided as-is under the MIT License. Feel free to modify and distribute as needed. --- Credits Created for the n8n community to streamline e-commerce order tracking across multiple platforms.

Jameson KanakulyaBy Jameson Kanakulya
88
All templates loaded