Skip to content

Lead qualification

Leads arrive from two places: a website agent that chats with visitors, and your own web forms. Score each lead the same way, record it in your CRM, give hot leads to a salesperson within the hour, and send warm leads a follow-up two days later.

  1. Two triggers with the same input fields: name, phone (phone), email (email), company, teamSize (number), budget (number), timeline (choice: now, quarter, later), source.

    • Started by an agent: agents that may start it: your website agent. The agent: Immediately, because hot leads wait for a person.
    • API / webhook: for web forms. Duplicate key email.
  2. Compute: formula min(input.teamSize, 500) / 5 + min(input.budget, 1000000) / 20000, store as score, decimal places 0. More results: total = score + (30 if input.timeline == "now" else (10 if input.timeline == "quarter" else 0)).

  3. Decision (rules): outcomes hot, warm, cold. Rules:

    • total >= 120 → hot
    • total >= 50 → warm
    • default → cold

    Test cases: a sample with total 150 expects hot; a sample with total 10 expects cold.

  4. MCP tool (all three outcomes lead here, each through a Data mapper that sets rating to "hot", "warm" or "cold"): your CRM, tool upsert_lead, inputs from input.* plus score = total, rating = rating. Store result as crm. Retries 3.

  5. Write context: scope customer, whose context input.email, values leadRating = rating, crmLeadId = crm.leadId.

  6. Condition: rating == "hot".

    • true: go to step 7.
    • false: go to step 9.
  7. Human task: role Sales, instructions Call {{ input.name }} at {{ input.company }} ({{ input.phone }}). Score {{ total }}., SLA 1h, priority high, outcomes qualified, not_interested, no_answer.

  8. Three End steps, one per task outcome, with outcomes qualified, not_interested and no_answer, and output leadId = crm.leadId.

  9. Condition: rating == "warm".

    • true: Wait 2d, only continue within Mon-Fri 10:00-18:00, then MCP tool send_email_template with template = "warm_follow_up", then End outcome nurtured.
    • false: End outcome cold.

Error paths: connect the CRM step’s On error port to an Error handler that escalates to Sales operations and continues. Connect the Human task’s On error port (SLA passed) to an Escalation for Sales managers.

From a web form, through the API:

{
"input": {
"name": "Meera Iyer",
"phone": "+919800000000",
"email": "meera@example.com",
"company": "Example Logistics",
"teamSize": 120,
"budget": 600000,
"timeline": "now",
"source": "pricing-page"
}
}

From the website agent, the same fields are the tool’s arguments. The agent fills them from the conversation and asks for any required field it is missing.

  • Two triggers feed the same steps, so every lead is scored the same way, whoever captured it.
  • Compute turns the answers into a number. The Decision turns the number into a rating, and its test cases stop a careless rule change from being published.
  • The MCP tool creates or updates the lead in your CRM.
  • Write context remembers the rating, so later runs for the same email can read it with Read context.
  • The Human task gives a salesperson one hour, with three clear outcomes. The run ends with the one they choose, so analytics show how hot leads convert.
  • The agent trigger responds Immediately: the website agent gets the run id at once and tells the visitor the team will be in touch.
  1. In Test workflow, start from the API trigger with the payload above and Minutes as seconds. Point the MCP tools at sandbox servers.
  2. The lead rates hot and a Human task appears under Waiting on you. Choose qualified.
  3. Try a lead with teamSize: 10, budget: 50000, timeline: "quarter". It rates warm and the follow-up runs after the wait.
  4. To test the website agent too, add the workflow and the agent to a use case and use Test use case.
  • Tell the visitor their rating: move the scoring into a separate workflow whose agent trigger responds On completion and ends straight after the Decision, then start this workflow from it as a Sub-workflow with Wait for it off.
  • Several products: replace the Condition with a Decision whose outcomes are product teams, each with its own Human task role.
  • Ask a model to summarise (beta): add a Task agent that writes a short brief for the salesperson. Test it end to end in the test window first.