This workflow follows the Gmail → Google Sheets 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 →
{
"name": "Beydigital Media \u2013 Lead Generation & AI Email Automation",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 9 * * 1"
}
]
}
},
"id": "trigger-schedule",
"name": "Her Pazartesi 09:00 \u00c7al\u0131\u015ft\u0131r",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.1,
"position": [
240,
300
]
},
{
"parameters": {
"url": "https://serpapi.com/search",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "q",
"value": "dijital pazarlama ihtiyac\u0131 olan \u015firketler T\u00fcrkiye site:linkedin.com OR site:instagram.com"
},
{
"name": "api_key",
"value": "={{ $env.SERPAPI_KEY }}"
},
{
"name": "hl",
"value": "tr"
},
{
"name": "gl",
"value": "tr"
},
{
"name": "num",
"value": "10"
}
]
},
"options": {}
},
"id": "google-search-1",
"name": "Google \u2013 Genel \u0130\u015fletmeler",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
480,
180
]
},
{
"parameters": {
"url": "https://serpapi.com/search",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "q",
"value": "web sitesi yenilemek isteyen KOB\u0130 Bursa site:linkedin.com OR dijital ajans arayan"
},
{
"name": "api_key",
"value": "={{ $env.SERPAPI_KEY }}"
},
{
"name": "hl",
"value": "tr"
},
{
"name": "gl",
"value": "tr"
},
{
"name": "num",
"value": "10"
}
]
},
"options": {}
},
"id": "google-search-2",
"name": "Google \u2013 KOB\u0130 Web Sitesi",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
480,
340
]
},
{
"parameters": {
"url": "https://serpapi.com/search",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "q",
"value": "sosyal medya y\u00f6netimi ajans arayan restoran kafe Bursa site:instagram.com OR google.com"
},
{
"name": "api_key",
"value": "={{ $env.SERPAPI_KEY }}"
},
{
"name": "hl",
"value": "tr"
},
{
"name": "gl",
"value": "tr"
},
{
"name": "num",
"value": "10"
}
]
},
"options": {}
},
"id": "google-search-3",
"name": "Google \u2013 Restoran & Kafe",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
480,
500
]
},
{
"parameters": {
"mode": "combine",
"combinationMode": "multiplex",
"options": {}
},
"id": "merge-results",
"name": "Sonu\u00e7lar\u0131 Birle\u015ftir",
"type": "n8n-nodes-base.merge",
"typeVersion": 3,
"position": [
720,
340
]
},
{
"parameters": {
"jsCode": "const items = [];\n\nfor (const item of $input.all()) {\n const data = item.json;\n const organicResults = data.organic_results || [];\n \n for (const result of organicResults) {\n const link = result.link || '';\n const title = result.title || '';\n const snippet = result.snippet || '';\n \n // Skip irrelevant results\n if (!link || link.includes('wikipedia') || link.includes('youtube')) continue;\n \n // Extract domain for company identification\n let domain = '';\n try {\n domain = new URL(link).hostname.replace('www.', '');\n } catch(e) { continue; }\n \n // Determine company type from snippet/title\n let sectorGuess = 'genel i\u015fletme';\n const text = (title + ' ' + snippet).toLowerCase();\n if (text.includes('restoran') || text.includes('kafe') || text.includes('yemek')) sectorGuess = 'restoran/kafe';\n else if (text.includes('ma\u011faza') || text.includes('e-ticaret') || text.includes('sat\u0131\u015f')) sectorGuess = 'e-ticaret/ma\u011faza';\n else if (text.includes('hukuk') || text.includes('avukat')) sectorGuess = 'hukuk b\u00fcrosu';\n else if (text.includes('klinik') || text.includes('di\u015f') || text.includes('doktor')) sectorGuess = 'sa\u011fl\u0131k klinik';\n else if (text.includes('in\u015faat') || text.includes('emlak')) sectorGuess = 'in\u015faat/emlak';\n else if (text.includes('otomotiv') || text.includes('ara\u00e7')) sectorGuess = 'otomotiv';\n \n items.push({\n json: {\n company_name: title.split('|')[0].split('-')[0].trim(),\n website: link,\n domain: domain,\n sector: sectorGuess,\n snippet: snippet,\n source: 'google_search'\n }\n });\n }\n}\n\nreturn items;"
},
"id": "extract-leads",
"name": "Lead'leri Ay\u0131kla & S\u0131n\u0131fland\u0131r",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
960,
340
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": false
},
"conditions": [
{
"id": "no-beydigital",
"leftValue": "={{ $json.domain }}",
"rightValue": "beydigital",
"operator": {
"type": "string",
"operation": "notContains"
}
},
{
"id": "has-domain",
"leftValue": "={{ $json.domain }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "notEquals"
}
}
],
"combinator": "and"
}
},
"id": "filter-leads",
"name": "Kendi Markam\u0131z\u0131 Filtrele",
"type": "n8n-nodes-base.filter",
"typeVersion": 2,
"position": [
1200,
340
]
},
{
"parameters": {
"unit": "requests",
"maxRequests": 1
},
"id": "rate-limit",
"name": "Rate Limit (1/saniye)",
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
1440,
340
]
},
{
"parameters": {
"url": "https://api.hunter.io/v2/domain-search",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "domain",
"value": "={{ $json.domain }}"
},
{
"name": "api_key",
"value": "={{ $env.HUNTER_API_KEY }}"
},
{
"name": "limit",
"value": "1"
}
]
},
"options": {}
},
"id": "hunter-email",
"name": "Hunter.io \u2013 Email Bul",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1680,
340
]
},
{
"parameters": {
"jsCode": "const results = [];\n\nfor (const item of $input.all()) {\n const lead = item.json;\n const hunterData = lead.data || {};\n const emails = hunterData.emails || [];\n \n if (emails.length === 0) continue; // Email bulunamazsa atla\n \n const topEmail = emails[0];\n \n results.push({\n json: {\n company_name: lead.company_name || hunterData.organization || 'Say\u0131n Yetkili',\n contact_name: topEmail.first_name ? `${topEmail.first_name} ${topEmail.last_name || ''}`.trim() : '',\n contact_email: topEmail.value,\n contact_title: topEmail.position || '',\n website: lead.website,\n sector: lead.sector,\n snippet: lead.snippet\n }\n });\n}\n\nreturn results;"
},
"id": "enrich-lead",
"name": "Lead Verisini Zenginle\u015ftir",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1920,
340
]
},
{
"parameters": {
"resource": "chat",
"model": "gpt-4o",
"messages": {
"values": [
{
"role": "system",
"content": "Sen Bey Digital Media ad\u0131na \u00e7al\u0131\u015fan uzman bir dijital pazarlama dan\u0131\u015fman\u0131s\u0131n. T\u00fcrkiye'deki i\u015fletmelere dijital d\u00f6n\u00fc\u015f\u00fcm ve b\u00fcy\u00fcme hizmetleri sunuyorsun.\n\nH\u0130ZMETLER\u0130M\u0130Z:\n\u2022 Sosyal Medya Y\u00f6netimi \u2013 Instagram, Facebook, LinkedIn y\u00f6netimi\n\u2022 Meta Ads & Google Ads \u2013 Performans odakl\u0131 reklam kampanyalar\u0131\n\u2022 Web Tasar\u0131m \u2013 Next.js ile modern, h\u0131zl\u0131 web siteleri\n\u2022 SEO & Yapay Zeka SEO (GEO/AEO) \u2013 Hem geleneksel hem AI arama optimizasyonu\n\u2022 Logo & Kurumsal Kimlik Tasar\u0131m\u0131\n\u2022 AI & Otomasyon \u00c7\u00f6z\u00fcmleri\n\u2022 Detayl\u0131 Raporlama & Analiz\n\nMARKA DE\u011eERLER\u0130:\n\u2022 8+ y\u0131l deneyim, 150+ tamamlanan proje, 100+ mutlu m\u00fc\u015fteri\n\u2022 \u015eeffaf raporlama, sonu\u00e7 odakl\u0131 yakla\u015f\u0131m\n\u2022 Slogan: \"Dijital B\u00fcy\u00fcmenin G\u00fcvenilir Orta\u011f\u0131\"\n\nMAIL YAZMA KURALLARI:\n1. Konu sat\u0131r\u0131 dikkat \u00e7ekici ve ki\u015fiselle\u015ftirilmi\u015f olsun (max 60 karakter)\n2. Selam ki\u015fisel olsun \u2013 isim varsa kullan, yoksa 'Say\u0131n Yetkili'\n3. \u0130lk paragrafta SADECE \u015firketleri hakk\u0131nda bir g\u00f6zlem yap (websitelerinden/sekt\u00f6rden)\n4. \u0130kinci paragrafta bu g\u00f6zleme ba\u011fl\u0131 bir f\u0131rsat/problem sun\n5. \u00dc\u00e7\u00fcnc\u00fc paragrafta ilgili hizmetimizi \u00f6ner \u2013 maksimum 2 hizmet\n6. CTA: \u00dccretsiz 20 dakikal\u0131k ke\u015fif g\u00f6r\u00fc\u015fmesi teklif et\n7. \u0130mza: Resmi ama s\u0131cak\n8. Dil: T\u00fcrk\u00e7e, profesyonel ama samimi\n9. Uzunluk: 200-250 kelime (ne \u00e7ok k\u0131sa ne \u00e7ok uzun)\n10. SPAM kelimeleri kullanma: '\u00fccretsiz hediye', 'acil', 'garantili kazan\u00e7' vs.\n\nHer mail BENZERSIZ ve o \u015firkete \u00d6ZEL olmal\u0131."
},
{
"role": "user",
"content": "A\u015fa\u011f\u0131daki \u015firket i\u00e7in ki\u015fiselle\u015ftirilmi\u015f bir so\u011fuk e-posta yaz:\n\n\u015eirket Ad\u0131: {{ $json.company_name }}\n\u0130leti\u015fim Ki\u015fisi: {{ $json.contact_name || 'Belirtilmemi\u015f' }}\nUnvan: {{ $json.contact_title || 'Belirtilmemi\u015f' }}\nWebsite: {{ $json.website }}\nSekt\u00f6r: {{ $json.sector }}\n\u015eirket Hakk\u0131nda Bilgi: {{ $json.snippet }}\n\nL\u00fctfen \u015fu formatta d\u00f6nd\u00fcr (JSON):\n{\n \"subject\": \"Konu sat\u0131r\u0131 buraya\",\n \"body\": \"Mail i\u00e7eri\u011fi buraya (HTML de\u011fil, d\u00fcz metin)\"\n}"
}
]
},
"options": {
"temperature": 0.7,
"maxTokens": 800
}
},
"id": "openai-write-email",
"name": "OpenAI \u2013 AI Mail Yaz",
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.4,
"position": [
2160,
340
]
},
{
"parameters": {
"jsCode": "const results = [];\n\nfor (const item of $input.all()) {\n const aiResponse = item.json.message?.content || item.json.choices?.[0]?.message?.content || '';\n \n let parsed;\n try {\n // GPT bazen markdown code block i\u00e7inde d\u00f6ner, temizle\n const cleaned = aiResponse.replace(/```json\\n?/g, '').replace(/```\\n?/g, '').trim();\n parsed = JSON.parse(cleaned);\n } catch(e) {\n // JSON parse ba\u015far\u0131s\u0131z olursa ham metni kullan\n parsed = {\n subject: 'Bey Digital Media \u2013 Dijital B\u00fcy\u00fcme F\u0131rsat\u0131',\n body: aiResponse\n };\n }\n \n results.push({\n json: {\n ...item.json,\n email_subject: parsed.subject,\n email_body: parsed.body,\n generated_at: new Date().toISOString()\n }\n });\n}\n\nreturn results;"
},
"id": "parse-ai-response",
"name": "AI Yan\u0131t\u0131n\u0131 Ayr\u0131\u015ft\u0131r",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2400,
340
]
},
{
"parameters": {
"conditions": {
"conditions": [
{
"id": "has-subject",
"leftValue": "={{ $json.email_subject }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "notEquals"
}
},
{
"id": "has-body",
"leftValue": "={{ $json.email_body }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "notEquals"
}
},
{
"id": "has-recipient",
"leftValue": "={{ $json.contact_email }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "notEquals"
}
}
],
"combinator": "and"
}
},
"id": "validate-email",
"name": "Mail Ge\u00e7erlili\u011fini Kontrol Et",
"type": "n8n-nodes-base.filter",
"typeVersion": 2,
"position": [
2640,
340
]
},
{
"parameters": {
"fromEmail": "info@beydigital.com.tr",
"fromName": "Bey Digital Media",
"toEmail": "={{ $json.contact_email }}",
"subject": "={{ $json.email_subject }}",
"emailType": "text",
"message": "={{ $json.email_body }}\n\n---\nBey Digital Media\n\ud83d\udccd Bursa, T\u00fcrkiye\n\ud83c\udf10 www.beydigital.com.tr\n\ud83d\udce7 info@beydigital.com.tr\n\nBu e-postay\u0131 almak istemiyorsan\u0131z l\u00fctfen bildiriniz.",
"options": {
"replyTo": "info@beydigital.com.tr"
}
},
"id": "send-email",
"name": "Gmail \u2013 Maili G\u00f6nder",
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.1,
"position": [
2880,
340
],
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "={{ $env.LEADS_SHEET_ID }}",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "G\u00f6nderilen Mailler",
"mode": "name"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Tarih": "={{ $json.generated_at }}",
"\u015eirket": "={{ $json.company_name }}",
"Email": "={{ $json.contact_email }}",
"Ki\u015fi": "={{ $json.contact_name }}",
"Sekt\u00f6r": "={{ $json.sector }}",
"Website": "={{ $json.website }}",
"Konu": "={{ $json.email_subject }}",
"Durum": "G\u00f6nderildi"
}
},
"options": {}
},
"id": "log-to-sheets",
"name": "Google Sheets \u2013 Kay\u0131t Et",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [
3120,
240
],
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
"text": "\u2705 *Lead Mail G\u00f6nderildi*\n\n\ud83c\udfe2 \u015eirket: {{ $json.company_name }}\n\ud83d\udce7 Email: {{ $json.contact_email }}\n\ud83c\udfed Sekt\u00f6r: {{ $json.sector }}\n\ud83d\udce9 Konu: {{ $json.email_subject }}\n\n_Bey Digital Media Otomasyon_",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"id": "telegram-notify",
"name": "Telegram \u2013 Bildirim G\u00f6nder",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
3120,
440
],
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"url": "https://api.hunter.io/v2/email-verifier",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "email",
"value": "={{ $json.contact_email }}"
},
{
"name": "api_key",
"value": "={{ $env.HUNTER_API_KEY }}"
}
]
},
"options": {}
},
"id": "verify-email",
"name": "Email Ge\u00e7erlili\u011fini Do\u011frula",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2160,
520
]
},
{
"parameters": {
"conditions": {
"conditions": [
{
"id": "email-valid",
"leftValue": "={{ $json.data?.result }}",
"rightValue": "undeliverable",
"operator": {
"type": "string",
"operation": "notEquals"
}
}
]
}
},
"id": "filter-invalid-emails",
"name": "Ge\u00e7ersiz Emailleri Filtrele",
"type": "n8n-nodes-base.filter",
"typeVersion": 2,
"position": [
2400,
520
]
}
],
"connections": {
"Her Pazartesi 09:00 \u00c7al\u0131\u015ft\u0131r": {
"main": [
[
{
"node": "Google \u2013 Genel \u0130\u015fletmeler",
"type": "main",
"index": 0
},
{
"node": "Google \u2013 KOB\u0130 Web Sitesi",
"type": "main",
"index": 0
},
{
"node": "Google \u2013 Restoran & Kafe",
"type": "main",
"index": 0
}
]
]
},
"Google \u2013 Genel \u0130\u015fletmeler": {
"main": [
[
{
"node": "Sonu\u00e7lar\u0131 Birle\u015ftir",
"type": "main",
"index": 0
}
]
]
},
"Google \u2013 KOB\u0130 Web Sitesi": {
"main": [
[
{
"node": "Sonu\u00e7lar\u0131 Birle\u015ftir",
"type": "main",
"index": 1
}
]
]
},
"Google \u2013 Restoran & Kafe": {
"main": [
[
{
"node": "Sonu\u00e7lar\u0131 Birle\u015ftir",
"type": "main",
"index": 2
}
]
]
},
"Sonu\u00e7lar\u0131 Birle\u015ftir": {
"main": [
[
{
"node": "Lead'leri Ay\u0131kla & S\u0131n\u0131fland\u0131r",
"type": "main",
"index": 0
}
]
]
},
"Lead'leri Ay\u0131kla & S\u0131n\u0131fland\u0131r": {
"main": [
[
{
"node": "Kendi Markam\u0131z\u0131 Filtrele",
"type": "main",
"index": 0
}
]
]
},
"Kendi Markam\u0131z\u0131 Filtrele": {
"main": [
[
{
"node": "Rate Limit (1/saniye)",
"type": "main",
"index": 0
}
]
]
},
"Rate Limit (1/saniye)": {
"main": [
[
{
"node": "Hunter.io \u2013 Email Bul",
"type": "main",
"index": 0
}
]
]
},
"Hunter.io \u2013 Email Bul": {
"main": [
[
{
"node": "Lead Verisini Zenginle\u015ftir",
"type": "main",
"index": 0
}
]
]
},
"Lead Verisini Zenginle\u015ftir": {
"main": [
[
{
"node": "OpenAI \u2013 AI Mail Yaz",
"type": "main",
"index": 0
},
{
"node": "Email Ge\u00e7erlili\u011fini Do\u011frula",
"type": "main",
"index": 0
}
]
]
},
"Email Ge\u00e7erlili\u011fini Do\u011frula": {
"main": [
[
{
"node": "Ge\u00e7ersiz Emailleri Filtrele",
"type": "main",
"index": 0
}
]
]
},
"OpenAI \u2013 AI Mail Yaz": {
"main": [
[
{
"node": "AI Yan\u0131t\u0131n\u0131 Ayr\u0131\u015ft\u0131r",
"type": "main",
"index": 0
}
]
]
},
"AI Yan\u0131t\u0131n\u0131 Ayr\u0131\u015ft\u0131r": {
"main": [
[
{
"node": "Mail Ge\u00e7erlili\u011fini Kontrol Et",
"type": "main",
"index": 0
}
]
]
},
"Mail Ge\u00e7erlili\u011fini Kontrol Et": {
"main": [
[
{
"node": "Gmail \u2013 Maili G\u00f6nder",
"type": "main",
"index": 0
}
]
]
},
"Gmail \u2013 Maili G\u00f6nder": {
"main": [
[
{
"node": "Google Sheets \u2013 Kay\u0131t Et",
"type": "main",
"index": 0
},
{
"node": "Telegram \u2013 Bildirim G\u00f6nder",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1",
"saveManualExecutions": true,
"callerPolicy": "workflowsFromSameOwner",
"errorWorkflow": ""
},
"meta": {
"templateCredsSetupCompleted": false
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
gmailOAuth2googleSheetsOAuth2ApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Beydigital Media – Lead Generation & AI Email Automation. Uses httpRequest, openAi, gmail, googleSheets. Scheduled trigger; 18 nodes.
Source: https://github.com/ReaNMeTheFool/BeyDigitalMedia/blob/28d86b4840e6f453ab0300b2793bb171e4e6e1f7/n8n-automations/lead-generation-email.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
AI Institutional Stock Valuation Engine with Risk Scoring & Scenario Targets
Overview This is a production-grade, fully automated stock analysis system built entirely in n8n. It combines institutional-level financial analysis, dual AI model consensus, and a self-improving back
A professional AI equity analysis automation built on n8n that transforms structured financial data and real-time news into disciplined, risk-adjusted price targets and actionable BUY/HOLD/SELL signal
Send a target niche and location via Telegram message Workflow discovers businesses via Google Maps API AI enriches contacts with email and LinkedIn data via Serper GPT-4o scores and qualifies each le
Stop wasting billable hours on manual time-tracking. AutoTimesheet Pro uses AI to collect emails, meetings, and GitHub work, then writes a clean timesheet straight into Google Sheets. Perfect for deve