{
  "schema": "lindy/v1",
  "name": "Closer Bot",
  "description": "Inbound demo-request closer: qualifies, books, recaps.",
  "trigger": {
    "type": "webhook",
    "expectedFields": ["name", "email", "company", "company_size", "use_case"]
  },
  "skills": [
    {
      "id": "qualify",
      "kind": "ai.reason",
      "label": "Qualify lead",
      "instructions": "Score the lead 1-10 on fit. Fit = >50 employees AND use_case mentions sales, support, or analytics. Return JSON {score, fit_tier: hot|warm|cold, reason}."
    },
    {
      "id": "book",
      "kind": "tool.calendly",
      "label": "Send Calendly link",
      "eventType": "30-min-demo",
      "to": "{{trigger.email}}",
      "when": "{{qualify.fit_tier}} != 'cold'"
    },
    {
      "id": "recap",
      "kind": "tool.gmail",
      "label": "Custom recap email",
      "subject": "Quick note before our demo",
      "body": "Hey {{trigger.name}}, looking forward to chatting on the demo. Based on what you shared about {{trigger.use_case}}, I'll come prepped with how teams at {{trigger.company_size}}-person companies typically roll this out. Drop any questions ahead of time and I'll address them on the call.",
      "to": "{{trigger.email}}",
      "when": "{{qualify.fit_tier}} != 'cold'"
    },
    {
      "id": "log",
      "kind": "tool.airtable",
      "label": "Log to CRM table",
      "base": "CRM",
      "table": "Leads",
      "fields": {
        "Name":        "{{trigger.name}}",
        "Email":       "{{trigger.email}}",
        "Company":     "{{trigger.company}}",
        "FitScore":    "{{qualify.score}}",
        "FitTier":     "{{qualify.fit_tier}}",
        "BookingSent": "{{book.success}}",
        "Source":      "closer-bot"
      }
    },
    {
      "id": "cold-nurture",
      "kind": "tool.gmail",
      "label": "Polite no-now reply for cold leads",
      "to": "{{trigger.email}}",
      "subject": "Saving you a meeting",
      "body": "Hey {{trigger.name}} — based on what you shared, our 30-min demo probably isn't the right next step right now. Here's a 5-min Loom of the platform that covers most of it: https://example.com/demo. Happy to chat once you're closer to a timeline.",
      "when": "{{qualify.fit_tier}} == 'cold'"
    }
  ]
}
