Back to Library
Tech Deep DiveEngineering

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

Alfaz
Alfaz Mahmud Rizve
@whoisalfaz
March 4, 2026
8 min read
Lead Scoring Automation: Auto-tag New Leads in Brevo Based on Form Answers (Intent, Source, Language) – 30 Days of n8n & Automation – 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.

n8n Brevo setup for lead scoring automation by Alfaz Mahmud Rizve, prerequisites checklist visual for SaaS/agencies at whoisalfaz.me.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 matches demo.
  • Action: Route to a Set node that defines tags = ["hot-lead-demo"].
  • Condition B (False/Fallback): If {{ $json.body.intent }} equals trial.
  • 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 matches linkedin.
  • Action: Set tags = ["paid-social"].

Gate 3: Language Localization
Branch a third IF node.

  • Condition: If {{ $json.body.language }} exactly matches es.
  • 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:

JSON Payload
// 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.

n8n lead scoring automation workflow with IF nodes and Code tag builder by Alfaz Mahmud Rizve for Brevo segmentation at whoisalfaz.me.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.

1
Add the native Brevo node to the canvas.
2
Authenticate using the API key you generated earlier.
3
Resource: Set to Contact.
4
Operation: Set to 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).
5
Email: Map to your Code node output: {{ $json.email }}.
6
Attributes: Map the raw form data: {{ $json.attributes }}.
7
Tags: Map your compiled array: {{ $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:

JSON Payload
// 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
});

n8n Brevo lead scoring automation execution with error handling by Alfaz Mahmud Rizve for agencies/SaaS at whoisalfaz.meClick 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-demo tag, 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.

1
Deploy your webhook.
2
Create your tags in Brevo.
3
Configure your multi-dimensional IF logic.
4
Execute the Code node payload.

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.

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.