Score and route leads with Clearbit, Mattermost and Trello
Lead Scoring Pipeline with Mattermost and Trello
This workflow automatically enriches incoming form-based leads, calculates a lead-score from multiple data points, and then routes high-value prospects to a Mattermost alert channel while adding all leads to Trello for further handling. It centralizes lead intelligence and streamlines sales team triage—no manual spreadsheet work required.
Pre-conditions/Requirements
Prerequisites n8n instance (self-hosted or n8n cloud) ScrapeGraphAI community node installed Active Trello and Mattermost workspaces Lead-capture form or webhook that delivers JSON payloads
Required Credentials Trello API Key & Token** – Access to the board/list where cards will be created Mattermost Access Token** – Permission to post messages in the target channel (Optional) Clearbit / Apollo / 3rd-party enrichment keys** – If you replace the sample enrichment HTTP requests
Specific Setup Requirements | Variable | Purpose | Example Value | |-------------------------|-------------------------------------------|------------------------| | MM_CHANNEL_ID | Mattermost channel to post high-score leads | leads-alerts | | TRELLO_BOARD_ID | Board where new cards are added | 62f1d… | | TRELLO_LIST_ID_HOT | Trello list for hot leads | Hot Deals | | TRELLO_LIST_ID_BACKLOG| Trello list for all other leads | New Leads | | LEAD_SCORE_THRESHOLD | Score above which a lead is considered hot| 70 |
How it works
This workflow grabs new leads at a defined interval, enriches each lead with external data, computes a custom score, and routes the lead: high-scorers trigger a Mattermost alert and are placed in a “Hot Deals” list, while the rest are stored in a “Backlog” list on Trello. All actions are fully automated and run unattended once configured.
Key Steps: Schedule Trigger**: Runs every 15 minutes to poll for new form submissions. HTTP Request – Fetch Leads**: Retrieves the latest unprocessed leads from your form backend or CRM API. Split In Batches**: Processes leads 20 at a time to respect API rate limits. HTTP Request – Enrich Lead**: Calls external enrichment (e.g., Clearbit) to append company and person data. Code – Calculate Score**: JavaScript that applies weightings to enriched attributes and outputs a numeric score. IF – Score Threshold**: Branches flow based on LEAD_SCORE_THRESHOLD. Mattermost Node**: Sends a rich-text message with lead details for high-score prospects. Trello Node (Hot List): Creates a Trello card in the “Hot Deals” list for high-value leads. Trello Node (Backlog): Creates a Trello card in the “New Leads” list for everyone else. Merge & Flag Processed**: Marks leads as processed to avoid re-processing in future runs.
Set up steps
Setup Time: 10–15 minutes
Import the Workflow: Download the JSON template and import it into n8n.
Create / Select Credentials:
Add your Trello API key & token under Trello API credentials.
Add your Mattermost personal access token under Mattermost API credentials.
Configure Environment Variables: Set MM_CHANNEL_ID, TRELLO_BOARD_ID, TRELLO_LIST_ID_HOT, TRELLO_LIST_ID_BACKLOG, and LEAD_SCORE_THRESHOLD in n8n → Settings → Environment.
Form Backend Endpoint: Update the first HTTP Request node with the correct URL and authentication for your form or CRM.
(Optional) Enrichment Provider: Replace the sample enrichment HTTP Request with your chosen provider’s endpoint and credentials.
Test Run: Execute the workflow manually with a sample payload to ensure Trello cards and Mattermost messages are produced.
Activate: Enable the workflow; it will now run on the defined schedule.
Node Descriptions
Core Workflow Nodes: Schedule Trigger** – Triggers workflow every 15 minutes. HTTP Request (Fetch Leads)** – Pulls unprocessed leads. SplitInBatches** – Limits processing to 20 leads per batch. HTTP Request (Enrich Lead)** – Adds firmographic & technographic data. Code (Calculate Score)** – JavaScript scoring algorithm; outputs score field. IF (Score ≥ Threshold)** – Determines routing path. Mattermost** – Sends formatted message with lead summary & score. Trello (Create Card)** – Adds lead as a card to the appropriate list. Merge (Flag Processed)** – Updates source system to mark lead as processed.
Data Flow:
Schedule Trigger → HTTP Request (Fetch Leads) → SplitInBatches
→ HTTP Request (Enrich Lead) → Code (Calculate Score) → IF
IF (Yes) → Mattermost → Trello (Hot List)
IF (No) → Trello (Backlog)
Both branches → Merge (Flag Processed)
Customization Examples
Adjust Scoring Weights // Code node: adjust weights to change scoring logic const weights = { industry: 15, companySize: 25, jobTitle: 20, intentSignals: 40 };
Dynamic Trello List Mapping // Use a Lookup table instead of IF node const mapping = { hot: 'TRELLO_LIST_ID_HOT', cold: 'TRELLO_LIST_ID_BACKLOG' }; items[0].json.listId = mapping[items[0].json.segment]; return items;
Data Output Format
The workflow outputs structured JSON data:
{ "leadId": "12345", "email": "jane.doe@example.com", "score": 82, "priority": "hot", "trelloCardUrl": "https://trello.com/c/abc123", "mattermostPostId": "78yzk9n8ppgkkp" }
Troubleshooting
Common Issues Trello authentication fails – Ensure the token has write access and that the API key & token pair belong to the same Trello account. Mattermost message not sent – Confirm the token can post in the target channel and that MM_CHANNEL_ID is correct.
Performance Tips Batch leads in groups of 20–50 to avoid enrichment API rate-limit errors. Cache enrichment responses for repeat domains to reduce API calls.
Pro Tips: Add a second IF node to send ultra-high (>90) scores directly to an account executive via email. Store raw enrichment responses in a database for future analytics. Use n8n’s built-in Execution Data Save to debug edge-cases without rerunning external API calls.
Related Templates
Automate Daily Keyword Research with Google Sheets, Suggest API & Custom Search
Who's it for This workflow is perfect for SEO specialists, marketers, bloggers, and content creators who want to automa...
USDT And TRC20 Wallet Tracker API Workflow for n8n
Overview This n8n workflow is specifically designed to monitor USDT TRC20 transactions within a specified wallet. It u...
Add product ideas to Google Sheets via a Slack
Use Case This workflow is a slight variation of a workflow we're using at n8n. In most companies, employees have a lot o...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments