by Deborah
Use n8n to bring data from any API to your AI. This workflow uses the Chat Trigger to provide the chat interface, and the Custom n8n Workflow Tool to call a second workflow that calls the API. The second workflow uses AI functionality to refine the API request based on the user's query. It then makes an API call, and returns the response to the main workflow. This workflow is used in Advanced AI examples | Call an API to fetch data in the documentation. To use this workflow: Load it into your n8n instance. Add your credentials as prompted by the notes. Requires n8n 1.28.0 or above
by Flavien
Audio Generator – Documentation 🎯 Purpose: Generate audio files from text scripts stored in Google Drive. 🔁 Flow: Receive repo IDs. Fetch text scripts. Generate .wav files using local Bark model. Upload back to Drive. 📦 Dependencies: Python script: /scripts/generate_voice.py Bark (voice generation system) n8n instance with access to local shell Google Drive OAuth2 credentials ✏️ Notes: Script filenames must end with .txt Only works with plain text No external API used = 100% free 📦 /scripts/generate_voice.py: import sys import torch import numpy import re from bark import SAMPLE_RATE, generate_audio, preload_models from scipy.io.wavfile import write as write_wav Patch to allow numpy._core.multiarray.scalar during loading torch.serialization.add_safe_globals([numpy._core.multiarray.scalar]) Monkey patch torch.load to force weights_only=False _original_torch_load = torch.load def patched_torch_load(f, args, *kwargs): if 'weights_only' not in kwargs: kwargs['weights_only'] = False return _original_torch_load(f, args, *kwargs) torch.load = patched_torch_load Preload Bark models preload_models() def split_text(text, max_len=300): Split on punctuation to avoid mid-sentence cuts sentences = re.split(r'(?<=[.?!])\s+', text) chunks = [] current = "" for sentence in sentences: if len(current) + len(sentence) < max_len: current += sentence + " " else: chunks.append(current.strip()) current = sentence + " " if current: chunks.append(current.strip()) return chunks Input text file and output path input_text_path = sys.argv[1] output_wav_path = sys.argv[2] with open(input_text_path, 'r', encoding='utf-8') as f: full_text = f.read() voice_preset = "v2/en_speaker_7" chunks = split_text(full_text) Generate and concatenate audio chunks audio_arrays = [] for chunk in chunks: print(f"Generating audio for chunk: {chunk[:50]}...") audio = generate_audio(chunk, history_prompt=voice_preset) audio_arrays.append(audio) Merge all audio chunks final_audio = numpy.concatenate(audio_arrays) Write final .wav file write_wav(output_wav_path, SAMPLE_RATE, final_audio) print(f"Full audio generated at: {output_wav_path}") `
by Klaasjan te Voortwis
This n8n workflow template uses community nodes and is only compatible with the self-hosted version of n8n. Export workflows with readable names, tagged for different environments To ensure understandable workflow exports, ease of use in delivery pipelines, and a better developer experience, this workflow helps with exporting workflows. Inner workings First, the workflow ensures that the directory structure for storing the workflows is correct. Exports all workflows. Next, it processes all workflow files and stores them with readable names. Based on tags, it will also export to dev and prod folders for easy commit and usage in a delivery pipeline. Configration No special setup is required for readable exporting. Usage Create a workflow and tag it with 'Auto deploy to dev' Run the workflow, this will create the needed folders and workflows with readable names. Commit these in your version control. Have a CICD pipeline build an n8n container —see the attached Dockerfile. Check our Auto Starter workflow for auto-starting workflows after deployment. CI/CD Bonus: Attached are two nodes with some example configuration on building your own automated n8n deployment. A Dockerfile, to get the new entrypoint and exported workflows packaged in the container. An updated entrypoint to build your own container, import the workflows, and run the Auto Starter. Set the following environment variables: STARTUP_WORKFLOWS_LOAD_LOCATION: to specify the folder to import from and distinguish between environments. STARTUP_WORKFLOW_ID: the ID of the workflow to run after starting n8n. > Note: The 'Instance Started' n8n trigger won't work, as all workflows are disabled upon import.
by n8n Team
This workflow includes advanced features like text summarization and tokenization, it's ideal for automating document processing tasks that require parsing and summarizing text data from Google Drive. To use this template, you need to be on n8n version 1.19.4 or later.
by Jonathan
Task: Conditional filtering and branching items Why: Filtering and branching data based on conditions allows you to build complex workflows that work with more than one data flow scenario Main use cases: Filter out data that is not relevant for the rest of the workflow Split data to several branches of the workflow, where we want the data to be treated differently in the rest of the workflow
by n8n Team
This workflow implements a custom tool via JavaScript code which returns a random color to users and excludes the given colors. Note that to use this template, you need to be on n8n version 1.19.4 or later.
by Danielle Gomes
Quiz Assistant via WhatsApp with Supabase and OpenAI Create a quiz assistant that helps users study a topic of their choice through WhatsApp. Using Supabase and OpenAI, this workflow captures missing user data, stores it, and delivers dynamic quizzes tailored to each topic. Main Use Cases Guide users through personalized study sessions Collect and store user preferences (name + topic) Automate quiz creation with AI Deliver interactive content via WhatsApp How It Works This workflow is composed of three main paths: 1. User Info Collection Triggered by an incoming WhatsApp message Retrieves existing user data from Supabase Checks if the name and topic are already defined If not, sends WhatsApp prompts to collect missing info Updates Supabase with new entries 2. AI Quiz Generation Once name and topic are confirmed, the Merge node consolidates all inputs Data is sent to the AI Agent (OpenAI Chat + Memory) The agent generates a quiz based on the selected topic 3. Response Delivery The quiz is sent back to the user via WhatsApp Flow ends, ready to restart with the next interaction
by @OnePromptMagic
What This Workflow Does Step 1: Analyzes your recent tweets for personality & style Step 2: Generates strategic keywords based on your profile Step 3: Searches for trending tweets in your niche Step 4: Creates personalized responses & original tweets Step 5: Displays results in beautiful HTML format How to Use Execute the workflow Fill out the form with: Your X username (from your URL) Your goals on X (multiple selection) Optional additional info Submit the form Wait for processing (2-3 minutes) Double-click the "Click to show Result" node example clip can be found here
by Yang
This workflow turns trending news into thoughtful first-person commentary for platforms like LinkedIn. It uses Dumpling AI’s News Search and Scraping APIs to find and extract article content, then feeds the cleaned text to GPT-4o to write personalized insights. The final output is saved back to Google Sheets as a draft for easy review or posting. ✅ What this workflow does Triggers daily using a Schedule node. Fetches a list of content topics from a Google Sheet. Uses Dumpling AI to search for relevant news articles based on each topic. Scrapes the article content with Dumpling AI’s /scrape endpoint. Cleans and aggregates the article content using a Code node. Generates first-person commentary with GPT-4o tailored for LinkedIn. Appends the generated post back to the Google Sheet next to its topic. 🧩 Nodes in this workflow Schedule Trigger**: Starts the workflow daily. Google Sheets (Read Topics)**: Pulls topic rows that don’t have a generated commentary yet. Split In Batches**: Processes each topic one at a time. Wait**: Adds a delay to manage API limits. HTTP Request (Search News)**: Uses Dumpling AI's /search-news to find relevant articles for the topic. Split Out**: Iterates over the list of article results. HTTP Request (Scrape Article)**: Extracts the full article text using Dumpling AI’s /scrape. Aggregate**: Collects and merges article content fields. Code (Clean Article)**: Strips links, formatting, and irrelevant text. OpenAI (GPT-4o)**: Generates a short, first-person LinkedIn post-style commentary using a custom prompt. Google Sheets (Write Back)**: Appends the final output next to the original topic in the sheet. 🧑💼 Who is this for? Founders, content creators, marketers, or **agency teams looking to maintain an active presence on LinkedIn or newsletters by sharing smart takes on industry trends. 💡 What problem does this solve? Most people want to comment on current events but don't have the time to summarize articles or write well-structured posts. This automation saves hours of manual work by: Finding the right article. Extracting and cleaning the content. Writing it in a natural, first-person voice using AI. ⚙️ What you need to use this: A Google Sheet with at least two columns: topic and generated commentary. A Dumpling AI API Key with access to the /search-news and /scrape endpoints. An OpenAI GPT-4o connection.
by darrell_tw
Water Reminder Workflow This workflow demonstrates how to use n8n and Slack to build an intelligent water drinking reminder system, combined with Google Sheets for data recording and OpenAI for generating personalized reminder messages. Google Sheet Template The iOS shortcut template: The result in iOS health: The template demo in Youtube Key Features Scheduled Reminders: Automatically sends water reminders at random times every hour. Intelligent Scheduling: Delays the next reminder if you've recently had water. AI-Generated Messages: Uses OpenAI to generate friendly and non-repetitive reminder messages. Data Tracking: Records daily water intake and calculates percentage of goal achievement. Quick Response: Easily record water intake through Slack buttons. iOS Integration: Provides iOS shortcut links to sync data with the Health app. Pre-Configuration Requirements To use this workflow, you need to set up the following: Google Sheets: Create a Google spreadsheet with log and setting sheets The log sheet should include date, time, and value columns The setting sheet is used to store daily water intake goals Slack: Create a Slack app and obtain an API token Configure permissions for interactive buttons OpenAI: Obtain an OpenAI API key iOS Shortcut (optional): Create an iOS shortcut named darrell_water for recording health data Node Configurations 1. Scheduled Triggers and Data Collection 1.1. Schedule Trigger Purpose**: Triggers water reminders on schedule Configuration**: Cron Expression: 0 {{ Math.floor(Math.random() * 11) }} 8-23 * * * Triggers at a random minute every hour, only between 8 AM and 11 PM 1.2. Google Sheets - Get Target Purpose**: Retrieves daily water intake goal Configuration**: Document ID: Your Google spreadsheet ID Sheet Name: setting 1.3. Google Sheets - Get Log Purpose**: Retrieves today's water intake records Configuration**: Document ID: Your Google spreadsheet ID Sheet Name: log Filter Condition: date equals today's date {{ $now.format('yyyy-MM-dd') }} 1.4. Summarize Purpose**: Calculates total water intake for today Configuration**: Fields to Summarize: value (sum) 1.5. Limit Purpose**: Gets the most recent water intake record Configuration**: Keep: Last items 2. Intelligent Reminder Logic 2.1. Combine Data Purpose**: Merges target and actual water intake data Configuration**: Combine By: Combine by position Number of Inputs: 3 2.2. If Purpose**: Checks if water was consumed recently Configuration**: Condition: {{ DateTime.fromISO($json.date+"T"+$json.time).format('yyyy-MM-dd HH:mm:ss') }} is after {{ $now.minus(30, "minutes") }} 2.3. Wait Purpose**: Randomly delays the reminder if water was consumed recently Configuration**: Wait Time: {{ Math.floor(Math.random() * 1) + 1 }} minutes 3. AI Message Generation and Sending 3.1. OpenAI Purpose**: Generates personalized water reminder messages Configuration**: Model: gpt-4o-mini Messages: System prompt: Requests responses in Traditional Chinese and in JSON format User prompt: Includes information about last water time, current time, goal, and progress Temperature: 1 3.2. Slack Send Drink Notification Purpose**: Sends water reminders to Slack channel Configuration**: Channel: Your Slack channel ID Message Type: Block Block UI: Contains AI-generated reminder message and water amount buttons (100ml, 150ml, 200ml, 250ml, 300ml) 4. User Interaction and Data Recording 4.1. Slack Drink Webhook Purpose**: Receives user interactions when water buttons are clicked Configuration**: HTTP Method: POST Path: slack-water-webhook 4.2. Slack Action Payload Purpose**: Parses Slack interaction data Configuration**: Mode: Raw JSON Output: {{ $json.body.payload }} 4.3. Slack Action Drink Data Purpose**: Extracts water amount and message information Configuration**: Assignments: value: {{ $json.actions[0].value }} message_text: {{ $json.message.text }} shortcut_url: shortcuts://run-shortcut?name=darrell_water&input= shortcut_url_data: JSON containing water amount and time message_ts: {{ $json.container.message_ts }} 4.4. Google Sheets Purpose**: Records water intake data to spreadsheet Configuration**: Operation: Append Document ID: Your Google spreadsheet ID Sheet Name: log Column Mapping: date: {{ $now.format('yyyy-MM-dd') }} time: {{ $now.format('HH:mm:ss') }} value: {{ $json.value }} 4.5. Send to Slack with Confirm Purpose**: Sends confirmation message and provides iOS shortcut link Configuration**: Channel: Your Slack channel ID Message Type: Block Block UI: Contains confirmation message and iOS Health app button Reply Settings: Reply to the thread of the original message Author Information This workflow was created by darrell_tw_, an engineer focused on AI and Automation. Contact: X Threads Instagram Website
by n8n Team
This workflow demonstrates how to connect an open-source model to a Basic LLM node. The workflow is triggered when a new manual chat message appears. The message is then run through a Language Model Chain that is set up to process text with a specific prompt to guide the model's responses. Note that open-source LLMs with a small number of parameters require slightly different prompting with more guidance to the model. You can change the default Mistral-7B-Instruct-v0.1 model to any other LLM supported by HuggingFace. You can also connect other nodes, such as Ollama. Note that to use this template, you need to be on n8n version 1.19.4 or later.
by Wan Dinie
AI Content Generator with Auto Pexels Image Matching This n8n template demonstrates how to use AI to generate engaging content and automatically find matching royalty-free images based on the content context. Use cases are many: Try creating blog posts with hero images, generating social media content with visuals or drafting email newsletters with relevant photos. Good to know At time of writing, Pexels offers free API access with up to 200 requests per hour. See Pexels API for updated info. OpenAI API costs vary by model. GPT-4.1 mini is cheaper while normal GPT-4.1 and above offer deeper content generation but cost more per request. Using the floating JavaScript node can reduce token usage by processing content and keyword extraction in a single prompt. How it works We'll collect a content topic or idea via a manual form trigger. OpenAI generates initial content based on your input topic. The AI extracts suitable keywords from the generated content to find matching images. The keywords are sent to Pexels API, which searches for relevant royalty-free stock images. OpenAI creates the final polished content that complements the selected image. The result is displayed as a formatted HTML template combining content and image together. How to use The manual trigger node is used as an example, but feel free to replace this with other triggers such as webhook or even a form. You can batch-generate multiple pieces of content by looping through a list, but of course, the processing will take longer and cost more. Requirements OpenAI API key (get one at https://platform.openai.com) Pexels API key (get free access at https://www.pexels.com/api) Valid content topics or ideas to generate from Customizing this workflow Optimize token usage**: Connect the floating "Extract Content and Image Keyword" JavaScript node to process everything in one prompt and minimize API costs. If you use this option, update the expressions in the "Pexels Image Search" node and "Create Suitable Content Including Image" node to reference the extracted keywords from the JS node. Upgrade to GPT-4.1, GPT-5.1, or GPT-5.2 for more advanced and creative content generation. Change the HTML template output to other formats like Markdown, plain text, or JSON for different publishing platforms. For long term, store the results in a database like Supabase or Google Sheets if you are planning to reuse the contents.