{
  "schema_version": "1.0.0",
  "id": "chat-transcript-qualify",
  "title": "Qualify a sales chat and log it in HubSpot",
  "category": "lead-gen-crm",
  "difficulty": "advanced",
  "featured": false,
  "description": "Read a new Intercom sales conversation with AI, pull out company, role, budget, and timeline, score it, and save a qualified contact in HubSpot.",
  "tags": [
    "chat",
    "intercom",
    "hubspot",
    "ai-extraction",
    "lead-scoring"
  ],
  "apps": [
    "Intercom",
    "AI by Zapier",
    "Filter by Zapier",
    "Code by Zapier",
    "HubSpot",
    "Slack"
  ],
  "plan": {
    "minimum": "Professional",
    "reasons": [
      "multi-step Zap: 5 steps after the trigger",
      "Filter by Zapier",
      "AI by Zapier"
    ]
  },
  "tasks": {
    "typical": 4,
    "max": 4
  },
  "trigger": {
    "app": "Intercom",
    "event": "New Conversation",
    "kind": "polling",
    "title": "New sales conversation",
    "why": "Fires for each new conversation assigned to the Sales team inbox.",
    "config": {
      "Team": "Sales"
    },
    "outputs": [
      "conversation_id",
      "created_at",
      "contact_name",
      "contact_email",
      "first_message",
      "transcript",
      "conversation_url"
    ],
    "sample": "sample-trigger.json"
  },
  "steps": [
    {
      "key": "qualify",
      "kind": "ai",
      "app": "AI by Zapier",
      "event": "Analyze and Return Data",
      "title": "Pull qualifying details from the chat",
      "why": "Turns a messy transcript into the fields the score needs. The prompt says to leave a field empty rather than guess.",
      "fields": {
        "Model": "Default (fast)",
        "Instructions": "You are a sales assistant reading a website chat transcript. Return: company, job_title, company_size (a number or range like 11-50, empty if not said), budget (as written, empty if not said), timeline (as written), need_summary (one sentence in plain words), and is_sales_inquiry (\"yes\" if they want to buy or evaluate, \"no\" for support or job applications). Only use what the visitor actually said.",
        "Input data": "Visitor: {{trigger.contact_name}} <{{trigger.contact_email}}>\n\n{{trigger.transcript}}",
        "Output fields": "company, job_title, company_size, budget, timeline, need_summary, is_sales_inquiry"
      },
      "outputs": [
        "company",
        "job_title",
        "company_size",
        "budget",
        "timeline",
        "need_summary",
        "is_sales_inquiry"
      ]
    },
    {
      "key": "sales",
      "kind": "filter",
      "app": "Filter by Zapier",
      "event": "Only continue if...",
      "title": "Only real sales conversations",
      "why": "Support questions and job applications that land in the sales inbox stop here. Most conversations in a sales inbox are sales.",
      "conditions": [
        [
          {
            "field": "{{qualify.is_sales_inquiry}}",
            "operator": "(Text) Exactly matches",
            "value": "yes"
          }
        ]
      ],
      "usually": true
    },
    {
      "key": "score",
      "kind": "code",
      "app": "Code by Zapier",
      "event": "Run JavaScript",
      "title": "Score the chat lead",
      "why": "Same scoring rules as the form templates, fed from the chat instead of form fields.",
      "code": {
        "language": "javascript",
        "module": "score-lead",
        "file": "code/score-lead.js"
      },
      "input_data": {
        "email": "{{trigger.contact_email}}",
        "company": "{{qualify.company}}",
        "job_title": "{{qualify.job_title}}",
        "company_size": "{{qualify.company_size}}",
        "budget": "{{qualify.budget}}",
        "timeline": "{{qualify.timeline}}",
        "message": "{{qualify.need_summary}}"
      },
      "outputs": [
        "score",
        "tier",
        "reasons",
        "is_work_email"
      ]
    },
    {
      "key": "contact",
      "kind": "action",
      "app": "HubSpot",
      "event": "Create or Update Contact",
      "title": "Save the qualified contact",
      "why": "Everything the chat revealed is on the contact before the first call.",
      "fields": {
        "Email": "{{trigger.contact_email}}",
        "First Name": "{{trigger.contact_name}}",
        "Company Name": "{{qualify.company}}",
        "Job Title": "{{qualify.job_title}}",
        "Lead score (custom property lead_score)": "{{score.score}}",
        "Lead tier (custom property lead_tier)": "{{score.tier}}",
        "Chat summary (custom property)": "{{qualify.need_summary}}",
        "Chat link (custom property)": "{{trigger.conversation_url}}"
      },
      "outputs": [
        "id",
        "profile_url"
      ]
    },
    {
      "key": "post",
      "kind": "action",
      "app": "Slack",
      "event": "Send Channel Message",
      "title": "Post the summary to sales",
      "why": "The rep reads one line instead of the whole transcript.",
      "fields": {
        "Channel": "#sales-chats",
        "Message Text": "{{score.tier}} chat lead ({{score.score}}): {{trigger.contact_name}}, {{qualify.job_title}} at {{qualify.company}}. \"{{qualify.need_summary}}\" Budget {{qualify.budget}}, timeline {{qualify.timeline}}. {{contact.profile_url}}",
        "Send as a bot?": "Yes",
        "Bot Name": "Zap alerts",
        "Include a link to this Zap?": "No"
      },
      "outputs": [
        "ts",
        "permalink"
      ]
    }
  ]
}
