{ "nodes": [ { "id": "1a461b8a-090e-4dc4-a3d7-bf976a49828e", "name": "Slack", "type": "n8n-nodes-base.slack", "position": [ 1660, 200 ], "parameters": { "text": "={{ $json.text }}", "select": "channel", "channelId": { "__rl": true, "mode": "id", "value": "YOUR_SLACK_CHANNEL_ID" }, "otherOptions": {} }, "typeVersion": 2.1 }, { "id": "bcd8e7dc-cb7f-4e2b-a0c6-2d154cb58938", "name": "n8n Form Trigger", "type": "n8n-nodes-base.formTrigger", "position": [ 380, 420 ], "parameters": { "options": {}, "formTitle": "Contact us", "formFields": { "values": [ { "fieldLabel": "What's your business email?" } ] }, "formDescription": "We'll get back to you soon" }, "typeVersion": 2 }, { "id": "c20c626f-fd58-497f-942f-5d10f198f36d", "name": "Check if the email is valid", "type": "n8n-nodes-base.if", "position": [ 800, 420 ], "parameters": { "options": {}, "conditions": { "options": { "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "54d84c8a-63ee-40ed-8fb2-301fff0194ba", "operator": { "name": "filter.operator.equals", "type": "string", "operation": "equals" }, "leftValue": "={{ $json.status }}", "rightValue": "valid" } ] } }, "typeVersion": 2 }, { "id": "6416c2ee-59a0-4496-bd62-0a3af06986b7", "name": "Email is not valid, do nothing", "type": "n8n-nodes-base.noOp", "position": [ 1140, 560 ], "parameters": {}, "typeVersion": 1 }, { "id": "b9ce2ee8-b816-497a-99af-faffdc99ee5f", "name": "Score lead with MadKudu", "type": "n8n-nodes-base.httpRequest", "position": [ 1140, 320 ], "parameters": { "url": "https://api.madkudu.com/v1/persons", "authentication": "genericCredentialType", "genericAuthType": "httpBasicAuth", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "email", "value": "={{ $json.email }}" } ] }, "options": {} }, "typeVersion": 4.1 }, { "id": "0720ab51-5222-46fe-8a1a-31e25b81920c", "name": "Verify email with Hunter", "type": "n8n-nodes-base.hunter", "position": [ 600, 420 ], "parameters": { "email": "={{ $json['What\\'s your business email?'] }}", "operation": "emailVerifier" }, "typeVersion": 1 }, { "id": "95ec00d2-d926-49ff-a604-1f2d0b291b6f", "name": "Not interesting enough", "type": "n8n-nodes-base.noOp", "position": [ 1660, 460 ], "parameters": {}, "typeVersion": 1 }, { "id": "5dc270d5-29fd-4620-8ca4-84532cf49c34", "name": "if customer fit score > 60", "type": "n8n-nodes-base.if", "position": [ 1380, 320 ], "parameters": { "options": {}, "conditions": { "options": { "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "c23d7b34-a4ae-421f-bd7a-6a3ebb05aafe", "operator": { "type": "number", "operation": "gt" }, "leftValue": "={{ $json.score }}", "rightValue": 60 } ] } }, "typeVersion": 2 }, { "id": "notify-qualified-form-leads-in-slack-hunter", "name": "Validate Hunter result", "type": "n8n-nodes-base.code", "typeVersion": 2, "parameters": { "mode": "runOnceForEachItem", "jsCode": "const e=$('n8n Form Trigger').item.json[\"What's your business email?\"]; if(typeof $json.email!=='string'||typeof e!=='string'||$json.email.toLowerCase()!==e.trim().toLowerCase()||!['valid','invalid','accept_all','webmail','disposable','unknown'].includes($json.status))throw Error('Incomplete Hunter assessment');return {json:$json};" } }, { "id": "notify-qualified-form-leads-in-slack-fit", "name": "Validate customer fit", "type": "n8n-nodes-base.code", "typeVersion": 2, "parameters": { "mode": "runOnceForEachItem", "jsCode": "function main({body,email}) {\n const fit=body?.properties?.customer_fit,signals=fit?.top_signals_formated ?? fit?.top_signals_formatted;\n if(!fit||typeof fit.score!=='number'||!Number.isFinite(fit.score)||typeof signals!=='string')throw Error('MadKudu returned an incomplete customer fit');\n if(typeof body.email!=='string'||body.email.toLowerCase()!==email.toLowerCase())throw Error('MadKudu returned a different email');\n const optional=v=>{if(v==null)return '';if(typeof v!=='string')throw Error('Invalid lead detail');return v.replaceAll('&','&').replaceAll('<','<').replaceAll('>','>')};\n const p=body.properties,c=body.company?.properties??{},l=c.location??{};\n const text=`⭐ Got a hot lead for you ${optional(p.first_name)} ${optional(p.last_name)} from ${optional(c.name)} (${optional(c.domain)}) based out of ${optional(l.state)}, ${optional(l.country)}.\\n\\n\\n${optional(signals)}`;\n if(text.length>40000)throw Error('Slack message exceeds the size limit');\n return {score:fit.score,qualified:fit.score>60,text};\n}\n\nreturn {json:main({body:$json,email:$('Verify email with Hunter').item.json.email})};" } } ], "pinData": {}, "connections": { "n8n Form Trigger": { "main": [ [ { "node": "Verify email with Hunter", "type": "main", "index": 0 } ] ] }, "Score lead with MadKudu": { "main": [ [ { "node": "Validate customer fit", "type": "main", "index": 0 } ] ] }, "Verify email with Hunter": { "main": [ [ { "node": "Validate Hunter result", "type": "main", "index": 0 } ] ] }, "if customer fit score > 60": { "main": [ [ { "node": "Slack", "type": "main", "index": 0 } ], [ { "node": "Not interesting enough", "type": "main", "index": 0 } ] ] }, "Check if the email is valid": { "main": [ [ { "node": "Score lead with MadKudu", "type": "main", "index": 0 } ], [ { "node": "Email is not valid, do nothing", "type": "main", "index": 0 } ] ] }, "Validate Hunter result": { "main": [ [ { "node": "Check if the email is valid", "type": "main", "index": 0 } ] ] }, "Validate customer fit": { "main": [ [ { "node": "if customer fit score > 60", "type": "main", "index": 0 } ] ] } }, "name": "Notify Qualified Form Leads in Slack", "active": false }