> ## Documentation Index
> Fetch the complete documentation index at: https://sitegpt.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Triage conversations and leads

> Steps for an AI agent to review conversations, tag and resolve them, update leads, and report to the support team with the SiteGPT CLI.

Use this playbook when an AI agent helps a support team work through SiteGPT conversations and leads. For how AI mode, human mode, and escalation work, see [Conversations and human handoff](/docs/concepts/conversations-and-handoff).

## Before you start

* **Plan:** the Growth plan or above for CLI access. See [Plans and limits](/docs/reference/plans-and-limits).
* **Access:** a CLI login with these scopes. `sitegpt login` with no `--scope` includes them all.

  ```bash theme={null}
  sitegpt login \
    --profile support-agent \
    --scope account:read \
    --scope chatbots:read \
    --scope conversations:read \
    --scope conversations:write \
    --scope leads:read \
    --scope leads:write
  ```

  Add `--scope conversations:delete --scope leads:delete` only if the agent must delete tags, conversations, or leads.

## Steps

<Steps>
  <Step title="Pick the chatbot">
    ```bash theme={null}
    sitegpt whoami --json
    sitegpt chatbots list --json
    CHATBOT_ID=<chatbot-id>
    sitegpt tags list --chatbot $CHATBOT_ID --json
    ```
  </Step>

  <Step title="List the conversations that need attention">
    ```bash theme={null}
    sitegpt conversations list --chatbot $CHATBOT_ID --escalated true --json
    sitegpt conversations list --chatbot $CHATBOT_ID --important true --json
    sitegpt conversations list --chatbot $CHATBOT_ID --read false --json
    sitegpt conversations list --chatbot $CHATBOT_ID --status open --json
    ```

    Work in this order: escalated, then important, then unread, then the other open conversations.
  </Step>

  <Step title="Read each conversation">
    The CLI calls the conversation ID `<thread-id>`.

    ```bash theme={null}
    sitegpt conversations get --chatbot $CHATBOT_ID <thread-id> --json
    sitegpt messages list --chatbot $CHATBOT_ID <thread-id> --json
    ```

    Note the visitor's goal, the last question, and the last answer. Note if a team member should take over. Note any answer with a `NEGATIVE` reaction, and any contact details the visitor gave.
  </Step>

  <Step title="Tag the conversation">
    Create tags if they do not exist yet:

    ```bash theme={null}
    sitegpt tags add --chatbot $CHATBOT_ID "Billing"
    sitegpt tags add --chatbot $CHATBOT_ID "Bug report"
    ```

    Assign tags. The `--tag` values replace all tags on the conversation, so include the tags it already has.

    ```bash theme={null}
    sitegpt conversations update --chatbot $CHATBOT_ID <thread-id> --tag <tag-id> --tag <another-tag-id>
    ```
  </Step>

  <Step title="Star, resolve, or mark as read">
    ```bash theme={null}
    sitegpt conversations star --chatbot $CHATBOT_ID <thread-id>
    sitegpt conversations resolve --chatbot $CHATBOT_ID <thread-id>
    sitegpt conversations read --chatbot $CHATBOT_ID <thread-id>
    ```

    Resolve finished conversations. Do not delete them unless the user asks.
  </Step>

  <Step title="Escalate, or return to AI mode">
    To send a conversation to human support:

    ```bash theme={null}
    sitegpt conversations escalate --chatbot $CHATBOT_ID <thread-id> --message "A support teammate will follow up shortly."
    ```

    To give it back to the AI:

    ```bash theme={null}
    sitegpt conversations switch-to-ai --chatbot $CHATBOT_ID <thread-id> --message "The AI assistant is available again."
    ```

    Both commands fail on a resolved conversation. `escalate` also fails while a team member has taken over the conversation, unless it is already escalated.
  </Step>

  <Step title="Update leads">
    ```bash theme={null}
    sitegpt leads list --chatbot $CHATBOT_ID --status open --json
    sitegpt leads get --chatbot $CHATBOT_ID <lead-id> --json
    sitegpt leads update --chatbot $CHATBOT_ID <lead-id> --name "Jane Doe" --phone "+15551234567"
    sitegpt leads star --chatbot $CHATBOT_ID <lead-id>
    ```

    Archive leads that the team has handled:

    ```bash theme={null}
    sitegpt leads archive --chatbot $CHATBOT_ID <lead-id>
    sitegpt leads bulk --chatbot $CHATBOT_ID --action archive <lead-id> <lead-id>
    ```
  </Step>

  <Step title="Record content gaps">
    For each weak or wrong answer, record the conversation ID, the question, the answer, and the missing content. If the team approves an answer, add it as a custom response:

    ```bash theme={null}
    sitegpt knowledge custom-responses add \
      --chatbot $CHATBOT_ID \
      --question "Exact question visitors are asking" \
      --answer "Approved answer"
    ```

    This command needs the `knowledge:write` scope. For larger gaps, use [Keep a chatbot's content up to date](/docs/cli/playbooks/knowledge-maintenance). See also [Fix a wrong answer](/docs/guides/answers/fix-a-wrong-answer).
  </Step>
</Steps>

<Warning>
  The CLI sends every message as the visitor. It cannot reply as a team
  member. `sitegpt messages send` is for tests only. To reply to a visitor, use
  the dashboard. See [Reply to visitors and take over
  conversations](/docs/guides/human-support/reply-and-take-over).
</Warning>

## Check that it works

Run the lists from step 2 again:

```bash theme={null}
sitegpt conversations list --chatbot $CHATBOT_ID --escalated true --json
sitegpt conversations list --chatbot $CHATBOT_ID --read false --json
sitegpt conversations list --chatbot $CHATBOT_ID --status open --json
sitegpt leads list --chatbot $CHATBOT_ID --status open --json
```

Conversations that you resolved no longer show with `--status open`. Conversations that you marked as read no longer show with `--read false`.

## Hand back to the human

Report:

* The number of open, escalated, and unread conversations.
* New and starred leads.
* Topics that came up more than once.
* Conversations that need a team member.
* Suggested custom responses and new content.

Do not say that a customer was contacted unless another support system confirms it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.