by Davide
Workflow Overview This workflow automates the creation and management of a custom OpenAI Assistant for a travel agency ("Travel with us"), leveraging Google Drive for document storage. How It Works 1. Create the OpenAI Assistant Node**: OpenAI Action: Creates a custom assistant named "Travel with us" Assistant using the gpt-4o-mini model. Instructions: Respond only using the provided document (e.g., agency-specific info). Stay friendly, brief, and focused on travel-related queries. Ignore irrelevant questions politely. Credentials: Requires OpenAI API key. 2. Upload Agency Document Google Drive Node**: Action: Downloads a Google Doc as a PDF. OpenAI2 Node**: Action: Uploads the PDF to OpenAI with purpose: "assistants". Output: Generates a file_id. 3. Update the Assistant with the Document OpenAI Node**: Action: Updates the assistant to include the uploaded file. 4. Chat Interaction Chat Trigger**: Activates when a message is received ("When chat message received"). OpenAI Assistant Node**: Action: Uses the updated assistant to respond to user queries. Memory: Window Buffer Memory retains chat context for coherent conversations. Set Up Steps Prepare the Document: Store your travel agency guide in Google Drive (e.g., as a Google Doc). Update the Google Drive node with your document’s ID. Configure Credentials: Google Drive: Connect via OAuth2 (googleDriveOAuth2Api). OpenAI: Add your API key to all OpenAI nodes. Customize the Assistant: Modify the instructions in the OpenAI node to reflect your agency’s needs. Ensure the document includes FAQs, policies, and travel info. Test the Workflow: Trigger manually ("Test workflow") to create the assistant and upload the file. Send a chat message (e.g., "What are your travel packages?") to test responses. Dependencies Google Drive Account**: To store and retrieve the agency document. OpenAI API Access**: For assistant creation and file uploads.
by Keith Rumjahn
Use Case Generate keywords for your Amazon product. You want to find more keywords for advertising your product on Amazon. What this Workflow Does The workflow connects to Amazon's completion API to retrieve keywords for your advertising campaigns Use Airtable to send the workflow your keywords. Download airtable here. It sends the keyword to Amazon and returns keywords related to your keyword. It stores the results back into Airtable. How to Adjust it to Your Needs You can modify the Amazon Completion API URL to get more data back from Amazon. Made by Rumjahn
by Oneclick AI Squad
Acts as a virtual receptionist for the restaurant, handling incoming calls via VAPI without human intervention. It collects user details (name, booking time, number of people) for table bookings, checks availability in a PostgreSQL database using n8n, books the table if available, and sends confirmation. It also provides restaurant details to users, mimicking a human receptionist. Key Insights VAPI must be configured to accurately capture user input for bookings and inquiries. PostgreSQL database requires a table to manage restaurant bookings and availability. Workflow Process Initiate the workflow with a VAPI call to collect user details (name, time, number of people). Use n8n to query the PostgreSQL database for table availability. If a table is available, book it using n8n and update the PostgreSQL database. Send a booking confirmation and hotel service details back to VAPI via n8n. Store and update restaurant table data in the PostgreSQL database using n8n. Usage Guide Import the workflow into n8n and configure VAPI and PostgreSQL credentials. Test with a sample VAPI call to ensure proper data collection and booking confirmation. Prerequisites VAPI API credentials for call handling PostgreSQL database with booking and availability tables Customization Options Modify the VAPI input fields to capture additional user details or adjust the PostgreSQL query for specific availability criteria.
by n8n Team
Who this template is for This template is for developers, content creators, or application builders who want to integrate an AI-powered text-to-image generation service into their applications or systems via an API endpoint. Use case Creating a secure API endpoint that converts text prompts into AI-generated images, with built-in content moderation to prevent inappropriate content generation. This can be used for creative applications, content creation tools, prototyping interfaces, or any system that needs on-demand image generation. How this workflow works Receives text prompt through a webhook endpoint Filters the prompt for inappropriate content using AI moderation Submits valid prompts to the Fal.ai Flux image generation service Polls for completion status and retrieves the generated image when ready Returns the image results in a structured JSON format to the client Set up steps Create a Fal.ai account and obtain API credentials Configure the HTTP Header Auth credentials with your Fal.ai API key Set up an OpenAI API key for the content moderation component Deploy the workflow and note the webhook URL for your API endpoint Test the endpoint by sending a POST request with a JSON body containing a "prompt" field
by n8n Team
This workflow compares 2 datasets from a single database. Two SQL nodes create a slightly different summary report based on the payments table. Both reports have the same structure, but different time periods. In addition to that, output from the "Orders from 2004 and 2005" node has an extra manipulation on the ordercount variable. This makes Compare Datasets node to produce four outputs: data in A Only Branch, in B Only Branch, Same Branch records and Different Branch records. Please refere to the MySQL Tutorial website and download the example database: https://www.mysqltutorial.org/mysql-sample-database.aspx
by Friedemann Schuetz
Welcome to my VEO3 Video Generator Workflow! This automated workflow transforms simple text descriptions into professional 8-second videos using Google's cutting-edge VEO3 AI model. Users submit video ideas through a web form, and the system automatically generates optimized prompts, creates high-quality videos with native audio, and delivers them via Google Drive - all powered by Claude 4 Sonnet for intelligent prompt optimization. This workflow has the following sequence: VEO3 Generator Form - Web form interface for users to input video content, format, and duration Video Prompt Generator - AI agent powered by Claude 4 Sonnet that: Analyzes user input for video content requirements Creates factual, professional video titles Generates detailed VEO3 prompts with subject, context, action, style, camera motion, composition, ambiance, and audio elements Optimizes prompts for 16:9 landscape format and 8-second duration Create VEO3 Video - Submits the optimized prompt to fal.ai VEO3 API for video generation Wait 30 seconds - Initial waiting period for video processing to begin Check VEO3 Status - Monitors the video generation status via fal.ai API Video completed? - Decision node that checks if video generation is finished If not completed: Returns to wait cycle If completed: Proceeds to video retrieval Get VEO3 Video URL - Retrieves the final video download URL from fal.ai Download VEO3 Video - Downloads the generated MP4 video file Merge - Combines video data with metadata for final processing Save Video to Google Drive - Uploads the video to specified Google Drive folder Video Output - Displays completion message with Google Drive link to user The following accesses are required for the workflow: Anthropic API** (Claude 4 Sonnet): Documentation Fal.ai API** (VEO3 Model): Create API key at https://fal.ai/dashboard/keys Google Drive API**: Documentation Workflow Features: User-friendly web form**: Simple interface for video content input AI-powered prompt optimization**: Claude 4 Sonnet creates professional VEO3 prompts Automatic video generation**: Leverages Google's VEO3 model via fal.ai Status monitoring**: Real-time tracking of video generation progress Google Drive integration**: Automatic upload and sharing of generated videos Structured output**: Consistent video titles and professional prompt formatting Audio optimization**: VEO3's native audio generation with ambient sounds and music Current Limitations: Format**: Only 16:9 landscape videos supported Duration**: Only 8-second videos supported Processing time**: Videos typically take 60-120 seconds to generate Use Cases: Content creation**: Generate videos for social media, websites, and presentations Marketing materials**: Create promotional videos and advertisements Educational content**: Produce instructional and explanatory videos Prototyping**: Rapid video concept development and testing Creative projects**: Artistic and experimental video generation Business presentations**: Professional video content for meetings and pitches Feel free to contact me via LinkedIn, if you have any questions!
by Jitesh Dugar
Customer Support Ticket Documentation Automation Automatically transform resolved support tickets into professional, AI-powered PDF documentation with complete tracking and team notifications. Overview This workflow automates the entire process of documenting resolved support tickets — from receiving ticket data to generating professional PDF case studies, storing them in Google Drive, tracking in spreadsheets, and notifying your team. Powered by AI, it creates consistent, high-quality documentation that can be reused for knowledge base articles, training materials, and compliance records. What This Workflow Does Receives resolved support tickets via webhook from your support platform Extracts and normalizes ticket data (works with Zendesk, Freshdesk, and custom formats) Generates AI-powered summaries using OpenAI GPT-4, creating structured case studies with: Problem description Troubleshooting steps taken Final resolution Key takeaways and prevention tips Creates professional PDF documents with branded HTML templates Uploads PDFs to organized Google Drive folders Tracks all tickets in a Google Sheets database for reporting and analytics Sends Slack notifications to your team with links to completed documentation Handles errors gracefully with automatic alerts when issues occur Key Features Fully Automated:** Zero manual intervention after setup AI-Powered Documentation:** Intelligent summaries that extract insights from raw ticket data Professional Output:** Branded, print-ready PDFs with modern styling Multi-Platform Support:** Works with any support tool that can send webhooks Centralized Tracking:** All tickets logged in Google Sheets for easy reporting Error Handling:** Built-in failure detection with Slack alerts Customizable:** Easy to brand with your company colors, logo, and styling Scalable:** Handles hundreds of tickets per day Use Cases Knowledge Base Building:** Automatically create searchable documentation from real support cases Team Training:** Build a library of resolved issues for onboarding new support agents Compliance & Audit:** Maintain complete records of all customer interactions Performance Analytics:** Track resolution times, common issues, and agent performance Customer Success:** Share professional case studies with stakeholders Process Improvement:** Identify recurring issues and optimize workflows Prerequisites Required Services & Accounts n8n** (self-hosted or cloud) OpenAI Account** with API access PDFMunk Account** (for HTML → PDF conversion) Google Workspace** (for Drive & Sheets) Slack Workspace** (optional but recommended) Support Platform** that can send webhooks (Zendesk, Freshdesk, Intercom, etc.) Required Credentials OpenAI API Key PDFMunk API Key Google Drive OAuth2 credentials Google Sheets OAuth2 credentials Slack Bot Token (OAuth2) Setup Instructions 1. Import the Workflow Copy the workflow JSON. In n8n, click “Import from File” or “Import from Clipboard.” Paste and import. 2. Configure Credentials OpenAI API Get API key from OpenAI Add in n8n: Credentials → OpenAI API → Paste key PDFMunk API Sign up at pdfmunk.com Copy API key → Add in Credentials → HtmlcsstopdfApi Google Drive OAuth2 Create project at Google Cloud Console Enable Drive API Create OAuth 2.0 credentials Add in n8n: Credentials → Google Drive OAuth2 → Connect Google Sheets OAuth2 Enable Google Sheets API in the same project Add in n8n: Credentials → Google Sheets OAuth2 → Connect Slack OAuth2 Create app at Slack API Add scopes: chat:write, chat:write.public Install to workspace Add bot token in Credentials → Slack OAuth2 API 3. Configure Node Settings Google Drive Folder ID Create a folder in Drive for PDFs Copy folder ID from the URL → https://drive.google.com/drive/folders/FOLDER_ID_HERE Paste in the “Upload to Google Drive” node Google Sheets Configuration Create a new sheet titled “Support Ticket Documentation Log.” Add these headers in Row 1: | Ticket ID | Subject | Customer Name | Customer Email | Agent Name | Priority | Category | Resolved Date | Resolution Time | PDF Link | Document Generated | Status | | --------- | ------- | ------------- | -------------- | ---------- | -------- | -------- | ------------- | --------------- | -------- | ------------------ | ------ | Copy Sheet ID from URL → https://docs.google.com/spreadsheets/d/SHEET_ID_HERE/edit Paste it in the “Update Google Sheets” node configuration. Slack Channel ID Right-click your Slack channel → View Channel Details Copy the Channel ID Update it in: “Send Slack Notification” node “Error – PDF Failed” node “Error – Upload Failed” node 4. Configure Webhook in Support Tool Activate the workflow in n8n Copy the Webhook URL from the “Webhook – Receive Ticket” node In Zendesk/Freshdesk: Trigger: “Ticket Status = Resolved” Method: POST Paste the n8n webhook URL Send ticket data as JSON 5. Test the Workflow Click “Execute Workflow” manually Send a test webhook Verify each step completes successfully Check: Generated PDF in Google Drive Row entry in Google Sheets Slack notification delivery How It Works Webhook Trigger → Receives resolved ticket Data Extraction → Normalizes ticket fields AI Summarization (OpenAI) → Generates structured summary HTML Formatting → Styles and adds branding PDF Conversion (PDFMunk) → Converts HTML → PDF Google Drive Upload → Saves and returns shareable link Sheets Logging → Appends ticket info + PDF link Slack Notification → Notifies team with summary Error Handling → Detects and reports failures Result → Clean, documented ticket case study in minutes Customization Branding Update company name, logo URL, and color scheme in the “Format HTML” node. Default color: #4CAF50 → Replace with your brand color. AI Prompt Customization Modify “AI Summarization (OpenAI)” node to add: Industry-specific terms Additional sections or insights Different summary tone or length Notification Customization Add @mentions or emojis in Slack messages for better visibility. Data Flow Webhook → Extract Data → AI Summary → Format HTML → Convert to PDF ↓ Download PDF → Upload to Drive → Log in Sheets → Notify Team ↓ Error Handling (if any) Expected Output PDF Document Includes: Branded header with company name/logo Resolution time badge Ticket metadata (ID, priority, customer, agent, etc.) Full AI-generated case study Professional footer with timestamp Google Sheets Entry: All ticket info Resolution metrics Direct PDF link Status = “Generated” Slack Notification: Summary of ticket Clickable PDF link Timestamp Performance Processing Time:** 10–20 seconds/ticket Capacity:** 100+ tickets/day PDF Size:** 50–300 KB Troubleshooting Webhook not triggering → Check webhook URL, trigger conditions, and public access. PDF generation fails → Verify HTML syntax and PDFMunk API key. Google Drive upload fails → Re-authenticate credentials or check folder permissions. Slack notification missing → Ensure bot token, scopes, and channel ID are valid. Data extraction errors → Adjust field mappings or inspect payload format. Best Practices Test before production rollout Monitor first-week error logs Organize Drive by date/priority Validate Sheets columns Use a dedicated Slack channel Archive old PDFs regularly Review AI summaries weekly Document configuration changes Security Notes All credentials stored securely in n8n PDF links are restricted by Drive sharing settings Webhooks use HTTPS for secure data transfer No sensitive info logged in error messages Future Enhancements Multi-language summaries Integration with Confluence or Notion Customer satisfaction feedback link ML-based issue categorization Analytics dashboard Weekly email digests Public knowledge base generation Support Resources n8n Documentation n8n Community OpenAI API Docs PDFMunk Support Google Drive API Slack API Docs License This workflow template is provided as-is for use with n8n under the MIT License.
by PiAPI
What does the workflow do? This workflow is primarily designed to generate animated illustrations for content creators and social media professionals with Midjourney (unoffcial) and Kling (unofficial) API served by PiAPI. PiAPI is an API platform which provides professional API service. With service provided by PiAPI, users could generate a fantastic animated artwork simply using workflow on n8n without complex settings among various AI models. What is animated illustration? An animated illustration is a digitally enhanced artwork that combines traditional illustration styles with subtle, purposeful motion to enrich storytelling while preserving its original artistic essence. Who is this workflow for? Social Media Content Creators: Produces animated illustrations for social media posts. Digital Marketers: Generates marketing materials with motion graphics. Independent Content Producers: Creates animated content without specialized animation skills. Step-by-step Setting Instructions To simplify workflow settings, usually users just need to change basic prompt of the image and the motion of the final video following the instrution below: Sign in your PiAPI account and get your X-API-Key. Fill in your X-API-Key of PiAPI account in Midjourney and Kling nodes. Enter your desired image prompt in the Prompt node. Enter the motion prompt in Kling Video Generator node. For more complex or customization settings, users could also add more nodes to get more output images and generate more videos. Also, they could change the target image to gain a better result. As for recommendation, users could change the video models for which we would recommend live-wallpaper LoRA of Wanx. Users could check API doc to see more use cases of video models and image models for best practice. Use Case Input Prompt A gentle girl and a fluffy rabbit explore a sunlit forest together, playing by a sparkling stream. Butterflies flutter around them as golden sunlight filters through green leaves. Warm and peaceful atmosphere, 4K nature documentary style. --s 500 --sref 4028286908 --niji 6 Output Video When there is troubleshooting Check if the X-API-Key has been filled in nodes needed. Check your task status in Task History in PiAPI to get more details about task status. More Generation Case for Reference
by Yaron Been
F Description This workflow automatically searches Airbnb for the best deals in your target locations and saves them for later reference. It helps travelers find affordable accommodations by continuously monitoring listings and identifying properties that match your budget and preferences. Overview This workflow automatically searches Airbnb for the best deals in your target locations and saves them for later reference. It uses Bright Data to scrape Airbnb listings and can filter results based on your preferences for price, amenities, and ratings. Tools Used n8n:** The automation platform that orchestrates the workflow. Bright Data:** For scraping Airbnb listings without being blocked. Spreadsheets/Databases:** For storing and comparing property deals. How to Install Import the Workflow: Download the .json file and import it into your n8n instance. Configure Bright Data: Add your Bright Data credentials to the Bright Data node. Set Up Data Storage: Configure where you want to store the Airbnb deals. Customize: Specify locations, date ranges, and your budget constraints. Use Cases Travelers:** Find the best accommodation deals for your trips. Digital Nomads:** Track affordable long-term stays in different locations. Property Managers:** Monitor competitor pricing in your area. Connect with Me Website:** https://www.nofluff.online YouTube:** https://www.youtube.com/@YaronBeen/videos LinkedIn:** https://www.linkedin.com/in/yaronbeen/ Get Bright Data:** https://get.brightdata.com/1tndi4600b25 (Using this link supports my free workflows with a small commission) #n8n #automation #airbnb #travel #brightdata #dealhunting #vacationrentals #traveldeals #accommodationdeals #airbnbdeals #n8nworkflow #workflow #nocode #travelhacks #budgettravel #propertydeals #travelplanning #airbnbscraper #vacationplanning #bestairbnbs #travelautomation #affordableaccommodation #staydeals #traveltech #digitalnomad #accommodationfinder
by vinci-king-01
Product Price Monitor with Pushover and Baserow ⚠️ COMMUNITY TEMPLATE DISCLAIMER: This is a community-contributed template that uses ScrapeGraphAI (a community node). Please ensure you have the ScrapeGraphAI community node installed in your n8n instance before using this template. This workflow automatically scrapes multiple e-commerce sites for selected products, analyzes weekly pricing trends, stores historical data in Baserow, and sends an instant Pushover notification when significant price changes occur. It is ideal for retailers who need to track seasonal fluctuations and optimize inventory or pricing strategies. Pre-conditions/Requirements Prerequisites An active n8n instance (self-hosted or n8n.cloud) ScrapeGraphAI community node installed At least one publicly accessible webhook URL (for on-demand runs) A Baserow database with a table prepared for product data Pushover account and registered application Required Credentials ScrapeGraphAI API Key** – Enables web-scraping capabilities Baserow: Personal API Token** – Allows read/write access to your table Pushover: User Key & API Token** – Sends mobile/desktop push notifications (Optional) HTTP Basic Token or API Keys for any private e-commerce endpoints you plan to monitor Baserow Table Specification | Field Name | Type | Description | |------------|-----------|--------------------------| | Product ID | Number | Internal or SKU | | Name | Text | Product title | | URL | URL | Product page | | Price | Number | Current price (float) | | Currency | Single select (USD, EUR, etc.) | | Last Seen | Date/Time | Last price check | | Trend | Number | 7-day % change | How it works This workflow automatically scrapes multiple e-commerce sites for selected products, analyzes weekly pricing trends, stores historical data in Baserow, and sends an instant Pushover notification when significant price changes occur. It is ideal for retailers who need to track seasonal fluctuations and optimize inventory or pricing strategies. Key Steps: Webhook Trigger**: Manually or externally trigger the weekly price-check run. Set Node**: Define an array of product URLs and metadata. Split In Batches**: Process products one at a time to avoid rate limits. ScrapeGraphAI Node**: Extract current price, title, and availability from each URL. If Node**: Determine if price has changed > ±5 % since last entry. HTTP Request (Trend API)**: Retrieve seasonal trend scores (optional). Merge Node**: Combine scrape data with trend analysis. Baserow Nodes**: Upsert latest record and fetch historical data for comparison. Pushover Node**: Send alert when significant price movement detected. Sticky Notes**: Documentation and inline comments for maintainability. Set up steps Setup Time: 15-25 minutes Install Community Node: In n8n, go to “Settings → Community Nodes” and install ScrapeGraphAI. Create Baserow Table: Match the field structure shown above. Obtain Credentials: ScrapeGraphAI API key from your dashboard Baserow personal token (/account/settings) Pushover user key & API token Clone Workflow: Import this template into n8n. Configure Credentials in Nodes: Open each ScrapeGraphAI, Baserow, and Pushover node and select/enter the appropriate credential. Add Product URLs: Open the first Set node and replace the example array with your actual product list. Adjust Thresholds: In the If node, change the 5 value if you want a higher/lower alert threshold. Test Run: Execute the workflow manually; verify Baserow rows and the Pushover notification. Schedule: Add a Cron trigger or external scheduler to run weekly. Node Descriptions Core Workflow Nodes: Webhook** – Entry point for manual or API-based triggers. Set** – Holds the array of product URLs and meta fields. SplitInBatches** – Iterates through each product to prevent request spikes. ScrapeGraphAI** – Scrapes price, title, and currency from product pages. If** – Compares new price vs. previous price in Baserow. HTTP Request** – Calls a trend API (e.g., Google Trends) to get seasonal score. Merge** – Combines scraping results with trend data. Baserow (Upsert & Read)** – Writes fresh data and fetches historical price for comparison. Pushover** – Sends formatted push notification with price delta. StickyNote** – Documents purpose and hints within the workflow. Data Flow: Webhook → Set → SplitInBatches → ScrapeGraphAI ScrapeGraphAI → If True branch → HTTP Request → Merge → Baserow Upsert → Pushover False branch → Baserow Upsert Customization Examples Change Notification Channel to Slack // Replace the Pushover node with Slack { "channel": "#pricing-alerts", "text": 🚨 ${$json["Name"]} changed by ${$json["delta"]}% – now ${$json["Price"]} ${$json["Currency"]} } Additional Data Enrichment (Stock Status) // Add to ScrapeGraphAI's selector map { "stock": { "selector": ".availability span", "type": "text" } } Data Output Format The workflow outputs structured JSON data: { "ProductID": 12345, "Name": "Winter Jacket", "URL": "https://shop.example.com/winter-jacket", "Price": 79.99, "Currency": "USD", "LastSeen": "2024-11-20T10:34:18.000Z", "Trend": 12, "delta": -7.5 } Troubleshooting Common Issues Empty scrape result – Check if the product page changed its HTML structure; update CSS selectors in ScrapeGraphAI. Baserow “Row not found” errors – Ensure Product ID or another unique field is set as the primary key for upsert. Performance Tips Limit batch size to 5-10 URLs to avoid IP blocking. Use n8n’s built-in proxy settings if scraping sites with geo-restrictions. Pro Tips: Store historical JSON responses in a separate Baserow table for deeper analytics. Standardize currency symbols to avoid false change detections. Couple this workflow with an n8n Dashboard to visualize price trends in real-time.
by Paolo Ronco
Automated Invoice Archiving Automatically fetch, store, and extract key information from invoices received via email from your ISP or utility provider (electricity, gas, telecom, water, etc.).The workflow saves the invoices to Google Drive (or optionally to your personal FTP/SFTP server) and logs all invoice details into Google Sheets via AI-powered extraction. Read: Full setup Guide How it works Scheduled TriggerRuns the workflow at a selected interval (e.g., every hour). You can freely adjust the timing. Gmail – Fetch MessagesReads your Gmail inbox and retrieves only messages coming from your ISP/utility provider’s email address, filtering for messages with PDF attachments. Gmail – Download Invoice Fetches the full email content and downloads the attached invoice (PDF). Google Drive – Upload File Uploads the invoice into a specific Google Drive folder of your choice. (Optional) Upload to FTP/SFTP Sends a copy of the invoice to your personal server via secure FTP/SFTP. AI Extraction Pipeline Extract PDF Text – converts the PDF into text (OCR not required if text-based). AI Agent (OpenRouter) – understands the invoice content and extracts structured fields (invoice number, date, provider name, total amount, tax info, line items, etc.) Code Node – sanitizes and parses the JSON from the AI model. Google Sheets – Append Invoice DataAdds a new row to your Google Sheet with all parsed invoice fields. (Optional) CleanupAutomatically deletes:– the Gmail message– the temporary file in Google Drive(Useful when you only want your FTP or Sheets copy.) Parameters to configure | Parameter | Description | Recommended configuration | | --- | --- | --- | | Gmail Credentials | OAuth2 credentials needed to read and delete emails. | Create OAuth credentials on Google Cloud → enable Gmail API → paste Client ID & Secret into n8n → “Connect OAuth2”. | | Sender Email Filter | Email address your provider uses to send invoices. | Example: billing@your-isp.com, invoices@utility.it, ciao@octopusenergy.it | | Google Drive Folder | Destination folder for saving invoices. | Copy the folder ID from the Drive URL and paste it into folderId. | | Google Drive Credentials | OAuth2 connection for file uploads/deletions. | Same Google Cloud project → enable Drive API → OAuth connect in n8n. | | FTP/SFTP Server (optional) | Upload invoices to your private server. | Host / IP · Port · Username · Password or SSH Key · Destination path (e.g. /home/user/invoices/). | | AI Model (OpenRouter) | Large-language model used to parse invoice text. | Example: gpt-4.1, llama-3.1, or any preferred OpenRouter model. | | Google Sheets Document | Destination spreadsheet for structured data. | Create a Sheet → add columns (Vendor, Invoice Number, Date, Amount, Service Type, etc.) → insert documentId & sheet name. | | Sheets Credentials (Service Account) | Used for writing into Google Sheets. | Create Service Account → download JSON → add to n8n → share the Sheet with the Service Account email. | | Trigger Interval | How often the workflow checks for new invoices. | Every hour · every 30 minutes · daily at set ti | Node-by-node breakdown 1. Schedule Trigger Runs at the interval you choose (default: hourly).Start → triggers entire workflow. 2. Gmail – Get Many Messages Filters inbox items using: Sender email** (your ISP/utility address) Has attachment** Unread or recent messages** Downloads metadata + attachment references. 3. Filter – Contains Attachment Ensures only messages with binary attachments continue. 4. Gmail – Get Invoice Downloads: Full email JSON The invoice PDF (binary data) 5. Google Drive – Upload File Uploads invoice PDF with a dynamic filename: {{ $json.from.value[0].name }}-{{ $json.date }}.pdf Requires: Google Drive OAuth2 credentials Folder ID (destination directory) 6. HTTP Request – Download File Retrieves the raw PDF file from Google Drive for further processing. 7. (Optional) FTP/SFTP Upload Uploads the PDF to your server using: Host / IP Port (default 22) Username Password or private key Destination path Filename is sanitized to ensure Unix compatibility. 8. (Optional) Delete Temporary File Deletes the Google Drive file if you don’t want duplicates. 9. (Optional) Delete Gmail Message Removes the original email once processed (optional inbox cleanup). 10. Extract from File (PDF → Text) Reads the PDF and extracts raw text for AI processing. 11. OpenRouter Chat Model LLM backend for the AI agent. Provides: invoice parsing field extraction structured reasoning 12. AI Agent – Extract Invoice Fields The agent is instructed to return strict JSON only, containing keys such as: vendor_name invoice_number invoice_date total_amount tax_details line_items[] po_number po_date Works for most standard PDF invoices. 13. Code – Clean & Parse JSON Sanitizes the AI output: Removes markdown fences Extracts valid JSON Parses into a clean JS object If the AI output is malformed, debugging info is returned. 14. Google Sheets – Append Data Appends the extracted fields into a structured row.Example mappings: Vendor** → {{ $json.vendor_name }} Invoice Number** → {{ $json.invoice_number }} Date** → {{ $json.invoice_date }} Amount** → {{ $json.total_amount }} Service Type** → {{ $json.line_items[0].description }} 💡 Tips & best practices Add multiple sender filters if you have more than one utility provider. Ensure invoices are text-based PDFs for best extraction results. Use Google Drive as a reliable long-term archive, or keep only FTP if you prefer local storage. Create charts in Google Sheets for tracking: Monthly utility cost trends Year-over-year comparison Consumption spikes (if included in invoices) ⚠️ Important notes Utility invoices contain personal and financial data. Keep your FTP/SFTP server secure. Google APIs require proper OAuth2 or Service Account setup; misconfiguration may cause permission errors. This workflow is for personal automation, not a replacement for official fiscal archiving. AI extraction quality depends on invoice formatting and the model you choose.
by Anakhuagbor Sule
Personal Finance AI Agent – Telegram Bot (n8n Workflow) A fully automated Telegram-based personal finance tracker that: Accepts receipts as images, PDFs, or plain text Uses Google Gemini Vision for OCR & intelligent extraction Logs every expense into Google Sheets Stores receipt images/PDFs in Google Drive Answers natural-language spending questions ("How much did I spend on food last month?", "Compare this month vs last month", etc.) Built entirely with n8n – 100% self-hostable, no-code/low-code. How It Works (Overview) You send a message to your Telegram bot → Photo of a receipt, PDF, or just text like "Nov 10 – 2500 NGN – Uber" Switch node detects the message type: Photo → Branch 0 Document (PDF/other) → Branch 1 Pure text → Branch 2 (goes straight to query agent) Receipt Processing Path (Images & PDFs) Files downloaded from Telegram → uploaded to Google Drive ("Monthly receipts" folder) Images → OCR with Gemini Vision PDFs → native PDF text extraction Extracted text + Drive link → merged → sent to Gemini AI Agent AI extracts: Date (YYYY-MM-DD) • Amount (NGN) • Description • Category (food, transportation, subscriptions, takeouts, entertainment, gift, electricity, repairs, other stuffs) Clean JSON → appended to Google Sheets → friendly confirmation sent back Spending Query Path (Text questions) Second AI Agent with access to the live Google Sheet + calculator + memory Answers anything: totals, breakdowns, comparisons, trends, percentages… Live Google Sheet (Template) You can make a copy of the exact sheet the bot uses: https://docs.google.com/spreadsheets/d/1kwWJquPpwL9vt9U06a4f4phXq5jZjaGazvh2V69FGoc/edit?usp=sharing Just click File → Make a copy and use your copy’s ID in the workflow. Setup Steps (Step-by-Step) Prerequisites n8n instance (cloud or self-hosted) Telegram bot (created via @BotFather) Google account 1. Create Telegram Bot Message @BotFather → /newbot Copy the bot token In n8n → Credentials → New Telegram API credential → paste token 2. Google Setup Make a copy of the sheet above → Copy the new spreadsheet ID from the URL Create a Google Drive folder called "Monthly receipts" (or any name) → copy folder ID Enable Gemini API in Google Cloud (or use your existing key) In n8n create these credentials: Google Sheets OAuth2 API Google Drive OAuth2 API Google Gemini (PaLM) API 3. Import Workflow Copy the full JSON from the original file n8n → Workflows → Import → paste → Import 4. Update IDs & Credentials After import, configure these nodes: | Node | What to Change | |-----------------------------------|-----------------------------------------------------| | Telegram Trigger + all Telegram nodes | Your Telegram credential | | Google Sheets nodes | Your Google Sheets credential + new Sheet ID | | Google Drive "Upload file" nodes | Paste your "Monthly receipts" folder ID | | Gemini nodes | Your Gemini credential | | AI Agent & AI Agent1 | Verify model, memory, tools are connected | 5. Activate & Test Click Activate Start chatting with your bot on Telegram Test commands Send a photo/PDF receipt Type: How much did I spend last month? Type: Show me food spending this month vs last month You’ll get instant replies and see new rows appear in your sheet! Features Zero manual entry ever again Works with handwritten receipts Smart categorization Natural-language spending insights All data stays 100% in your Google account Completely private & self-hostable NGN-native (Naira) Never track expenses manually again!