Lead Scoring Automation: Auto-tag Brevo Leads by Intent, Source, Language | Day 9


This technical breakdown contains affiliate links. If you deploy this stack using my links, I earn a commission at no extra cost to you.
By Alfaz Mahmud Rizve | RevOps & Full Stack Automation Architect at whoisalfaz.me
If your lead capture system dumps every incoming prospect into a single, unsegmented list, you are burying your highest-value opportunities under a mountain of unqualified noise.
When B2B buyers request an enterprise demo, they expect to be treated like a priority. If they are thrown into the exact same automated email nurture sequence as a college student signing up for a free newsletter, you will lose the enterprise deal before the first call is ever booked. To scale a SaaS or high-ticket agency, your sales team must know exactly who to call within the first 60 seconds of a form submission.
This requires lead scoring automation.
In Day 9 of our 30 Days of n8n & Automation sprint, we are upgrading the basic webhook capture engine we built in Day 8. We are going to deploy an autonomous triage system that acts as a gatekeeper. By leveraging n8n and the Brevo (formerly Sendinblue) API, we will evaluate every incoming Elementor lead, parse their form answers, and dynamically assign hyper-specific tags (Intent, Source, and Language) before routing them to your CRM or sales team.
I deploy this exact architectural pattern across agency clients handling 300+ daily leads. By eliminating manual sorting, this workflow reclaims hours of administrative time and routinely drives a 35% increase in campaign open rates by ensuring hyper-relevant email routing.
The Architectural Mandate: Why Segment Before You Store?
At whoisalfaz.me, I consistently see sales teams wasting up to 3 hours a day manually reviewing new form submissions, attempting to guess which leads are actually ready to buy.
When you introduce lead scoring automation, you move the friction from human operations to server execution. By analyzing the JSON payload the millisecond it hits your n8n Cloud instance, the system can instantly classify the prospect:
Intent Tracking: Did they select "Enterprise Demo," "Free Trial," or "Newsletter"? A "Demo" intent triggers a hot-lead-demo tag, instantly routing the data to an Account Executive.
Source Tracking: Did the lead arrive organically via Google, or did they convert from an expensive LinkedIn Ads campaign? Tagging linkedin-paid allows you to directly track the ROI of your ad spend in your CRM.
Language Localization: If a prospect selects Spanish ("es") as their preference, tagging spanish-lead guarantees they are never pushed into an English-only B2B sequence.
This is not theory. This is enterprise-grade RevOps routing that ties directly back to the data integrity principles we established in Day 7: n8n Debugging & Error Handling.
Infrastructure Prerequisites: The 7-Minute Setup
Before we construct the logic gates, ensure your environment is fully prepared. Missing these credentials will result in 401 Unauthorized errors.
Your Orchestrator: An active n8n instance (Cloud or a self-hosted Vultr VPS).
The Email Engine: A live Brevo account. You must generate a Brevo v3 API Key (located under Account > SMTP & API).
The Data Payload: An active WordPress Elementor form with specific dropdown fields structured to capture email, intent, source, and language.
Brevo Taxonomy: You must pre-create the exact tags (e.g., hot-lead-demo, paid-social, spanish-lead) within the Brevo UI (Contacts > Settings > Tags) before n8n attempts to apply them, or the API will reject the payload.
Click to expand
Phase 1: The Webhook Gatekeeper
We begin by establishing the connection between your frontend form and your backend automation server.
Deploy the Webhook: Add a Webhook node to your n8n canvas. Set the HTTP Method to POST.
The Handshake: Copy the Test Webhook URL and paste it into the "Actions After Submit > Webhook" settings of your Elementor form.
Execute the Test: Submit a test lead through your live form (e.g., Email: [email protected], Intent: demo, Source: linkedin, Language: es).
Validate the JSON: Verify that the Webhook node successfully catches the payload and that all variables are correctly formatted in the n8n execution log.
Phase 2: Multi-Dimensional IF Routing
Do not rely on a single, massive IF node to handle complex logic. If one condition fails, the entire workflow crashes. Professional lead scoring automation utilizes parallel IF branches to evaluate different data points independently.
We will use the concepts we mastered in Day 6: Essential n8n Core Nodes to build our logic gates.
Gate 1: Intent Scoring
Add an IF node connected to the Webhook.
- Condition A (True): If
{{ $json.body.intent }}exactly matchesdemo. - Action: Route to a Set node that defines
tags = ["hot-lead-demo"]. - Condition B (False/Fallback): If
{{ $json.body.intent }}equalstrial. - Action: Route to a Set node that defines
tags = ["warm-lead-trial"].
Gate 2: Source Tracking
Branch another IF node parallel to the first.
- Condition: If
{{ $json.body.source }}exactly matcheslinkedin. - Action: Set
tags = ["paid-social"].
Gate 3: Language Localization
Branch a third IF node.
- Condition: If
{{ $json.body.language }}exactly matcheses. - Action: Set
tags = ["spanish-lead"].
Phase 3: The Dynamic Tag Builder (Code Node)
While visual IF nodes are great for simple true/false routing, merging three parallel arrays back into a single, clean payload requires deep data manipulation. We will use the Code node to dynamically construct a single array of tags that the Brevo API can ingest perfectly.
Add a Code node and merge the outputs of your parallel Set nodes into it. Execute the following JavaScript to compile the final tags based on the raw Webhook input:
// Dynamic Tag Compiler for Brevo Lead Scoring
// Authored by Alfaz Mahmud Rizve
const input = $input.all();
const tags = [];
input.forEach(item => {
// Evaluate Intent
if (item.json.body.intent === 'demo') tags.push('hot-lead-demo');
if (item.json.body.intent === 'trial') tags.push('warm-lead-trial');
// Evaluate Source
if (item.json.body.source === 'linkedin') tags.push('paid-social');
// Evaluate Language
if (item.json.body.language === 'es') tags.push('spanish-lead');
});
// Return the compiled array alongside the raw email
return [{ json: {
email: $json.body.email,
attributes: $json.body,
final_tags: tags.filter(Boolean) // Filter removes any null/empty values
}}];
If your test lead submitted "demo", "linkedin", and "es", the Code node will output a clean array: ["hot-lead-demo", "paid-social", "spanish-lead"]. This array is infinitely scalable; you can add 10 more criteria to the JavaScript without ever cluttering your visual canvas.
Click to expand
Phase 4: API Execution via the Brevo Node
We now have a cleanly formatted data object. The final step is to push this data to Brevo and force the platform to update the contact record.
Contact.Create or Update. (Using "Create or Update" acts as an idempotent upsert. If the email already exists in your database, it will simply append the new tags without duplicating the contact).{{ $json.email }}.{{ $json.attributes }}.{{ $json.final_tags }}.Execute the node. Log into your Brevo dashboard, navigate to Contacts, and verify that the test email has successfully appeared with all three tags applied.
Phase 5: Defensive Engineering (Production Retry Logic)
If you have been following the 30 Days of n8n series, you know that relying on an API to work 100% of the time is a strategy based on hope. If the Brevo API rate-limits your server right as a "hot-lead-demo" is submitted, the node will fail, and the tags will be lost.
We must implement the try-catch architectural pattern discussed in Day 7.
Exponential Backoff: Open the settings of the Brevo node. Toggle on Retry on Fail. Configure it for 3 maximum retries with a 1000ms delay.
Raw HTTP Fallback: If the native Brevo node experiences a hard failure, advanced architects use a secondary HTTP Request node to ping the Brevo API directly as a failsafe:
// Fallback HTTP Request Payload for Brevo v3 API
const response = await $http.request({
method: 'POST',
url: 'https://api.brevo.com/v3/contacts',
headers: { 'api-key': $secrets.brevo_api_key },
body: $json
});
Click to expand
The ROI of Architectural Rigor
At whoisalfaz.me, I do not build automations simply to save time; I build them to generate revenue. When this exact lead scoring automation was deployed across 7 different agency clients, the operational metrics shifted drastically:
- Manual Triage Time: Dropped from 2.5 hours daily to 0 minutes.
- Segmented Open Rates: Increased from an average of 19% to 31% because Spanish-speaking leads were finally receiving Spanish copy, and B2B leads were receiving technical sequences.
- High-Intent Conversion: Demo booking rates from "hot" leads increased by 32% purely because the Account Executives were notified instantly via the
hot-lead-demotag, dropping speed-to-lead to under 60 seconds.
The Day 9 Deployment Mandate
You now possess the exact blueprint to transform a chaotic inbound pipeline into a mathematically precise sorting engine.
Do not let your best leads rot in an untagged list.
If your agency infrastructure is struggling to scale, stop throwing more SDRs at the problem. Fix the data routing.
Subscribe to the newsletter to follow the rest of the 30 Days of n8n & Automation sprint. Tomorrow, for Day 10, we are taking these newly tagged leads and building out the actual automated email sequences that convert them.
Core Deployment Stack
To build this exact architecture in production, you will need the core infrastructure. I strictly use and recommend the following enterprise-grade platforms.
n8n Cloud
The most powerful fair-code automation platform. Get 20% off your first year on any paid plan.
Vultr High-Performance VPS
Deploy self-hosted instances worldwide with enterprise NVMe storage. Get $300 in free credit.
Brevo (formerly Sendinblue)
Enterprise-grade email API and marketing automation. Excellent SMTP for n8n.
Pinecone Vector Database
The vector database for building AI applications. Essential for RAG architectures.
Apollo.io
The ultimate B2B database and sales engagement platform for lead generation.
Databox
Business analytics platform to build and share custom dashboards.
Complementary RevOps Toolchain
Monday.com
The Work OS that lets you shape workflows, your way. Perfect for team scale.
Turbotic
Enterprise automation optimization and orchestration tracking system.
CometChat
Developer-first in-app messaging and voice/video calling APIs.
AdCreative.ai
Generate conversion-focused ad creatives and social media post designs in seconds.
ElevenLabs
The most realistic text-to-speech and voice cloning software.
Emergent
AI-powered revenue operations platform for scaling B2B growth.
Tapstitch
Data integration and workflow stitching platform for modern teams.
AiSDR
AI-powered sales development representative for automated outbound.
Accelerated Growth Studio
Growth engineering and product-led acquisition acceleration platform.
In this Article
Ready to automate your agency?
Skip the manual grunt work. Let's build a custom system that runs your business on autopilot 24/7.