Smart lead distribution system for CRM based on n8n
Objective:
Create a fully autonomous system for distributing incoming leads between two different CRM systems (campaigns) based on complex business rules. Key requirements included: dynamic management of daily limits for each campaign, processing leads exclusively during designated working hours, sequential sending with random delays, and developing a reliable deduplication system to prevent duplicate contacts.
My Contribution:
The project began with a challenge: the existing lead processing was inefficient, did not support quota distribution, and resulted in sending duplicates, which lowered the quality of managers' work.
My contribution involved a complete rethinking and development "from scratch" of a new, reliable architecture on self-hosted n8n. I transitioned from simple linear logic to a more advanced "batch processing" architecture, significantly improving the system's performance and reliability.
Solution:
The final solution is a single, optimized workflow in n8n, at the heart of which is a custom Code node in JavaScript. This "brain" of the system performs all analytical work in one pass:
Loads context: Makes a single efficient API request to Google Sheets to retrieve all historical information, avoiding API limit breaches.
Performs deduplication: Identifies and filters out new leads whose emails have already been successfully processed.
Distributes by limits: Dynamically assigns each unique lead to a campaign (Campaign A or Campaign B), tracking daily quotas.
After the analytical block, a loop (Loop Over Items) is activated, ensuring sequential, individual processing of each lead with a random delay before the final sending via HTTP Request.
Result:
Successfully developed and implemented an autonomous system that fully automated the lead distribution process. The client received a reliable workflow that operates 24/7 and guarantees:
- Clear adherence to daily quotas for each campaign.
- Complete elimination of duplicates.
- Optimal load on external service APIs.
#n8n #JavaScript #WorkflowAutomation #BusinessLogic #APIIntegration #GoogleSheets #CRM #Automation #NoCode #LeadDistribution #Debugging #WorkflowArchitecture #BusinessAutomation #Automation
Create a fully autonomous system for distributing incoming leads between two different CRM systems (campaigns) based on complex business rules. Key requirements included: dynamic management of daily limits for each campaign, processing leads exclusively during designated working hours, sequential sending with random delays, and developing a reliable deduplication system to prevent duplicate contacts.
My Contribution:
The project began with a challenge: the existing lead processing was inefficient, did not support quota distribution, and resulted in sending duplicates, which lowered the quality of managers' work.
My contribution involved a complete rethinking and development "from scratch" of a new, reliable architecture on self-hosted n8n. I transitioned from simple linear logic to a more advanced "batch processing" architecture, significantly improving the system's performance and reliability.
Solution:
The final solution is a single, optimized workflow in n8n, at the heart of which is a custom Code node in JavaScript. This "brain" of the system performs all analytical work in one pass:
Loads context: Makes a single efficient API request to Google Sheets to retrieve all historical information, avoiding API limit breaches.
Performs deduplication: Identifies and filters out new leads whose emails have already been successfully processed.
Distributes by limits: Dynamically assigns each unique lead to a campaign (Campaign A or Campaign B), tracking daily quotas.
After the analytical block, a loop (Loop Over Items) is activated, ensuring sequential, individual processing of each lead with a random delay before the final sending via HTTP Request.
Result:
Successfully developed and implemented an autonomous system that fully automated the lead distribution process. The client received a reliable workflow that operates 24/7 and guarantees:
- Clear adherence to daily quotas for each campaign.
- Complete elimination of duplicates.
- Optimal load on external service APIs.
#n8n #JavaScript #WorkflowAutomation #BusinessLogic #APIIntegration #GoogleSheets #CRM #Automation #NoCode #LeadDistribution #Debugging #WorkflowArchitecture #BusinessAutomation #Automation