typed/recipes
Recipes / Routing and triage

Qualify an inbound lead in one call

ChoiceScoreNoulStarter

A form fill or voicemail transcript comes in. Ask the service type, the urgency, and whether it's in your service area, all in one call. Hot leads ring a phone; the rest go to a nurture sequence.

const { answers } = await jev({
  state: leadText,
  questions: {
    service: { type: "choice", instructions: "Which service is this lead asking for?",
      criteria: { plumbing: "Pipes, drains, water heaters", hvac: "Heating or cooling",
                  electrical: "Wiring, panels, outlets", other: "None of these" } },
    urgency: { type: "score", instructions: "How urgent is the job? 2 = someday, 10 = emergency today",
      min: 2, max: 10 },
    in_area: { type: "noul", instructions: "Is the job location inside Riverside or San Diego County?" },
  },
});

if (answers.in_area.noul > 0.7 && answers.urgency.score >= 8) callNow(lead);
else addToNurture(lead, answers.service.choice);
API field names follow each model's launch documentation. Check TypeSafe's docs and the Laya README before shipping, since both are changing weekly.

Notes

  • Choice with an explicit “other” option catches leads you don't serve.
  • Laya handles this well once fine-tuned on a few hundred of your own past leads, and the data stays on your server.

Continue learning