by Alex Kim
n8n Workflow: Exponential Backoff for Google APIs Overview This n8n workflow implements an Exponential Backoff mechanism to handle retries when interacting with Google APIs. It ensures that failed API requests are retried with increasing delays, up to a specified maximum retry count. This approach helps mitigate transient errors (e.g., rate limits or temporary network issues) while maintaining workflow efficiency. Key Features: Exponential Backoff Logic**: Dynamically increases wait time between retries based on the retry count. Error Handling**: Stops the workflow and raises an error after a specified number of retries. Dynamic Waiting**: Waits for a calculated duration before each retry. Scalable Design**: Modular nodes for easy debugging and customization. Workflow Details Nodes in the Workflow: Trigger (When clicking "Test Workflow"): Manually starts the workflow for testing. Loop Over Items: Iterates over multiple input items to process Google API requests row by row. Google API Node (Example: Update Sheet): Sends a request to a Google API endpoint (e.g., updating a row in Google Sheets). On success: Moves to the next item in the loop. On error: Passes the error to the Exponential Backoff node. Exponential Backoff: Calculates the delay for the next retry based on the retry count. Logic: const retryCount = $json["retryCount"] || 0; const maxRetries = 5; const initialDelay = 1; // in seconds if (retryCount < maxRetries) { const currentDelayInSeconds = initialDelay * Math.pow(2, retryCount); return { json: { retryCount: retryCount + 1, waitTimeInSeconds: currentDelayInSeconds, status: 'retrying', } }; } else { return { json: { error: 'Max retries exceeded', retryCount: retryCount, status: 'failed' } }; } Wait: Dynamically waits for the waitTimeInSeconds value calculated in the Exponential Backoff node. Configuration: Resume: After Time Interval Wait Amount: {{ $json["waitTimeInSeconds"] }} Unit: Seconds Check Max Retries: Evaluates whether the retry count has exceeded the maximum limit. Routes the workflow: True: Passes to the Stop and Error node. False: Loops back to the Google API node for retry. Stop and Error: Stops the workflow and logs the error when the maximum retry count is reached. Parameters Configurable Settings: Max Retries: Defined in the Exponential Backoff node (const maxRetries = 5). Adjust this value based on your requirements. Initial Delay: The starting wait time for retries, defined as 1 second. Google API Configuration: Ensure your Google API node is properly authenticated and configured with the desired endpoint and parameters. How to Use Import the Workflow: Copy the workflow JSON and import it into your n8n instance. Configure Google API Node: Set up the Google API node with your credentials and target API endpoint (e.g., Google Sheets, Gmail, etc.). Test the Workflow: Manually trigger the workflow and observe the retry behavior in case of errors. Monitor Logs: Use the console logs in the Exponential Backoff node to debug retry timings and status. Example Scenarios Scenario 1: Successful Execution The Google API processes all requests without errors. Workflow completes without triggering the retry logic. Scenario 2: Transient API Errors The Google API returns an error (e.g., 429 Too Many Requests). The workflow retries the request with increasing wait times. Scenario 3: Maximum Retries Exceeded The workflow reaches the maximum retry count (e.g., 5 retries). An error is raised, and the workflow stops. Considerations Jitter: This workflow does not implement jitter (randomized delay) since it's not required for low-volume use cases. If needed, jitter can be added to the exponential backoff calculation. Retry Storms: If multiple workflows run simultaneously, ensure your API quotas can handle potential retries. Error Handling Beyond Max Retries: Customize the Stop and Error node to notify stakeholders or log errors in a centralized system. Customization Options Adjust the maximum retry limit and delay calculation to suit your use case. Add additional logic to handle specific error codes differently. Extend the workflow to notify stakeholders when an error occurs (e.g., via Slack or email). Troubleshooting Retry Not Triggering**: Ensure the retryCount variable is passed correctly between nodes. Confirm that the error output from the Google API node flows to the Exponential Backoff node. Incorrect Wait Time**: Verify the Wait node is referencing the correct field for waitTimeInSeconds. Request for Feedback We are always looking to improve this workflow. If you have suggestions, improvements, or ideas for additional features, please feel free to share them. Your feedback helps us refine and enhance this solution!
by Fernanda Silva
Workflow Description Your workflow is an intelligent chatbot, using ++OpenAI assistant++, integrated with a backend that supports WhatsApp Business, designed to handle various use cases such as sales and customer support. Below is a breakdown of its functionality and key components: Workflow Structure and Functionality Chat Input (Chat Trigger) The flow starts by receiving messages from customers via WhatsApp Business. Collects basic information, such as session_id, to organize interactions. Condition Check (If Node) Checks if additional customer data (e.g., name, age, dependents) is sent along with the message. If additional data is present, a customized prompt is generated, which includes this information. The prompt specifies that this data is for the assistant's awareness and doesn’t require a response. Data Preparation (Edit Fields Nodes) Formats customer data and the interaction details to be processed by the AI assistant. Compiles the customer data and their query into a single text block. AI Responses (OpenAI Nodes) The assistant’s prompt is carefully designed to guide the AI in providing accurate and relevant responses based on the customer’s query and data provided. Prompts describe the available functionalities, including which APIs to call and their specific purposes, helping to prevent “hallucinated” or irrelevant responses. Memory and Context (Postgres Chat Memory) Stores context and messages in continuous sessions using a database, ensuring the chatbot maintains conversation history. API Calls The workflow allows the use of APIs with any endpoints you choose, depending on your specific use case. This flexibility enables integration with various services tailored to your needs. The OpenAI assistant understands JSON structures, and you can define in the prompt how the responses should be formatted. This allows you to structure responses neatly for the client, ensuring clarity and professionalism. Make sure to describe the purpose of each endpoint in the assistant’s prompt to help guide the AI and prevent misinterpretation. Customer Response Delivery After processing and querying APIs, the generated response is sent to the backend and ultimately delivered to the customer through WhatsApp Business. Best Practices Implemented Preventing Hallucinations** Every API has a clear description in its prompt, ensuring the AI understands its intended use case. Versatile Functionality** The chatbot is modular and flexible, capable of handling both sales and general customer inquiries. Context Persistence** By utilizing persistent memory, the flow maintains continuous interaction context, which is crucial for longer conversations or follow-up queries. Additional Recommendations Include practical examples in the assistant’s prompt, such as frequently asked questions or decision-making flows based on API calls. Ensure all responses align with the customer’s objectives (e.g., making a purchase or resolving technical queries). Log interactions in detail for future analysis and workflow optimization. This workflow provides a solid foundation for a robust and multifunctional virtual assistant 🚀
by darrell_tw
Workflow Description This workflow automates the process of retrieving emails from a food delivery platform, extracting key order details, and sending notifications to a Slack channel. Additionally, the Slack message includes a Moze accounting app URL scheme link for quick expense tracking. Key Features Manual Trigger: Allows the workflow to be executed manually for immediate testing. Gmail Integration: Retrieves emails containing specific keywords in the subject line (e.g., "透過 Uber Eats 系統送出的訂單"). (You can adjust the keywords to fit your language.) Data Extraction: Parses the email content to extract key details such as: Order price Shop name Order date and time Slack Notification: Sends a notification to a specified Slack channel using a structured block format, including a link to record the expense in the Moze accounting app. Node Configurations 1. Manual Trigger Purpose**: Starts the workflow manually for testing or immediate execution. Configuration**: No setup needed. 2. Gmail Trigger Purpose**: Automatically polls Gmail for new emails matching specific subject keywords. Configuration**: Filters: q: subject:透過 Uber Eats 系統送出的訂單 (You can adjust the keywords to fit your language.) Polling Frequency: Every hour at 30 minutes past the hour. Credentials: Linked Gmail account. 3. Extract Price, Shop, Date, Time Purpose**: Extracts key information from the email content using regular expressions. Extracted Data**: price: Order price (e.g., $200). shop: Shop name (e.g., "店名"). date: Order date (e.g., 2024.01.01). time: Order time converted to 24-hour format (e.g., 14:30). 4. Slack Notification Purpose**: Sends a formatted message to a Slack channel with extracted order details. Message Content**: Text: Ubereat 訂餐資訊: 商家: {{ shop }} 金額: {{ price }} 日期: {{ date }} Moze App Link: Includes a clickable button in the Slack message with a pre-filled Moze app URL scheme: moze3://expense?amount={{ price }}&account=信用卡&subcategory=外送&store={{ shop }}&date={{ date }}&time={{ time }}&project=生活開銷 Channel: Slack channel ID associated with food delivery notifications. Additional Notes Customization**: Adjust the email subject filter (subject) to match other types of food delivery platforms or services. Error Handling**: Ensure regular expressions for data extraction match the email format. Test with sample emails before deployment. Moze URL Scheme Reference**: Learn more about Moze app URL schemes for customization by visiting the Moze Documentation. This workflow is ideal for automating expense tracking and centralizing notifications for food delivery orders, streamlining personal or team expense management. Image: UberEat Gmail with order information Slack text with button Click the button will call moze url scheme 工作流程描述 此工作流程自動化從外送平台獲取郵件,提取關鍵訂單詳細資訊,並將通知發送到指定的 Slack 頻道。此外,Slack 消息中包含一個 Moze 記帳 App URL Scheme 的連結,方便快速記帳。 主要功能 Manual Trigger:允許手動執行工作流程,方便測試。 Gmail Integration:從 Gmail 中提取包含特定關鍵字(例如:「透過 Uber Eats 系統送出的訂單」)的郵件。 資料提取:解析郵件內容,提取以下關鍵資訊: 訂單金額 商家名稱 訂單日期與時間 Slack 通知:將結構化的通知發送到指定的 Slack 頻道,並包含一個連結供用戶快速記帳。 節點設定 1. Manual Trigger 用途**:手動啟動工作流程以進行測試或即時執行。 設定**:無需額外設定。 2. Gmail Trigger 用途**:自動檢查 Gmail 中是否有符合特定主題關鍵字的新郵件。 設定**: 篩選條件: q: subject:透過 Uber Eats 系統送出的訂單 檢查頻率:每小時的 30 分。 憑證:已連結的 Gmail 帳號。 3. Extract Price, Shop, Date, Time 用途**:使用正則表達式從郵件內容中提取關鍵資訊。 提取的資料**: price:訂單金額(例如:$200)。 shop:商家名稱(例如:「店名」)。 date:訂單日期(例如:2024.01.01)。 time:訂單時間(24 小時制,例如:14:30)。 4. Slack 通知 用途**:將訂單詳細資訊以格式化消息發送到 Slack。 消息內容**: 文字: Ubereat 訂餐資訊: 商家: {{ shop }} 金額: {{ price }} 日期: {{ date }} Moze App 連結:Slack 消息中包含一個可點擊按鈕,預填 Moze App URL Scheme: moze3://expense?amount={{ price }}&account=信用卡&subcategory=外送&store={{ shop }}&date={{ date }}&time={{ time }}&project=生活開銷 頻道:與外送通知相關的 Slack 頻道。 補充說明 自訂化**:可調整郵件主題篩選條件(subject),以匹配其他外送平台或服務。 錯誤處理**:確保正則表達式匹配郵件格式。在部署前使用樣本郵件進行測試。 Moze URL Scheme 參考**:了解更多關於 Moze App URL Scheme 的客製化資訊,請參閱 Moze 官方文件。 此工作流程適合自動化費用記帳以及集中管理外送訂單通知,提升個人或團隊的費用管理效率。
by Ron
This flow monitors a file for changes of its content. If changed, an alert is sent out and you receive it as push, SMS or voice call on SIGNL4. User cases: Log-file monitoring Monitoring of production data Integration with third-party systems via file interface Etc. Sample file "alert-data.json": { "Body": "Alert in building A2.", "Done": false, "eventId": "2518088743722201372_4ee5617b-2731-4d38-8e16-e4148b8fb8a0" } Body: The alert text to be sent. Done: If false this is a new alert. If true this indicated the alert has been closed. eventId: Last SIGNL4 event ID written by SIGNL4. This flow can be easily adapted for database monitoring as well.
by Jordan Haisley
Overview: Automate Your Google OAuth2 Credential Creation This workflow template streamlines the process of creating and naming individual Google OAuth2 credentials for multiple Google services within n8n. By automating tasks typically done manually, it saves significant time and reduces the risk of errors. Who Is This For? This template is perfect for: Marketers who frequently use Google Docs, Google Sheets, Google Slides, and Google Drive for document automation. Developers or technical users who manage numerous integrations and need to minimize credential creation overhead. Teams or solo users with multiple Google accounts who want to eliminate repetitive Google OAuth2 credential creation tasks. Prerequisite Knowledge • Basic familiarity with n8n, including how to configure nodes and connect services. • A Google OAuth JSON file (client ID, client secret, etc.) already set up in your Google Cloud Console. • An understanding of Google services (Docs, Sheets, Slides, Drive, Gmail, Calendar, Contacts and others) and which you may need for your use cases What Problem Does It Solve? Manually creating and naming separate OAuth2 credentials for each Google service can be time-consuming and prone to errors. For instance, if you manage 16 Google accounts, you might need to create 112 credentials manually. This workflow automates that process by using your Google OAuth JSON file and email address, generating uniquely named OAuth2 credentials for each Google service in just a single run per account. Key Features Manual Trigger – Start the workflow on demand to generate new credentials. Set Node for Google OAuth Details – Store your client ID, client secret, and other JSON info securely in one place. Automated Naming Convention – Use your Google email address to create distinct names for each credential, simplifying organization. Array of Google Services – Customize which services to create credentials for, such as Docs, Sheets, Slides, Drive, Gmail, Calendar, or Contacts. Batch Credential Creation – Split the array of Google services and automatically create separate OAuth2 credentials for each. Seamless OAuth2 Integration – Effortlessly authenticate all generated credentials within n8n. How to Set Up Insert Your JSON Details – Paste your Google OAuth 2.0 JSON data into the “Google JSON” node. Add Your Google Email Address – Specify your email address in the “Google Email” node to personalize the naming convention. Configure n8n Account Credentials – In the “n8n Create Credentials” node, select or add proper credentials (e.g., n8n API credentials). Execute the Workflow – Run the workflow to automatically generate individual OAuth2 credentials. Finalize in n8n – Visit your n8n Credentials dashboard to complete the OAuth sign-in for each newly created credential. Customization Options Modify the Services Array** – Easily add or remove Google products based on your workspace needs by editing the array in the “Services” node. Adjust Naming Logic** – Tailor the credential naming convention in the “n8n Create Credentials” node to match your organization’s style or best practices. Set Role-Based Access** – In n8n, control who can view and use these automatically generated credentials by adjusting user permissions. Time-Saving Example I initially had 16 Google accounts, requiring 112 credentials if done manually. With this workflow, I needed just one run per account—saving around two hours of repetitive data entry. Yes, I spent three hours building and documenting this, but it pays off quickly for anyone managing multiple accounts or large teams.
by Yaron Been
Dessix Moss Ttsd Text Generator Description MOSS-TTSD (text to spoken dialogue) is an open-source bilingual spoken dialogue synthesis model that supports both Chinese and English. It can transform dialogue scripts between two speakers into natural, expressive conversational speech. Overview This n8n workflow integrates with the Replicate API to use the dessix/moss-ttsd model. This powerful AI model can generate high-quality text content based on your inputs. Features Easy integration with Replicate API Automated status checking and result retrieval Support for all model parameters Error handling and retry logic Clean output formatting Parameters Optional Parameters seed** (integer, default: 42): Random seed for reproducibility text** (string, default: [S1]你好[S2]你好,最近怎么样[S1]还不错,你呢[S2]我也挺好的,谢谢关心): Dialogue text, format: [S1]Speaker 1 content[S2]Speaker 2 content[S1]... use_normalize** (boolean, default: True): Whether to use text normalization (recommended for better handling of numbers, punctuation, etc.) reference_text_speaker1** (string, default: 周一到周五每天早晨七点半到九点半的直播片段,言下之意呢就是废话有点多,大家也别嫌弃,因为这都是直播间最真实的状态了): Reference text for speaker 1 (corresponding to reference audio) reference_text_speaker2** (string, default: 如果大家想听到更丰富更及时的直播内容,记得在周一到周五准时进入直播间,和大家一起畅聊新消费新科技新趋势): Reference text for speaker 2 (corresponding to reference audio) reference_audio_speaker1** (string, default: None): Reference audio file for speaker 1 (optional, for voice cloning) reference_audio_speaker2** (string, default: None): 说话者2的参考音频文件(可选,用于声音克隆)/ Reference audio file for speaker 2 (optional, for voice cloning) How to Use Set up your Replicate API key in the workflow Configure the required parameters for your use case Run the workflow to generate text content Access the generated output from the final node API Reference Model: dessix/moss-ttsd API Endpoint: https://api.replicate.com/v1/predictions Requirements Replicate API key n8n instance Basic understanding of text generation parameters
by Viktor Klepikovskyi
Advanced Retry and Delay Logic This template provides a robust solution for handling API rate limits and temporary service outages in n8n workflows. It overcomes the limitations of the default node retry settings, which cap retries at 5 and delays at 5 seconds. By using a custom loop with a Set, If, and Wait node, this workflow gives you complete control over the number of retries and the delay between them. Instructions: Replace the placeholder HTTP Request node with your target node (the one that might fail). In the initial Set Fields node, modify the max_tries value to set the total number of attempts for your workflow. Adjust the delay_seconds value to define the initial delay between retries. Optionally, configure the Edit Fields node to implement exponential backoff by adjusting the delay_seconds expression (e.g., {{$json.delay_seconds * 2}}). For a more detailed breakdown and tutorial of this template, you can find additional information here.
by ozkary
Welcome to Ozki Your Data Analyst Agent V1. The Ozki Data Analyst Agent is designed to analyze data from Google Sheets. To use it, you'll need to provide the URL of your Google Sheet file. The agent will then process the data and provide you with analysis results, including key performance indicators (KPIs). Configuration: Configure your credentials on the OpenAI model or select the n8n free OpenAI credits. Set up your agent memory. Use Simple Memory as default. Set your credentials to Google Sheets. Log in with the Google Sheet tool. Instructions: Start with a "Hi" to get the instructions. Ozki needs your Google Sheet URL, which you can get from the address bar of your browser when you have the file open. Follow the conversation with Ozki for your data analysis results.
by Jonathan
This workflow checks for new emails in a mailbox and if the email body contains the word "invoice" it will send the attachment to Mindee. It then posts a message to Slack to let the team know a payment needs to be made, If the value of the invoice is over 1000 it will also email the finance manager. To use this workflow you will need to configure the IMAP node to select the correct mailbox to use then configure the Mindee node to use your credentials. Once that is done the Send Email node will need to be configured to use the correct mail server and to send to the correct people, The last thing to configure is the Slack node this will need your Slack credentials and the channel you want to post the message to.
by WeblineIndia
This n8n workflow automates the process of converting a newly stored PDF file from Google Drive into an HTML file and saving it back to Google Drive. The workflow is triggered whenever a new PDF is uploaded to a specific folder, ensuring seamless conversion and storage without any manual intervention. This workflow provides an efficient, automated solution for converting PDFs to HTML, eliminating the need for manual file handling and ensuring a smooth document transformation process. It is particularly useful for scenarios where PDFs need to be dynamically converted and stored in an organised manner for web usage, archiving, or further processing. Prerequisites : Before setting up this workflow, ensure the following: PDF.co API Key: Sign up at PDF.co and obtain an API key for PDF to HTML conversion. Proper Authentication: Ensure authentication is configured for Google Drive in n8n. Customisation Options : Modify the API request to convert PDFs to other formats like Text, CSV, or XML. Extend the IF Node to reject files based on size or other properties. Send a notification once the conversion is complete using an Email or Telegram Node. Steps : Step 1: Google Drive Trigger Node (Watch for New Files) Click "Add Node" and search for Google Drive. Select "Google Drive Trigger" and add it to the workflow. Authenticate with your Google Account. Select the folder to monitor. Set the trigger to activate whenever a new file is added. Click "Execute Node" to test. Click "Save". Step 2: IF Node (Check if File is a PDF) Click "Add Node" and search for IF. Add a condition to check if the file extension is .pdf If true → Send the file to the next step. If false → Stop the workflow. Click "Execute Node" to test. Click "Save". Step 3: HTTP Request Node (Convert PDF to HTML) Click "Add Node" and search for HTTP Request. Set the Method to POST. Enter the PDF.co API endpoint for PDF to HTML conversion. In the Headers, add API key which we have get from pdf.co Send the binary PDF data as the request body. Click "Execute Node" to test. Click "Save". Step 4: Function Node (Convert Response to Binary) Click "Add Node" and search for Function. Write a JavaScript function to transform the API response into a binary file. Click "Execute Node" to test. Click "Save". Step 5: Google Drive Node (Save Converted HTML File) Click "Add Node" and search for Google Drive. Select "Upload File" as the action. Authenticate with your Google Account. Set the destination folder for storing the HTML file. Map the binary data from the Function Node. Click "Execute Node" to test. Click "Save". Step 6: Connect & Test the Workflow Link the nodes in this order (Google Drive Trigger → IF Node → HTTP Request → Function Node → Google Drive Upload) Run the workflow manually. Upload a test PDF to Google Drive. Check Google Drive for the converted HTML file. Who’s behind this? WeblineIndia’s AI development team. We've delivered 3500+ software projects across 25+ countries since 1999. From no-code automations to complex AI systems — our AI team builds tools that drive results. Looking to hire AI developers? Start with us.
by Eduard
This tutorial demonstrates the creation of the HTML report via Markdown node. The main idea is to prepare a very long gext variable via the Function Node and then convert it to the HTML file. The resulting report can be downloaded from the workflow canvas directly or send via email as an attachment.
by David Ashby
What it is- Very simple connection to your Discord MCP Server and 4o. How to set it up- Just specify your MCP Server's url, select your OpenAI credential, and you're set! How to use it- You can now send a chat message to the production URL from anywhere and the actions will occur on discord! It really is that easy. Note: If you don't yet have a Discord MCP server set up, there is a template called "Discord MCP Server" to get you a jumpstart! Need help? Want access to more workflows and even live Q&A sessions with a top verified n8n creator.. All 100% free? Join the community