Skip to content
SlashClone
Made by@revopslab

Lead routing rules

@revopslab/lead-routing-rules

Design, test, and apply lead routing rules outside your CRM. Write ordered rules in a JSON file (existing-account match, partner, segment, region, junk filters), prove them with rule tests, then route a leads CSV with weighted round robin, out-of-office skips, and a fallback queue. Works with HubSpot, Salesforce, or any CSV.

SkillRevOpsv1.0.0 (latest)Tested
Activity
New: be the first to try it
  1. 1{
  2. 2 "pools": {
  3. 3 "enterprise": { "members": ["Rep A", "Rep B"] },
  4. 4 "mid-market": { "members": ["Rep C", "Rep D"], "weights": { "Rep C": 2 } },
  5. 5 "smb": { "members": ["Rep E", "Rep F", "Rep G"] }
  6. 6 },
  7. 7 "out_of_office": ["Rep G"],
  8. 8 "account_match": { "rule_id": "existing-account" },
  9. 9 "rules": [
  10. 10 { "id": "spam-or-test", "when_any": [{ "field": "email", "op": "contains", "value": ["test@", "example.com"] }, { "field": "company", "op": "in", "value": ["test", "asdf", "n/a"] }], "assign": { "queue": "discard-review" }, "reason": "Looks like a test or junk submission" },
  11. 11 { "id": "free-email-students", "when": [{ "field": "is_free_email", "op": "exists" }, { "field": "employees", "op": "missing" }], "assign": { "queue": "nurture" }, "reason": "Personal email and no company size" },
  12. 12 { "id": "partner-referral", "when": [{ "field": "lead_source", "op": "==", "value": "Partner referral" }], "assign": { "owner": "Partner Manager" }, "reason": "Partner-sourced leads go to the partner manager" },
  13. 13 { "id": "enterprise", "when": [{ "field": "employees", "op": ">=", "value": 1000 }], "assign": { "pool": "enterprise" }, "reason": "1,000+ employees" },
  14. 14 { "id": "mid-market", "when": [{ "field": "employees", "op": ">=", "value": 200 }], "assign": { "pool": "mid-market" }, "reason": "200 to 999 employees" },
  15. 15 { "id": "smb", "when": [{ "field": "employees", "op": ">=", "value": 1 }], "assign": { "pool": "smb" }, "reason": "Under 200 employees" }
  16. 16 ],
  17. 17 "fallback": { "queue": "routing-review" },
  18. 18 "tests": [
  19. 19 { "name": "big company goes to enterprise", "lead": { "email": "ops@bigco.test.org", "company": "BigCo", "employees": "5,000" }, "expect_rule": "enterprise", "expect_to": "enterprise" },
  20. 20 { "name": "employee range uses the low end", "lead": { "email": "a@mid.io", "company": "Mid", "employees": "201-500" }, "expect_rule": "mid-market" },
  21. 21 { "name": "gmail with no size is nurture", "lead": { "email": "someone@gmail.com", "company": "Self" }, "expect_rule": "free-email-students", "expect_to": "nurture" },
  22. 22 { "name": "partner beats size", "lead": { "email": "x@huge.io", "employees": "20000", "lead_source": "Partner referral" }, "expect_rule": "partner-referral" },
  23. 23 { "name": "no size and work email falls back", "lead": { "email": "x@unknown.io", "company": "Unknown" }, "expect_rule": "fallback", "expect_to": "routing-review" }
  24. 24 ]