GenAiHub

Workflows

Browse 12,955 Workflows

Workflows Guide

Workflows are deterministic, multi-step pipelines that chain models, tools and agents in a fixed order — the predictable counterpart to an autonomous agent. Each entry records its platform and complexity, so the setup cost is visible before you import it.

157–168 of 12,955

PostWire logo
Create Instagram, TikTok and LinkedIn carousels with OpenAI and PostWire
Live

By PostWire

Quick Overview This workflow collects a carousel topic via an n8n form, uses OpenAI to plan slide copy and generate images, uploads the slides to PostWire, and publishes them as Instagram, TikTok, and LinkedIn multi-image posts, logging results to Google Sheets and emailing failures via Gmail. How it works Receives a submission from an n8n form with the topic, audience, number of slides, and target networks. Uses OpenAI (gpt-5-mini) to generate a JSON plan containing per-slide headlines, image prompts, alt text, and platform-specific captions. For each planned slide, requests an upload URL from PostWire, generates a square image with OpenAI GPT Image (gpt-image-1-mini), uploads the PNG to PostWire, and finalizes it to get a hosted media URL. Aggregates all slide media URLs, sorts them into the original slide order, and publishes a multi-image post to the selected platforms via PostWire using an idempotency key based on the form submission. If all platforms publish successfully, appends a “posted” record with slide headlines and post links to Google Sheets. If any platform fails, logs the error details to Google Sheets and sends a Gmail message with the platform-specific fixes and any successfully published links. Setup Create a PostWire account, connect Instagram/TikTok/LinkedIn, and add an HTTP Header Auth credential in n8n with Authorization: Bearer for the PostWire HTTP Request steps. Add an OpenAI credential with access to gpt-5-mini and gpt-image-1-mini. Connect Google Sheets OAuth credentials and select the target spreadsheet and sheet in both Google Sheets append steps. Connect Gmail credentials and replace you@example.com with your recipient address. Use the form URL from the form trigger to submit a test topic and confirm posting permissions for the selected networks. An n8n automation workflow template by PostWire.

N8nUpdated 30 minutes ago
Free
No ratings
  • 4 nodes
Workflows
  • Automation
  • AI
PostWire logo
Create daily Google Trends image posts for Instagram, TikTok, and Facebook with OpenAI and PostWire
Live

By PostWire

Quick Overview This workflow runs every morning, reads Google Trends RSS for a chosen country, uses OpenAI to select an on-brand trend and generate captions and an image prompt, creates an image with GPT Image, publishes to Instagram, TikTok, and Facebook via PostWire, and logs results to Google Sheets with Gmail alerts on failures. How it works Runs every day at 8:00 on a schedule. Reads the Google Trends RSS feed for your selected country, removes trends already used in previous executions, and keeps the top 10. Sends the trend list plus your brand details to OpenAI to either reject all trends or return a JSON plan with the chosen trend, angle, image prompt, and per-network captions. If a relevant trend is found, requests an upload slot from PostWire, generates a 1024×1024 image with OpenAI GPT Image, uploads it to PostWire, and finalizes it to get a public media URL. Publishes the image post to Instagram, TikTok, and Facebook through PostWire with per-platform captions and an idempotency key based on date and trend. Appends a row to Google Sheets with the trend, angle, status, and post links, and sends a Gmail email with fixes when any platform fails. Setup Create a PostWire account, connect your social profiles, and add an HTTP Header Auth credential in n8n with Authorization: Bearer for the PostWire HTTP requests. Add OpenAI credentials for both the text model and the GPT Image model used to generate captions and images. Update the brand, niche, country code, and target networks in the brand settings step to match your business. Add a Google Sheets OAuth credential, select the target spreadsheet and sheet in both logging steps, and ensure it has columns for date, trend, angle, status, links, and note. Add a Gmail credential and replace the recipient address in the email step so you receive publishing failure details. An n8n automation workflow template by PostWire.

N8nUpdated 30 minutes ago
Free
No ratings
  • 4 nodes
Workflows
  • Automation
  • AI
Hassan logo
Qualify and route real estate leads with Google Gemini, Gmail, Slack and Sheets
Live

By Hassan

Quick overview Automatically qualifies incoming leads with Gemini AI, routes each one to the best available agent by speciality and workload, notifies via Gmail and Slack, escalates to the broker if unacknowledged within 15 minutes, and delivers a weekly performance report, covering every lead from arrival to assignment to follow-up. How it works Section A — Lead Qualification and Routing: A lead arrives via webhook from any source — a website form, a CRM, or any previous QualMatic template passing a Hot lead automatically. Gemini AI qualifies the lead as Hot, Warm, or Cold based on intent, timeline, budget, and message content. Cold leads are logged to a cold queue and held for manual review — no agent is disturbed for low-quality leads. Hot and Warm leads route immediately. The workflow selects the best agent by matching the lead's intent to agent speciality (Buyer / Seller / Rental / Investment / General), then load-balancing within matching agents by active lead count — the least busy specialist gets the lead. Three notifications fire simultaneously — a detailed Gmail to the assigned agent with a click-to-acknowledge link, a Slack DM for instant mobile alert, and a broker copy email for full visibility. Optionally creates a Pipedrive contact and deal automatically. Section B — Acknowledgement: When the agent clicks the acknowledgement link, a webhook records the acknowledgement timestamp, calculates the response time in minutes, and sends a confirmation email. Section C — Escalation: If the agent has not acknowledged within the configured timeout (default 15 minutes), the broker receives an escalation alert via Gmail and Slack — flagging the unacknowledged lead for immediate action. Section D — Weekly Performance Digest: Every Monday at 8 am, a performance report is delivered to the broker — leads assigned per agent, acknowledgement rates, average response times, score breakdown, and escalation count. Setup Add credentials for Google Gemini (PaLM) API, Google Sheets OAuth2, Gmail OAuth2, and Slack OAuth2. Create or choose a Google Sheets spreadsheet with tabs for Lead Assignments, Agents, and Weekly Performance Log, and set the document ID and sheet tabs in all Google Sheets nodes. Update the brokerage configuration values (broker email/name, broker Slack channel, escalation minutes, N8N_WEBHOOK_BASE_URL, and AGENTS_JSON with real agent emails and Slack user IDs) and keep the separate weekly-digest broker configuration in sync. Copy the “New Lead Received” webhook URL into your lead source (website form/CRM) and ensure the public base URL is set so acknowledgement links resolve externally. If using Pipedrive, set USE_PIPEDRIVE to true and fill in PIPEDRIVE_DOMAIN and PIPEDRIVE_API_TOKEN in the configuration. Requirements Google Sheets setup: Create the Brokerage Lead Router sheet template and link its ID to all Sheets nodes. Three tabs required. Tab 1 — Lead Assignments — columns: Assignment ID, Timestamp, Lead Name, Email, Phone, Lead Source, Intent, Budget, Timeline, Message, AI Score, Score Reasoning, Assigned Agent ID, Assigned Agent Name, Assignment Method, Acknowledged, Acknowledged At, Response Time (mins), Escalated, Pipedrive Deal ID, Status, Notes. Tab 2 — Agents — columns: Agent ID, Agent Name, Email, Phone, Slack User ID, Speciality, Active Leads, Total Assigned, Avg Response Time (mins), Status. Tab 3 — Weekly Performance Log. Agent roster setup: Populate the Agents tab with your team before activating. Each agent needs an Agent ID, name, email, Slack User ID, speciality (Buyer / Seller / Rental / Investment / General), starting Active Leads count, and Status (Available). Update AGENTS_JSON in the Configuration node to match — this is the roster the routing logic reads at runtime. Slack User ID: Each agent's Slack User ID is required for direct message notifications. Find it in Slack → click the agent's profile → three-dot menu → Copy member ID. Format: U12345678. Public n8n URL (required): The click-to-acknowledge link in the agent email points to the Section B webhook. This requires a permanent public n8n URL — not localhost. Set N8N_WEBHOOK_BASE_URL in the Configuration node to your server's public URL before going live. For local testing paste the webhook test URL directly in your browser with the correct query parameters. Pipedrive setup (optional): Set USE_PIPEDRIVE = true in the Configuration node and add your PIPEDRIVE_API_TOKEN and PIPEDRIVE_DOMAIN. Get your API token from Pipedrive → Personal Preferences → API tab. Your domain is the subdomain in your Pipedrive URL. Pipedrive authenticates via api_token as a URL query parameter — not a Bearer header. Customization Add or remove agents by updating AGENTS_JSON in the Configuration node — no workflow changes needed. Set any agent's Status to Busy or Off in AGENTS_JSON to exclude them from routing temporarily — they re-enter the pool when Status returns to Available. Adjust ESCALATION_MINUTES to change the acknowledgement timeout — default is 15 minutes, increase for less urgent markets or decrease for high-volume teams. Change the weekly digest schedule in the Schedule trigger node — day and time fully configurable. Extend the routing logic in Parse AI Output & Select Agent to add custom routing rules — for example route by agent location, language, or property price range. Connect from any previous QualMatic template by adding an HTTP Request node pointing to this template's webhook URL — Templates #5, #6, and #10 can all pipe Hot leads directly into the router. Additional info Four independent sections. This template contains four execution sections. Section A fires on a webhook. Section B fires when an agent clicks the acknowledge link. Section C continues from Section A after the Wait node. Section D fires on a weekly schedule. Section A and Section D each have their own Configuration node — update both when changing broker details. AGENTS_JSON vs. Agents sheet. The routing logic reads from AGENTS_JSON in the Configuration node at runtime — not directly from the Agents sheet. The Agents sheet is used for logging and performance tracking only. Keep AGENTS_JSON and the Agents sheet in sync when adding or removing agents. Load balancing. The routing algorithm selects the agent with the fewest active leads within the matching speciality pool. Active Leads increments in the Agents sheet after every assignment — the next routing decision reflects the updated count. Decrease an agent's Active Leads manually in the sheet when they close or archive a lead. Escalation does not reassign. Section C notifies the broker when a lead is unacknowledged — it does not automatically reassign the lead. Manual reassignment by the broker is intentional — the broker may have context about agent availability that the workflow does not. Pipedrive authentication. Pipedrive v1 API uses api_token as a URL query parameter, not a Bearer header. The HTTP Request nodes are pre-configured for this. Do not add an Authorization header — it will be ignored and may cause unexpected behaviour. Cold lead handling. Cold leads are logged to the Lead Assignments sheet with Status = Cold — Pending Review but are not assigned to any agent. The broker can review cold leads periodically and manually assign them or add them to a drip sequence using Template #14. Previous QualMatic Templates. Template#5 https://n8n.io/workflows/17258-qualify-facebook-lead-ads-and-send-follow-ups-with-gemini-gmail-and-sheets/ Template#6 https://n8n.io/workflows/17409-qualify-inbound-real-estate-leads-from-gmail-with-gemini-and-hubspot/ Template#10 https://n8n.io/workflows/18329-match-new-property-listings-to-buyer-leads-with-gemini-gmail-and-sheets/ Template#14 https://n8n.io/workflows/19876-nurture-real-estate-leads-with-google-gemini-gmail-and-google-sheets/. An n8n automation workflow template by Hassan.

N8nUpdated 30 minutes ago
Paid
No ratings
  • 6 nodes
Workflows
  • Automation
  • AI
Se
Send monthly missing document reminders with Google Drive, Sheets, and Chatwork
Live

By 永島税理士事務所

Quick overview This workflow runs monthly to check each client’s previous-month folder in Google Drive for missing required documents, sends a Chatwork reminder listing missing categories, and updates a Google Sheets tracker to avoid duplicate reminders. How it works Runs on a schedule at 12:00 on the 10th day of every month. Calculates the previous month’s folder prefix (Reiwa format) and loads the client list from a Google Sheets “clients” sheet. Skips any client whose Google Sheets “last_reminder” equals today’s date to prevent duplicate reminders. For each remaining client, searches Google Drive for the previous-month folder under the client’s parent folder and lists its subfolders. Filters the subfolders to only those listed in the client’s comma-separated “required_folders” field and checks each one via the Google Drive API to confirm it contains at least one non-folder file. Compiles a list of required document subfolders that contain no files. If any are empty, sends a Chatwork reminder listing those categories and updates “last_reminder” in Google Sheets to today. Setup Create a Google Sheet with a sheet named “clients” and columns for client_name, folder_id (Google Drive parent folder ID), chatwork_room_id, required_folders (comma-separated), and last_reminder (YYYY-MM-DD). Set up Google Sheets OAuth2 credentials in n8n and replace YOUR_GOOGLE_SHEET_ID with your spreadsheet ID. Set up Google Drive OAuth2 credentials (also used by the HTTP Request node) and ensure your Drive folder structure includes a previous-month folder named like “R{year}.{month}月” under each client’s parent folder. Set up a Chatwork API credential and ensure each client row contains the correct Chatwork room ID for reminders. Requirements An n8n environment with the n8n-nodes-chatwork community node installed, Google Sheets and Google Drive OAuth2 credentials, and a Chatwork API credential. Additional info Set the workflow timezone to Asia/Tokyo. Monthly folder names must include the Reiwa year and month prefix, for example R8.9月 for September 2026. Required subfolder names must exactly match required_folders in Google Sheets. The workflow detects empty existing subfolders; it does not report missing monthly folders or required subfolders that have not been created. An n8n automation workflow template by 永島税理士事務所.

N8nUpdated 30 minutes ago
Free
No ratings
  • 4 nodes
Workflows
  • Automation
Amelqa logo
Triage Gmail with Gemini, label emails, log invoices to Sheets, and send Telegram alerts
Live

By Amelqa

Quick overview This workflow watches your Gmail inbox, uses Google Gemini to classify and summarize each email, applies category labels, optionally creates reply drafts, logs invoice details to Google Sheets, sends urgent alerts via Telegram, and stores a searchable processing log in an n8n Data Table. How it works Triggers every 5 minutes when a new Gmail inbox message arrives (excluding promotions, social, and your own emails). Fetches the full email content, formats it into a clean prompt, and sends it to Google Gemini to return a JSON classification, summary, urgency flag, optional reply text, and optional invoice fields. Ensures the corresponding Gmail label (for example, AI/Clients or AI/Invoices) exists and applies it to the email. If the email needs a reply and drafting is enabled, creates a Gmail draft reply in the same thread addressed to the sender. If the email is classified as an invoice and a Google Sheets document ID is provided, appends the extracted invoice fields plus an email link to your Google Sheets invoice tracker. If the email is marked urgent and a Telegram chat ID is provided, sends a Telegram message with the sender, subject, and one-line summary. Inserts a row into an n8n Data Table to log the received time, sender, subject, category, urgency, summary, and whether a draft or invoice entry was created. Setup Connect credentials for Gmail, Google Gemini (API key), and Telegram, and also connect Google Sheets if you want invoice logging. In Google Sheets, create a sheet with header columns: Date, Issuer, Number, Net, VAT, Total, Currency, Subject, Link to the email. In the workflow’s Settings values, fill in your name, business description, tone, your Google Sheets document ID (optional), and your Telegram chat ID (optional), and set create_drafts to false if you don’t want Gmail drafts created. An n8n automation workflow template by Amelqa.

N8nUpdated 30 minutes ago
Free
No ratings
  • 5 nodes
Workflows
  • Automation
  • AI
Timothy Vermeiren logo
Triage and stow Gmail messages with Google Gemini, Telegram, and Sheets
Live

By Timothy Vermeiren

Quick overview This workflow monitors Gmail for new messages, uses Google Gemini to classify and summarize them as emails or calendar invites, assesses urgency, and notifies you in Telegram. It stows non-urgent items in Google Sheets, supports replying/RSVPing from Telegram, and provides a daily stowed-items review. How it works Polls Gmail every minute for new messages and loops through each email. Uses Google Gemini to detect whether the message contains a real calendar invite and generates a short summary (and start/end times when applicable). Uses Google Gemini again to classify the item’s urgency (urgent, today, or later) with a reason, then normalizes the fields for downstream handling. For urgent items, sends an urgent Telegram notification and waits for you to choose whether to respond immediately or act later. If you respond immediately, it collects your reply text in Telegram and replies to the Gmail thread, or (for calendar invites) asks you to accept/decline and updates your Google Calendar attendee response via the Google Calendar API. For today/later items (and urgent items you defer), it marks the email read, removes it from the inbox, adds a “stowed” Gmail label, and appends/updates the item in a Google Sheets log. Every day at 08:45, it pulls all stowed items from Google Sheets, optionally walks you through them in Telegram (including availability checks for events via Google Calendar), and can mark reviewed items as done in the sheet. Setup Connect credentials for Gmail OAuth2, Google Sheets OAuth2, Google Calendar OAuth2, a Telegram bot, and a Google Gemini (PaLM) API key. Update the Telegram chat ID used for notifications and approvals to your own chat. Create (or select) a Gmail label for “stowed” messages and replace the label ID used for adding/removing labels. Set the target Google Sheets document and ensure it has columns matching the workflow fields (id, type, from, title, status, urgency, urgency_reason, additional_data, summary, body). Verify the schedule time (08:45) and adjust it to your timezone and preferred daily review time. An n8n automation workflow template by Timothy Vermeiren.

N8nUpdated 30 minutes ago
Free
No ratings
  • 9 nodes
Workflows
  • Automation
  • AI
Ha
Handle voice receptionist bookings with Vapi, Google Calendar and Sheets
Live

By Ali Amin

Quick overview This workflow handles Vapi voice agent tool calls to check Google Calendar availability, book appointments into Google Calendar, and capture phone messages, then logs outcomes to Google Sheets and notifies the owner by email. How it works Receives a POST webhook request from Vapi containing a tool call (or a status/transcript event). Normalizes the Vapi payload to extract the tool name, tool call ID, and arguments, then routes the request by tool name. For checkAvailability, fetches upcoming events from Google Calendar and computes the next available appointment slots based on configurable business-hour rules. Sends the available slot options back to Vapi in a spoken-ready JSON response that includes ISO timestamps to book against. For bookAppointment, creates a new Google Calendar event at the requested start time, appends a booking record to Google Sheets, and emails the owner a booking alert. For takeMessage, appends the caller’s message to Google Sheets, emails the owner the message details, and returns a confirmation response to Vapi. For any non-tool-call events, returns an empty acknowledgement to Vapi without taking action. Setup In Vapi, create three server tools pointing to this workflow’s production webhook URL: checkAvailability (no args), bookAppointment (customerName, phoneNumber, service, startTime), and takeMessage (callerName, phoneNumber, message). Add a Google Calendar credential and ensure the workflow can access the calendar you want to book into (the template uses the primary calendar). Create/select a Google Sheets spreadsheet and sheet for the call log, with columns like Timestamp, Type, Caller Name, Phone, Details, and When, and set the document and sheet in both Google Sheets nodes. Add an SMTP email credential and update the From and To addresses in both email nodes. If needed, edit the availability rules in the open-slot calculation code (timezone, opening hours, working days, slot length, and minimum notice). Requirements A Vapi account with an assistant configured with three server tools (names and arguments are on the canvas) A Google Calendar credential — the primary calendar is used by default, no selection needed An SMTP credential for owner notifications A Google Sheet for the call log with the six headers listed on the canvas Customization Edit the CONFIGURE block in Compute Open Slots: timezone, opening hours, working days, slot length, notice period and how many slots to offer Change the appointment length (keep Create Event's duration in sync with SLOT_MINS) Reword the owner emails and the spoken confirmations the agent reads back Add more tools to the switch — cancellations, FAQs, transfer-to-human — using the same pattern Works for any business that books time: salons, clinics, trades, tutors, studios Additional info About the creator: Built and maintained by Ali Amin, founder of IhsanOps (https://ihsanops.ai) — a UK AI automation consultancy building voice agents and automations for SMEs. This template is based on a production voice-booking system built for a UK home care provider. Want it adapted to your business — different booking rules, CRM integration, SMS confirmations? Email ali@ihsanops.ai or see https://linkedin.com/in/ali-tm-amin. An n8n automation workflow template by Ali Amin.

N8nUpdated 30 minutes ago
Free13 uses
No ratings
  • 4 nodes
  • 13 views
Workflows
  • Automation
David logo
Parse files and URLs into structured JSON with Groq and Google Gemini
Live

By David

Quick overview This sub-workflow accepts files or a URL from a parent workflow, extracts readable text from many formats, optionally converts that text into structured JSON using Groq and Google Gemini models, and returns one normalized result per input. How it works Triggers when executed by another n8n workflow and receives binary attachments and an optional extraction object that can define required fields. Splits incoming attachments into one item per file (or converts a provided URL into a fetchable text source) and builds a JSON Schema from extraction.field_schemas. Routes each item by MIME type and extracts content using native n8n extractors (PDF, JSON, CSV, Excel, Google Sheets and text) or fetches web pages as text via an HTTP request. For image files, converts the image to a compatible format and uses a vision-capable LLM to extract visible information into JSON and add content_class and class_confidence. If a schema was provided, sends the extracted text to an LLM to produce structured JSON that matches the requested schema. Returns { status, error, data: { text, content_class, class_confidence } } for every input. File types it has no route for come back with a standardized unsupported status and an error payload, so the parent workflow keeps running. Setup Add a credential for a vision-capable LLM to the Vision LLM node, which extracts structured data from images. Add a credential for an LLM to the Text LLM node, which structures extracted text into schema-compliant JSON. A free tier is enough, and any chat model node works in either place. From the parent workflow, use an Execute Workflow node to call this workflow and pass either binary_files (attachments) or a url, plus optional extraction.field_schemas and instructions for the fields you want returned. Requirements One vision-capable LLM and one text LLM with structured output support. The template ships with Google Gemini and Groq nodes, which both have free tiers. A parent workflow that calls it through an Execute Workflow node Customization Add a file type with a new rule in Route by File Type Use class_confidence (0 to 1) in the parent to auto-accept, review or flag each result Additional info Node-by-node documentation · Used by smart-folder2table and inbox-attachment-organizer. An n8n automation workflow template by David.

N8nUpdated 30 minutes ago
Free
No ratings
  • 8 nodes
Workflows
  • Automation
  • AI
Thiago Cavalcanti logo
Draft and approve Gmail replies and follow-ups with OpenAI
Live

By Thiago Cavalcanti

Quick overview This workflow monitors your Gmail inbox for new unread messages, uses OpenAI to classify them and draft fact-based replies, and then emails the draft to an owner for approval before replying in the original Gmail thread. How it works Triggers every minute when a new unread email arrives in Gmail, excluding messages from yourself, no-reply senders, and promotional/social/update/forum categories. Sends the email content and your predefined business facts to OpenAI to categorize the message and generate a draft reply in the requested tone and language. Validates and safety-checks the AI output, flagging complaints, money-related topics, empty/overlong drafts, malformed responses, or amounts not present in your business facts. If the draft is safe, sends an approval email to the owner in Gmail and pauses up to 2 days for an approve/decline response. If approved, replies to the customer in the same Gmail thread using the suggested draft; if declined or timed out, no message is sent. If the draft is not safe, sends the owner a “needs your answer” email with the reason, the original message, and any suggested draft without replying to the customer. Setup Connect your Gmail OAuth2 credentials for the Gmail trigger and the Gmail send/reply steps. Add your OpenAI API credentials and confirm the chat model selection in the OpenAI step. Update “Your settings” with the owner email address, business facts allowed for drafting, desired tone, sign-off name, and maximum draft length. Review and adjust the Gmail search filter (query/labels/categories) to match which inbox messages should be included. Send a test email from another address and verify the approve/decline flow before activating the workflow. Requirements A Gmail account and an OpenAI API key. Customization To handle only some emails, add a label to the trigger filter (for example label:support), change the model in OpenAI model, and edit the rules in Classify and draft a reply and the checks in Check the draft. Additional info Nothing reaches a customer without the owner pressing Send this reply. Do not send, or no answer within 2 days, sends nothing. Money questions, complaints and drafts that fail the checks go to the owner to answer. An n8n automation workflow template by Thiago Cavalcanti.

N8nUpdated 30 minutes ago
Free
No ratings
  • 4 nodes
Workflows
  • Automation
  • AI
Pr
Prevent duplicate payment transactions with webhook, Postgres, and HTTP API
Live

By Oneclick AI Squad

Quick overview This workflow exposes a payment webhook that uses Postgres as an idempotency store to prevent duplicate charges, calling an external payment provider API only once per Idempotency-Key and replaying the stored result for retries, mismatches, and in-progress requests. How it works Receives a POST request on a webhook endpoint with an Idempotency-Key header and a JSON payment payload. Ensures the required Postgres idempotency_keys table and indexes exist to track request status and stored responses. Validates the request, scopes the Idempotency-Key by client ID, and computes a SHA-256 fingerprint of a canonicalized payload. Atomically claims the idempotency key in Postgres (or reads the existing record) to decide whether to execute, replay a completed response, reject a key reused with different payload, or return an “in progress”/duplicate-order error. For newly claimed keys, calls the configured payment provider endpoint via HTTP and forwards the same Idempotency-Key header. Classifies the provider response as completed (replayable success/decline) or failed (retryable timeout/5xx/429), stores the outcome back to Postgres, and responds to the webhook with Idempotency-Key and Idempotent-Replayed headers. Setup Add Postgres credentials and ensure the database user has permissions to create tables/indexes and read/write the idempotency_keys table. Update the providerUrl (and any policy values like leaseSeconds, providerTimeoutMs, maxAmount, and allowedCurrencies) in the validation/fingerprinting code to match your payment provider. Activate the workflow, copy the production webhook URL, and configure your client or upstream service to send POST requests with an Idempotency-Key header (and optional X-Client-Id) plus the required fields in the JSON body. An n8n automation workflow template by Oneclick AI Squad.

N8nUpdated 30 minutes ago
Free
No ratings
  • 3 nodes
Workflows
  • Automation
Oneclick AI Squad logo
Run a distributed priority job queue with Redis and Anthropic
Live

By Oneclick AI Squad

Quick overview This workflow implements a distributed priority job queue in n8n using Redis for storage, lane-based scheduling, and worker wakeups, with optional Anthropic LLM execution and outbound HTTPS calls, plus webhook endpoints for enqueueing jobs, checking queue/job status, and cancelling queued or delayed jobs. How it works Receives a POST request on the /webhook/queue-enqueue webhook, validates the job (type, priority, payload size, delay, attempts), and generates a job record with a token for deduping and fencing. Checks Redis for an existing job:{jobId} record to make enqueueing idempotent, returning a duplicate response if the job already exists. Stores the job record in Redis with a TTL and either pushes it to queue:scheduled (delayed) or to the appropriate priority lane list (queue:critical, queue:high, queue:normal, queue:low) and publishes a Redis pub/sub notification to wake workers. Wakes workers via a Redis Trigger notification or a 10-second schedule, then polls Redis lanes in priority order (with an anti-starvation rotation every N polls) and atomically pops the next available message. Loads and validates the job record in Redis using the message token, claims the job by writing a lease and registering it in queue:processing, and then executes the handler (Anthropic Messages API for llm, an outbound HTTPS request for http, or a no-op echo for noop). Records the outcome back to Redis only if the worker still holds the lease, then either completes the job, schedules a retry with exponential backoff by pushing to queue:scheduled, or dead-letters it to queue:dead, repeating until the per-run job limit is reached. Runs a 20-second maintenance loop that promotes due scheduled jobs back into their priority lanes and requeues or dead-letters processing jobs whose leases have expired, publishing notifications so workers pick them up. Exposes /webhook/queue-status for queue depth stats or job lookup by jobId, and /webhook/queue-cancel to cancel jobs that are still queued or scheduled. Setup Add a Redis credential and select it on all Redis and Redis Trigger nodes so the workflow can store job records, manipulate lists, and publish/subscribe to notifications. Add an Anthropic API key as an HTTP Header Auth credential (using the x-api-key header) for the node that executes llm jobs against the Anthropic Messages API. Update the configuration values in the Producer, Worker, and Maintenance configuration steps (lane order, batch sizes, lease/backoff/retention, allowed HTTP hosts, Anthropic API URL, and model catalog/pricing if you use cost tracking). Run n8n in queue mode with one or more workers (for example, EXECUTIONS_MODE=queue and n8n worker --concurrency=...) so the Redis notification trigger runs on the main instance and job executions scale across workers. If you plan to run http jobs, set allowedHttpHosts to the exact hostnames you permit and ensure targets are reachable over HTTPS using only GET/POST as enforced by the workflow. An n8n automation workflow template by Oneclick AI Squad.

N8nUpdated 30 minutes ago
Free
No ratings
  • 3 nodes
Workflows
  • Automation
Shuo Yuan logo
Classify and route form leads with DeepSeek, Gmail, and Google Sheets
Live

By Shuo Yuan

Quick overview A webhook captures form leads, a Data Table blocks duplicates, and DeepSeek scores each lead from 1 to 100. A three-way switch routes high scores to an approval email, mid scores to a fast-track approval, and low scores to a polite decline. How it works Receives a lead submission via a POST webhook. Normalizes the submitted fields and generates a deterministic lead_unique_id, then checks an n8n Data Table to skip leads that were already processed. Upserts the lead into the Data Table as an audit record and sends the submission to the DeepSeek Chat Completions API to return structured fields and a 1–100 priority score. Routes the lead based on priority_score, sending high-priority and medium-priority leads to different Gmail approval emails and sending low-priority leads a polite decline email. Receives an approval click via a second webhook, validates the decision, appends the approved lead to a Google Sheets fulfillment spreadsheet, and returns an HTML confirmation page. If the DeepSeek request fails, sends a critical alert email via Gmail for troubleshooting. Setup Point your lead form at the lead-intake webhook URL and ensure it POSTs raw_client_input plus selected_service. Create a Data Table with a lead_unique_id text column, then select it in both Data Table nodes and paste the column id into the Mark Processed node. Create a Header Auth credential for the DeepSeek API with Authorization as the header name, then select it in the Classify and Score Lead node. Connect Gmail credentials for approval, fast-track, decline and alert emails, and replace YOUR_EMAIL@example.com in all four email nodes. Connect Google Sheets, replace YOUR_SPREADSHEET_ID, and replace YOUR_N8N_WEBHOOK_DOMAIN in the approval emails with your n8n instance base URL. Requirements Any form builder that can POST to a webhook (raw_client_input, selected_service, email, company_name) | A Data Table with a lead_unique_id text column | A DeepSeek API key (Header Auth credential) | Google Sheets with a fulfillment queue sheet | Gmail credential for approval, fast-track, decline and alert emails | n8n instance reachable from your inbox (for the approval button) Customization Adjust the priority thresholds in the Route by Lead Priority switch (default bands: 85+ high, 60-89 qualified, below 60 declined). | Edit the DeepSeek prompt to score on the criteria your fulfillment process actually cares about. | Swap Google Sheets for Airtable, a CRM node or a Data Table - the approval-gate pattern is identical. | Reuse the dedup + score + route pattern alone for any intake flow that needs priority triage. An n8n automation workflow template by Shuo Yuan.

N8nUpdated 30 minutes ago
Free
No ratings
  • 4 nodes
Workflows
  • Automation