{
  "schema_version": "1.0.0",
  "id": "support-kb-answer-agent",
  "title": "Answer a Help Scout question from the knowledge-base sheet",
  "category": "ai-agents",
  "difficulty": "advanced",
  "featured": false,
  "description": "Classify a new Help Scout conversation into a known topic, fetch that topic's approved answer from a sheet, and leave a draft as an internal note.",
  "tags": [
    "ai-agent",
    "help-scout",
    "knowledge-base",
    "support",
    "google-sheets"
  ],
  "apps": [
    "Help Scout",
    "AI by Zapier",
    "Google Sheets"
  ],
  "plan": {
    "minimum": "Professional",
    "reasons": [
      "multi-step Zap: 4 steps after the trigger",
      "AI by Zapier"
    ]
  },
  "tasks": {
    "typical": 4,
    "max": 4
  },
  "trigger": {
    "app": "Help Scout",
    "event": "Conversation Created",
    "kind": "instant",
    "title": "New conversation in Support",
    "why": "Fires when a new conversation opens in the Support mailbox.",
    "config": {
      "Mailbox": "Support"
    },
    "outputs": [
      "conversation_id",
      "number",
      "subject",
      "customer_email",
      "customer_first_name",
      "preview",
      "body_text",
      "mailbox_name",
      "url"
    ],
    "sample": "sample-trigger.json"
  },
  "steps": [
    {
      "key": "topic",
      "kind": "ai",
      "app": "AI by Zapier",
      "event": "Analyze and Return Data",
      "title": "Pick the knowledge-base topic",
      "why": "Chooses one topic from a closed list that matches the sheet's rows, or \"other\". A closed list keeps the lookup exact.",
      "fields": {
        "Model": "Default (fast)",
        "Instructions": "Classify this support message. Return topic: exactly one of returns, shipping-times, order-change, invoice-copy, password-reset, opening-hours, other. Return customer_question: the customer's actual question in one sentence. Return confidence: high or low.",
        "Input data": "Subject: {{trigger.subject}}\n\n{{trigger.body_text}}",
        "Output fields": "topic, customer_question, confidence"
      },
      "outputs": [
        "topic",
        "customer_question",
        "confidence"
      ]
    },
    {
      "key": "kb",
      "kind": "search",
      "app": "Google Sheets",
      "event": "Lookup Spreadsheet Row",
      "title": "Fetch the approved answer",
      "why": "Looks up the row for the topic. The sheet is owned by the support lead, so changing an answer there changes every future draft.",
      "fields": {
        "Drive": "My Google Drive",
        "Spreadsheet": "Support",
        "Worksheet": "Knowledge base",
        "Lookup Column": "topic",
        "Lookup Value": "{{topic.topic}}",
        "Should this step be considered a \"success\" when nothing is found?": "Yes"
      },
      "outputs": [
        "row_number",
        "_zap_search_was_found_status",
        "answer",
        "last_reviewed",
        "owner"
      ]
    },
    {
      "key": "draft",
      "kind": "ai",
      "app": "AI by Zapier",
      "event": "Analyze and Return Data",
      "title": "Write the draft from that answer only",
      "why": "The model may reword the approved answer for this customer but may not add facts. If the answer does not cover the question, it says so and the agent takes over.",
      "fields": {
        "Model": "Default (fast)",
        "Instructions": "Write a reply to the customer using ONLY the approved answer below. Greet them by first name. If the approved answer is empty, or does not answer their question, set can_answer to \"no\" and write draft as a one-line note to the agent explaining what is missing. Otherwise set can_answer to \"yes\". Never promise refunds, dates, or exceptions that are not in the approved answer.",
        "Input data": "Customer first name: {{trigger.customer_first_name}}\nQuestion: {{topic.customer_question}}\nTopic: {{topic.topic}} (confidence {{topic.confidence}})\n\nApproved answer (reviewed {{kb.last_reviewed}}):\n{{kb.answer}}",
        "Output fields": "draft, can_answer"
      },
      "outputs": [
        "draft",
        "can_answer"
      ]
    },
    {
      "key": "note",
      "kind": "action",
      "app": "Help Scout",
      "event": "Add Note",
      "title": "Leave the draft as an internal note",
      "why": "An internal note is only visible to agents, so the customer never sees an unchecked answer.",
      "fields": {
        "Conversation": "{{trigger.conversation_id}}",
        "Text": "Suggested reply ({{topic.topic}}, model confidence {{topic.confidence}}, can answer: {{draft.can_answer}}):\n\n{{draft.draft}}\n\nSource: knowledge-base row reviewed {{kb.last_reviewed}} by {{kb.owner}}."
      },
      "outputs": [
        "id"
      ]
    }
  ]
}
