Skip to main content
A

Arlin Perez

5
Workflows

Workflows by Arlin Perez

Workflow preview: Automated execution cleanup system with n8n API and custom retention rules
Free intermediate

Automated execution cleanup system with n8n API and custom retention rules

Make your n8n instance faster, cleaner, and more efficient by deleting old workflow executions — while keeping only the most recent ones you actually need. Whether you're using n8n Cloud or self-hosted, this lightweight workflow helps reduce database/storage usage and improves UI responsiveness, using only official n8n nodes. ## 🔍 Description Automatically clean up old executions in your n8n instance using only official nodes — no external database queries required. Whether you're on the Cloud version or running self-hosted, this workflow helps you optimize performance and keep your instance tidy by maintaining only the most recent executions per workflow. Ideal for users managing dozens or hundreds of workflows, this solution reduces storage usage and improves the responsiveness of the n8n UI, especially in environments where execution logs can accumulate quickly. ✅ What It Does * Retrieves up to 250 recent executions across all workflows * Groups executions by workflow * Keeps only the most recent N executions per workflow (value is configurable) * Deletes all older executions (regardless of their status: success, error, etc.) * Works entirely with native n8n nodes — no external database access required * Optionally: set the number of executions to keep as 0 to delete all past executions from your instance in a single run ## 🛠️ How to Set Up 🔑 Create a Personal API Key in your n8n instance: Go to Settings → API Keys → Create a new key 🔧 Create a new n8n API Credential (used by both nodes): In your n8n credentials panel: Name: anything you like (e.g., “Internal API Access”) API Key: paste the Personal API Key you just created Base URL: your full n8n instance URL with the /api/v1 path, e.g. https://your-n8n-instance.com/api/v1 ✅ Use this credential in both: The Get Many Executions node (to fetch recent executions) The Delete Many Executions node (to remove outdated executions) 🧩 In the “Set Executions to Keep” node: Edit the variable executionsToKeep and set the number of most recent executions to retain per workflow (e.g. 10) Tip: Set it to 0 to delete all executions 📦 Note: The “Get Many Executions” node will retrieve up to 250 executions per run — this is the maximum allowed by the n8n API. 🧠 No further setup is required — the filtering and grouping logic is handled inside the Code Node automatically. ## 🧪 Included Nodes Overview 🕒 Schedule Trigger → Set to run daily, weekly, etc. 📥 Get Many Executions → Fetches past executions via n8n API 🛠️ Set Executions to Keep → Set how many recent ones to keep 🧠 Code Node → Filters out executions to delete per workflow 🗑️ Delete Executions → Deletes outdated executions ## 💡 Why Use This? Reduce clutter and improve performance in your n8n instance Maintain execution logs only when they’re useful Avoid bloating your storage or database with obsolete data Compatible with both n8n Cloud and self-hosted setups Uses only official, supported n8n nodes — no SQL, no extra setup 🔒 This workflow modifies and deletes execution data. Always review and test it first on a staging instance or on a limited set of workflows before using it in production.

A
Arlin Perez
DevOps
2 Aug 2025
779
0
Workflow preview: Backup and delete workflows to Google Drive with n8n API and form trigger
Free intermediate

Backup and delete workflows to Google Drive with n8n API and form trigger

## 🔍 Description: Effortlessly delete unused or inactive workflows from your n8n instance while automatically backing them up as .json files into your Google Drive. Keep your instance clean, fast, and organized — no more clutter slowing you down. This workflow is ideal for users managing large self-hosted n8n setups, or anyone who wants to maintain optimal performance while preserving full workflow backups. ## ✅ What it does: * Accepts a full n8n Workflow URL via a form * Retrieves workflow info automatically * Converts the workflow’s full JSON definition into a file * Uploads that file to Google Drive * Deletes the workflow safely using the official n8n API * Sends a Telegram notification confirming backup and deletion ## ⚙️ How it works: 📝 Form – Collects the full workflow URL from the user 🔍 n8n Node (Get Workflow) – Uses the URL to fetch workflow details 📦 Code Node ("JSON to File") – Converts the workflow JSON into a properly formatted .json file with UTF-8 encoding, ready to be uploaded to Google Drive. ☁️ Google Drive Upload – Uploads the .json backup file to your selected Drive folder 🗑️ n8n Node (Delete Workflow) – Deletes the workflow from your instance using its ID 📬 Telegram Notification – Notifies you that the workflow was backed up and deleted, showing title, ID, and date ## 📋 Requirements: * Google Drive connected to your n8n account * Telegram Bot connected to n8n * An n8n instance with API access (self-hosted or Cloud) * Your n8n API Key (Create one in the settings) ## 🛠️ How to Set Up: ✅ Add your Google Drive credentials ✅ Add your Telegram Bot credentials 🧾 In the “JSON to File” Code node, no additional setup is required — it automatically converts the workflow JSON into a downloadable .json file using the correct encoding and filename format. ☁️ In the Google Drive node: Binary Property: data Folder ID: your target folder in Google Drive 🔑 Create a new credential for the n8n node using: API Key: your personal n8n API key Base URL: your full n8n instance API path (e.g. https://your-n8n-instance.com/api/v1) ⚙️ Use this credential in both the Get Workflow and Delete Workflow n8n nodes 📬 In the Telegram node, use this message template: 🗑️ Workflow "{{ $json.name }}" (ID: {{ $json.id }}) was backed up to Google Drive and deleted from n8n. 📅 {{ $now }} 🔒 Important: This workflow backs up the entire workflow data to Google Drive. Please be careful with the permissions of your Google Drive folder and avoid sharing it publicly, as the backups may contain sensitive information. Ensuring proper security and access control is essential to protect your data. 🚀 Activate the workflow and you're ready to safely back up and remove workflows from your n8n instance

A
Arlin Perez
DevOps
1 Aug 2025
685
0
Workflow preview: Categorize and label existing Gmail emails automatically with GPT-4o mini
Free advanced

Categorize and label existing Gmail emails automatically with GPT-4o mini

## 📨 Categorize and Label Existing Gmail Emails Automatically with GPT-4o mini ## 👥 Who's it for This workflow is perfect for individuals or teams who want to sort and label existing emails in their Gmail inbox 🗃️ using AI. Ideal for cleaning up unlabeled emails in bulk — no coding required! For sorting incoming emails messages in your gmail inbox, please use this free workflow: [Categorize and Label Incoming Gmail Emails Automatically with GPT-4o mini](https://n8n.io/workflows/5595-categorize-and-label-gmail-emails-automatically-with-gpt-4o-mini/) ## 🤖 What it does It manually processes a selected number of existing Gmail emails, skips those that already have labels, sends the content to an AI Agent powered by GPT-4o mini 🧠, and applies a relevant Gmail label based on the email content. All labels must already exist in Gmail. ## ⚙️ How it works ▶️ Manual Trigger – The workflow starts manually when you click "Execute Workflow". 📥 Gmail Get Many Messages – Pulls a batch of existing inbox emails (default: 50). 🚫 Filter – Skips emails that already have one or more labels. 🧠 AI Agent (GPT-4o mini) – Analyzes the content and assigns a category. 🧾 Structured Output Parser – Converts the AI output into structured JSON. 🔀 Switch Node – Routes each email to the right label based on the AI result. 🏷️ Gmail Nodes – Apply the correct Gmail label to the email. ## 📋 Requirements Gmail account connected to n8n Gmail labels must be manually created in your inbox beforehand Labels must exactly match the category names defined in the AI prompt OpenAI credentials with GPT-4o mini access n8n's AI Agent & Structured Output Parser nodes ## 🛠️ How to set up In your Gmail account, create all the labels you want to use for categorizing emails Open the workflow and adjust the email fetch limit in the Gmail node (e.g., 50, 100) Confirm that the Filter skips emails that already have labels Define your categories in the AI Agent prompt — these must match the Gmail labels exactly In the Switch Node, create a condition for each label/category Ensure each Gmail Label Node applies the correct existing label Save the workflow and run it manually whenever you want to organize your inbox ✅ ## 🎨 How to customize the workflow Add or remove categories in the AI prompt & Switch Node Adjust the batch size of emails to process more or fewer per run Fine-tune the AI prompt to suit your inbox type (e.g., work, personal, client support)

A
Arlin Perez
Personal Productivity
15 Jul 2025
2404
0
Workflow preview: AI research assistant via Telegram (GPT-4o mini + DeepSeek R1 + SerpAPI)
Free intermediate

AI research assistant via Telegram (GPT-4o mini + DeepSeek R1 + SerpAPI)

## AI Research Assistant via Telegram (GPT-4o mini + DeepSeek R1 + SerpAPI) ## 👥 Who’s it for This workflow is perfect for anyone who wants to receive AI-powered research summaries directly on Telegram. Ideal for people asking frequent product, tech, or decision-making questions and want up-to-date answers sourced from the web. ## 🤖 What it does Users send a question via Telegram. An AI agent (DeepSeek R1) reformulates and understands the intent, while a second agent (GPT-4o mini) performs live research using SerpAPI. The most relevant answers, including links and images, are delivered back via Telegram. ## ⚙️ How it works 📲 Telegram Trigger – Starts when a user sends a message to your Telegram bot. 🧠 DeepSeek R1 Agent – Understands, clarifies, or reformulates the user query. 🧠 Research AI Agent (GPT-4o mini + SerpAPI) – Searches the web and summarizes the best results. 📤 Send Telegram Message – Sends the response back to the same user. ## 📋 Requirements - Telegram bot (via BotFather) with API token set in n8n credentials - OpenAI account with API key and balance for GPT-4o mini - SerpAPI account (100 free searches/month) with API key - DeepSeek account with API key and balance ## 🛠️ How to set up Create your Telegram bot using BotFather and connect it using the Telegram Trigger node Set up DeepSeek credentials and add a Chat Model AI Agent node using DeepSeek R1 to reformulate the user’s question Set up OpenAI credentials and add a second ChatGPT AI Agent node using GPT-4o mini In the GPT-4o node, enable the SerpAPI Tool and add your SerpAPI API key Pass the reformulated question from DeepSeek to the GPT-4o agent for live search and summarization Format the response (text, links, optional images) Send the final reply to the user using the Telegram Send Message node Ensure your n8n instance is publicly accessible Test the workflow by sending a message to your Telegram bot ✅

A
Arlin Perez
Personal Productivity
13 Jul 2025
18911
0
Workflow preview: Categorize and label incoming Gmail emails automatically with GPT-4o mini
Free advanced

Categorize and label incoming Gmail emails automatically with GPT-4o mini

Sort New Gmail messages by category with AI ## 👥 Who's it for This workflow is perfect for individuals or teams who receive a high volume of emails 📥 and want to automatically organize them into Gmail labels 🏷️ using AI. No coding required! **For sorting existing emails messages in your gmail inbox, please use this free workflow: [Categorize and Label Existing Gmail Emails Automatically with GPT-4o mini](https://n8n.io/workflows/6031-convey-template-purpose-with-key-services-gmail-gpt-4o-mini-using-action-verb-structure/).** ## 🤖 What it does It automatically processes new Gmail emails, skips those that already have labels, sends the content to an AI Agent powered by GPT-4o mini 🧠, and applies a relevant label based on the content. All labels must exist in Gmail beforehand. ## ⚙️ How it works 1. **📬 Gmail Trigger** – Activates on new email received. 2. **🚫 Filter** – Skips emails that already have a label. 3. **🧠 AI Agent (GPT-4o mini)** – Analyzes the message and decides which label fits best. 4. **🧾 Structured Output Parser** – Formats the AI output into a clean JSON. 5. **🔀 Switch Node** – Routes each email to the correct label path based on the AI result. 6. **🏷️ Gmail Nodes** – Assign the Gmail label to the original email. ## 📋 Requirements - Gmail account connected to n8n - Pre-created labels in Gmail matching the AI categories - OpenAI credentials with GPT-4o mini access - n8n's AI Agent & Structured Output Parser nodes ## 🛠️ How to set up 1. Open the workflow and adjust the **trigger interval** (e.g., every minute, hours or Custom using Cron ⏱️) 2. Check that the **Filter** skips emails with existing labels 3. Define your categories in the **AI Agent prompt** and make sure they match the Gmail labels 4. Configure the **Switch Node** conditions for each category 5. Ensure each **Gmail Label Node** applies the correct label 6. Save and activate the workflow ✅ ## 🎨 How to customize the workflow - Add or remove categories in the AI prompt & Switch Node - Fine-tune prompt instructions to match your specific use case

A
Arlin Perez
Ticket Management
2 Jul 2025
4037
0