Example: real estate qualifier
Examples

Example: real estate qualifier

A complete five-question flow that captures city, budget, property type, and timeline — and scores the lead. Valid against the live schema.

This is the qualification flow that ships as a template. It’s a working JSON document — paste it into the Conversation Flows → New → JSON editor and it’ll save without errors.

What the call sounds like

Agent:   Hello! I'm calling from Acme Realty. Do you have a minute?
Caller:  Sure, what's this about?
Agent:   We're following up on your interest in property.
         Which city or area are you looking in?
Caller:  Whitefield, mostly.
Agent:   Got it — Whitefield. What's your budget?
Caller:  Around 90 lakhs.
Agent:   And are you looking at apartment, villa, or plot?
Caller:  Apartment.
Agent:   When are you looking to buy — immediately, in 3 months, or later?
Caller:  Probably in the next three months.
Agent:   Excellent. I have some apartments in Whitefield in your range.
         I'll send the details over WhatsApp. Have a great day!

Total time: ~38 seconds. Total cost: ~₹12.

The flow

{
  "name": "Real Estate Qualifier",
  "goal": "Capture city, budget, property type, and timeline; score the lead.",
  "rootNodeId": "greet",
  "attempts_default": 3,
  "systemPrompt": "You are calling on behalf of Acme Realty. Be warm, professional, and direct. Ask one question at a time. If the caller is hesitant, reassure them this will only take a minute.",
  "data_collection": [
    { "name": "city",          "type": "string",  "description": "Indian city or area the caller is interested in.",            "required": true },
    { "name": "budget_paise",  "type": "integer", "description": "Budget in Indian Rupees, captured as paise.",                  "required": true },
    { "name": "property_type", "type": "string",  "description": "One of: apartment, villa, plot.",                              "required": true },
    { "name": "timeline",      "type": "string",  "description": "One of: immediate, 3_months, 6_months, 1_year.",               "required": true },
    { "name": "lead_score",    "type": "string",  "description": "Engine-assigned lead score (hot | warm | cold)." }
  ],
  "interrupts": [
    {
      "id": "wants_human",
      "intent": "Caller asks to speak to a person",
      "examples": ["transfer me", "I want to talk to someone"],
      "handler": "transfer_close",
      "kind": "context"
    },
    {
      "id": "dnc",
      "intent": "Caller asks to be removed from the list",
      "examples": ["take me off your list", "do not call"],
      "handler": "dnc_close",
      "kind": "safety"
    }
  ],
  "nodes": {
    "greet": {
      "type": "speak",
      "id": "greet",
      "speech": { "mode": "literal", "text": "Hello! I'm calling from Acme Realty. Do you have a minute?" },
      "next": "ask_city"
    },

    "ask_city": {
      "type": "goal",
      "id": "ask_city",
      "goal": "Identify which city or area the caller is interested in.",
      "prompt": { "mode": "literal", "text": "We're following up on your interest in property. Which area are you looking in?" },
      "intents": [
        {
          "id": "states_city",
          "intent": "Caller names a city or area",
          "extracts": { "slot": "city", "format": "string", "normalize": "title_case" },
          "target": "ask_budget"
        },
        {
          "id": "undecided",
          "intent": "Caller is undecided about the city",
          "target": "city_options"
        }
      ],
      "completion": { "kind": "slot_filled", "slot": "city" },
      "on_exhausted": "polite_close"
    },

    "city_options": {
      "type": "speak",
      "id": "city_options",
      "speech": { "mode": "literal", "text": "We have inventory in Bangalore, Mumbai, and Pune. Any of those?" },
      "next": "ask_city"
    },

    "ask_budget": {
      "type": "goal",
      "id": "ask_budget",
      "goal": "Capture budget as a number in Rupees.",
      "prompt": { "mode": "literal", "text": "Got it — {{slots.city}}. What's your budget?" },
      "intents": [
        {
          "id": "states_budget",
          "intent": "Caller states a budget number",
          "extracts": { "slot": "budget_paise", "format": "currency_inr" },
          "target": "ask_property_type"
        }
      ],
      "completion": { "kind": "slot_filled", "slot": "budget_paise" },
      "validate": {
        "expr": "slots.budget_paise >= 1000000",
        "repair_prompt": { "mode": "literal", "text": "Just to confirm — what's your full budget for this purchase?" },
        "max_repair_attempts": 2
      },
      "on_exhausted": "polite_close"
    },

    "ask_property_type": {
      "type": "goal",
      "id": "ask_property_type",
      "goal": "Determine apartment vs villa vs plot.",
      "prompt": { "mode": "literal", "text": "And are you looking at an apartment, villa, or plot?" },
      "intents": [
        {
          "id": "apartment",
          "intent": "Caller wants an apartment",
          "extracts": { "slot": "property_type", "format": "enum", "enum": ["apartment", "villa", "plot"] },
          "target": "ask_timeline"
        },
        {
          "id": "villa",
          "intent": "Caller wants a villa",
          "extracts": { "slot": "property_type", "format": "enum", "enum": ["apartment", "villa", "plot"] },
          "target": "ask_timeline"
        },
        {
          "id": "plot",
          "intent": "Caller wants a plot",
          "extracts": { "slot": "property_type", "format": "enum", "enum": ["apartment", "villa", "plot"] },
          "target": "ask_timeline"
        }
      ],
      "completion": { "kind": "slot_filled", "slot": "property_type" },
      "on_exhausted": "polite_close"
    },

    "ask_timeline": {
      "type": "goal",
      "id": "ask_timeline",
      "goal": "Capture purchase timeline.",
      "prompt": { "mode": "literal", "text": "When are you looking to buy — immediately, in three months, six months, or a year?" },
      "intents": [
        {
          "id": "timeline_any",
          "intent": "Caller states a timeline",
          "extracts": { "slot": "timeline", "format": "enum", "enum": ["immediate", "3_months", "6_months", "1_year"] },
          "target": "score"
        }
      ],
      "completion": { "kind": "slot_filled", "slot": "timeline" },
      "on_exhausted": "polite_close"
    },

    "score": {
      "type": "decide",
      "id": "score",
      "description": "Lead-score routing.",
      "branches": [
        { "id": "hot",  "expr": "slots.timeline === 'immediate' && slots.budget_paise >= 50000000", "target": "set_hot" },
        { "id": "warm", "expr": "slots.timeline === '3_months'",                                    "target": "set_warm" },
        { "id": "cold", "expr": "true",                                                              "target": "set_cold" }
      ]
    },

    "set_hot":  { "type": "speak", "id": "set_hot",  "speech": { "mode": "literal", "text": "Excellent. I have some {{slots.property_type}}s in {{slots.city}} in your range. I'll send details on WhatsApp shortly." }, "next": "end_call", "writes": [{ "op": "set", "slot": "lead_score", "value": "hot" }] },
    "set_warm": { "type": "speak", "id": "set_warm", "speech": { "mode": "literal", "text": "Great. We'll share matching options and follow up next week." },                                                          "next": "end_call", "writes": [{ "op": "set", "slot": "lead_score", "value": "warm" }] },
    "set_cold": { "type": "speak", "id": "set_cold", "speech": { "mode": "literal", "text": "Thanks — I'll keep you on our list and reach out closer to your timeline." },                                              "next": "end_call", "writes": [{ "op": "set", "slot": "lead_score", "value": "cold" }] },

    "polite_close":   { "type": "speak", "id": "polite_close",   "speech": { "mode": "literal", "text": "No problem. Reach out when you're ready. Have a great day!" },                              "next": "end_call" },
    "dnc_close":      { "type": "speak", "id": "dnc_close",      "speech": { "mode": "literal", "text": "Understood — I'll remove you from our list. Apologies for the call." },                     "next": "end_call" },
    "transfer_close": { "type": "speak", "id": "transfer_close", "speech": { "mode": "literal", "text": "Of course. I'll have someone from our team call you shortly." },                            "next": "end_call" },

    "end_call": { "type": "end", "id": "end_call", "reason": "qualified" }
  },
  "on_call_end": {
    "fetch": {
      "method": "POST",
      "url": "https://crm.example.com/webhook/leads",
      "body": {
        "city": "{{slots.city}}",
        "budget_paise": "{{slots.budget_paise}}",
        "property_type": "{{slots.property_type}}",
        "timeline": "{{slots.timeline}}",
        "lead_score": "{{slots.lead_score}}"
      }
    }
  }
}

What to notice

  • nodes is an object, not an array. Each node id is a key; the value’s id field must match the key.
  • Templating — {{slots.city}} lets later nodes reference earlier captures, making the agent sound like it’s listening.
  • Validation + repair — the budget node rejects values below ₹10,000 and asks the question again with a different phrasing.
  • Interrupts — DNC and transfer requests work from any node. The DNC interrupt is kind: "safety", so it must terminate via an end node (not a return).
  • Decide for scoring — keep cognition separate from speech. The decide node routes; the set_* speak nodes apply the lead-score writes and speak the closing line.
  • on_call_end.fetch — fires once on the final hangup with the captured slots in the body.