AutomationFlowsAI & RAG › Qualify Leads and Send Personalized Audio Follow-ups with Gemini and Smallest.ai

Qualify Leads and Send Personalized Audio Follow-ups with Gemini and Smallest.ai

ByZain Khan @zain on n8n.io

This workflow receives lead submissions via a webhook, uses Google Gemini to qualify the lead and write a personalized spoken follow-up script, and for qualified leads generates an MP3 with Smallest.ai, shares it from Google Drive, emails it via Gmail, logs outcomes to Google…

Webhook trigger★★★★☆ complexityAI-powered17 nodesAgentN8N Nodes SmallestaiGoogle DriveGmailSlackGoogle SheetsGoogle Gemini Chat
AI & RAG Trigger: Webhook Nodes: 17 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #17096 — we link there as the canonical source.

This workflow follows the Agent → Gmail recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "3pvpcttm68ggJm3u",
  "name": "Template 7 - Lead Capture to Personalized Audio Follow-Up",
  "tags": [],
  "nodes": [
    {
      "id": "e26f2893-1286-4117-b439-2417aa335207",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1248,
        96
      ],
      "parameters": {
        "path": "lead-capture",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "lastNode"
      },
      "typeVersion": 1
    },
    {
      "id": "16b6ae65-29bb-4e1c-b49e-34f20431d5c8",
      "name": "Set - Clean Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -1024,
        96
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "0d54b5cd-e107-4b4a-8945-a4a8bd3bdb48",
      "name": "AI Agent - Qualify + Script",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -800,
        96
      ],
      "parameters": {
        "text": "=Name: {{ $json.body.name }}\nEmail: {{ $json.body.email }}\nMessage: {{ $json.body.message }}",
        "options": {
          "systemMessage": "You are a sales qualification assistant. You must ALWAYS respond with ONLY a valid JSON object \u2014 no explanation, no markdown, no extra text before or after.\n\nGiven a lead's name, email, and message:\n\n1. Decide if they are qualified (true/false). Qualify if they show business need, scale, budget, or urgency.\n2. If qualified, write a 3-4 sentence personalized audio script using their first name, referencing their message, written to be spoken aloud.\n\nYour ENTIRE response must be exactly this format and nothing else:\n{\"qualified\": true, \"script\": \"Hey John, I just saw your note about scaling outreach...\"}\n\nOr if not qualified:\n{\"qualified\": false, \"script\": \"\"}\n\nDO NOT add any other text. DO NOT use markdown. DO NOT explain anything. ONLY output the JSON object."
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "3ecaaece-5332-4e7a-8d04-ee176233b3ae",
      "name": "Code - Parse Agent JSON",
      "type": "n8n-nodes-base.code",
      "position": [
        -448,
        96
      ],
      "parameters": {
        "jsCode": "const raw = $input.first().json.output || '';\nconst cleaned = raw.replace(/```json|```/g, '').trim();\nlet parsed;\ntry {\n  parsed = JSON.parse(cleaned);\n} catch (e) {\n  throw new Error('AI Agent did not return valid JSON: ' + raw);\n}\nreturn [{\n  json: {\n    ...parsed,\n    lead_name: $('Set - Clean Fields').first().json.lead_name,\n    lead_email: $('Set - Clean Fields').first().json.lead_email,\n    lead_message: $('Set - Clean Fields').first().json.lead_message\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "a53346dc-d1b3-4adc-bad6-95ac0583c28d",
      "name": "IF - Qualified?",
      "type": "n8n-nodes-base.if",
      "position": [
        -224,
        96
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cond1",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.qualified }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "625e08ec-9a3c-4225-ae93-8a11db4cb847",
      "name": "Smallest AI - Synthesize Speech",
      "type": "n8n-nodes-smallestai.smallestai",
      "position": [
        0,
        0
      ],
      "parameters": {
        "text": "={{ $json.script }}",
        "output_format": "mp3",
        "additionalOptions": {}
      },
      "credentials": {},
      "typeVersion": 1
    },
    {
      "id": "adb5acf9-55b4-4ab1-ae75-d15582fbc2a0",
      "name": "Google Drive - Upload Audio",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        272,
        0
      ],
      "parameters": {
        "name": "={{ $('Set - Clean Fields').item.json.body.name }}_followup.mp3",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "693e7593-140c-4bb4-824e-093452cf726f",
      "name": "Google Drive - Make Public",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        448,
        0
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "share",
        "permissionsUi": {
          "permissionsValues": {
            "role": "reader",
            "type": "anyone"
          }
        }
      },
      "typeVersion": 3
    },
    {
      "id": "9308dc38-3a26-4e05-9547-60085c65413e",
      "name": "Gmail - Send Follow-Up",
      "type": "n8n-nodes-base.gmail",
      "position": [
        672,
        0
      ],
      "parameters": {
        "sendTo": "={{ $('Set - Clean Fields').item.json.body.email }}",
        "message": "=<p>Hi {{ $('Set - Clean Fields').item.json.body.name }},</p><p>We put together a quick personal audio message just for you:</p><p><a href=\"https://drive.google.com/file/d/{{ $('Google Drive - Upload Audio').first().json.id }}/view\">\ud83c\udfa7 Listen to your message</a></p><p>Looking forward to connecting!</p>",
        "options": {},
        "subject": "=A personal message for you, {{ $('Set - Clean Fields').item.json.body.name }}"
      },
      "typeVersion": 2
    },
    {
      "id": "4eb903c1-c263-4ea8-9cd8-562ab94e4a56",
      "name": "Slack - Notify Sales",
      "type": "n8n-nodes-base.slack",
      "position": [
        1120,
        0
      ],
      "parameters": {
        "text": "=\ud83d\udd14 *New Qualified Lead!*\n*Name:* {{ $('Code - Parse Agent JSON').first().json.lead_name }}\n*Email:* {{ $('Code - Parse Agent JSON').first().json.lead_email }}\n*Message:* {{ $('Code - Parse Agent JSON').first().json.lead_message }}\n\u2705 Personalized audio sent.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_SLACK_CHANNEL_ID"
        },
        "otherOptions": {}
      },
      "typeVersion": 2
    },
    {
      "id": "99dd0822-97d4-492e-bd88-73a7fc9ed3c8",
      "name": "Google Sheets - Log Unqualified",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        0,
        192
      ],
      "parameters": {
        "columns": {
          "value": {
            "lead_name": "={{ $('Set - Clean Fields').item.json.body.name }}",
            "qualified": "False",
            "timestamp": "={{ $now.toISO() }}",
            "email_sent": "No",
            "lead_email": "={{ $('Set - Clean Fields').item.json.body.email }}",
            "lead_message": "={{ $('Set - Clean Fields').item.json.body.message }}"
          },
          "schema": [
            {
              "id": "timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "lead_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "lead_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "lead_email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "lead_email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "lead_message",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "lead_message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "qualified",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "qualified",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "audio_link",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "audio_link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email_sent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "email_sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_wCDM_j7VblkRvEq76PUnaeRafnzdkRH73Vty7-7aY8/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1_wCDM_j7VblkRvEq76PUnaeRafnzdkRH73Vty7-7aY8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_wCDM_j7VblkRvEq76PUnaeRafnzdkRH73Vty7-7aY8/edit?usp=drivesdk",
          "cachedResultName": "Leads"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "c0905ae7-4064-4f0d-a695-46c8f2237e11",
      "name": "Google Sheets - Log Qualified",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        896,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "lead_name": "={{ $('Set - Clean Fields').item.json.body.name }}",
            "qualified": "={{ $('IF - Qualified?').item.json.qualified }}",
            "timestamp": "={{ $now.toISO() }}",
            "audio_link": "={{ $('Google Drive - Upload Audio').item.json.webViewLink }}",
            "email_sent": "yes",
            "lead_email": "={{ $('Set - Clean Fields').item.json.body.email }}",
            "lead_message": "={{ $('Set - Clean Fields').item.json.body.message }}"
          },
          "schema": [
            {
              "id": "timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "lead_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "lead_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "lead_email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "lead_email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "lead_message",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "lead_message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "qualified",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "qualified",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "audio_link",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "audio_link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email_sent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "email_sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_wCDM_j7VblkRvEq76PUnaeRafnzdkRH73Vty7-7aY8/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1_wCDM_j7VblkRvEq76PUnaeRafnzdkRH73Vty7-7aY8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1_wCDM_j7VblkRvEq76PUnaeRafnzdkRH73Vty7-7aY8/edit?usp=drivesdk",
          "cachedResultName": "Leads"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "997786d5-b310-4476-a361-9f1b6d252503",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -800,
        288
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "29feeba9-08f7-497f-a989-3a7302e5e377",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1952,
        -112
      ],
      "parameters": {
        "width": 560,
        "height": 640,
        "content": "## Lead Capture to Personalized Audio Follow-Up\n\n### How it works\nThis workflow automates lead qualification and creates an ultra-personalized response experience. When a new lead submits their details via a webhook, an AI Agent powered by Google Gemini analyzes their message to evaluate business need, scale, budget, and urgency. \n\n### Setup steps\n* Deploy the workflow to generate your live webhook URL path (`/lead-capture`).\n* Authenticate your **Google Gemini** configuration inside the LangChain Chat Model node.\n* Connect your **Smallest.ai** credentials to handle speech synthesis.\n* Link your target **Google Drive**, **Gmail**, **Google Sheets**, and **Slack** accounts to ensure seamless media delivery and tracking.\n\n### Customization\nYou can easily adjust the qualification criteria or script constraints by editing the system prompt in the **AI Agent - Qualify + Script** node. You can also modify the email HTML layout in the Gmail node to inject your personal branding or change the target channel ID for your Slack sales notifications."
      },
      "typeVersion": 1
    },
    {
      "id": "c41e2238-3acb-458e-98d5-2add43d63402",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1296,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 768,
        "height": 512,
        "content": "## Ingestion & AI Intelligence\nCaptures incoming webhooks, routes them to an advanced LangChain Agent to evaluate sales alignment, and conditionally splits the execution path based on the qualification status."
      },
      "typeVersion": 1
    },
    {
      "id": "09006f2b-b10d-47ab-8342-5ca2c2d5f5dc",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 560,
        "content": "## Voice Generation & Public Hosting\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6537df2c-5b7e-4007-b30f-0d4f5fc76d7b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 1088,
        "height": 320,
        "content": "## Delivery & Pipeline Logging\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "95c80bb6-5c29-475a-a5e2-5569a1df8372",
  "nodeGroups": [],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Set - Clean Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF - Qualified?": {
      "main": [
        [
          {
            "node": "Smallest AI - Synthesize Speech",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Google Sheets - Log Unqualified",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set - Clean Fields": {
      "main": [
        [
          {
            "node": "AI Agent - Qualify + Script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail - Send Follow-Up": {
      "main": [
        [
          {
            "node": "Google Sheets - Log Qualified",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Parse Agent JSON": {
      "main": [
        [
          {
            "node": "IF - Qualified?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - Qualify + Script",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive - Make Public": {
      "main": [
        [
          {
            "node": "Gmail - Send Follow-Up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent - Qualify + Script": {
      "main": [
        [
          {
            "node": "Code - Parse Agent JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive - Upload Audio": {
      "main": [
        [
          {
            "node": "Google Drive - Make Public",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets - Log Qualified": {
      "main": [
        [
          {
            "node": "Slack - Notify Sales",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Smallest AI - Synthesize Speech": {
      "main": [
        [
          {
            "node": "Google Drive - Upload Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow receives lead submissions via a webhook, uses Google Gemini to qualify the lead and write a personalized spoken follow-up script, and for qualified leads generates an MP3 with Smallest.ai, shares it from Google Drive, emails it via Gmail, logs outcomes to Google…

Source: https://n8n.io/workflows/17096/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow receives a blog request via webhook, researches the topic with Tavily, generates a long-form HTML article using Google Gemini, creates two images via the kie.ai API, stores assets in Goo

Agent, @Tavily/N8N Nodes Tavily, Google Gemini Chat +6
AI & RAG

This workflow receives a meeting voice recording via webhook, transcribes it with Deepgram, and uses Google Gemini to extract client details and next-step tasks. It then updates GoHighLevel, posts a t

High Level, Agent, Google Gemini Chat +5
AI & RAG

Arvifund - Supabase (Fixed v5). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 91 nodes.

HTTP Request, Telegram, Google Sheets +9
AI & RAG

Arvifund - Supabase. Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.

HTTP Request, Telegram, Google Sheets +8
AI & RAG

Arvifund - Supabase (Fixed v2). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.

HTTP Request, Telegram, Google Sheets +9