Skip to content
QwryAI
Documentation
Pages

Commands

CLI Conversations

Find, read and handle a QwryAI agent's conversations from every channel in the terminal

Use the conversation tools to look through an agent's chat history, read transcripts, and act on conversations the way your team does in the Inbox. They cover every channel, from the chat widget to WhatsApp and the API, and need the Manage conversations and helpdesk permission. Sign in first (see CLI Auth) and keep the agent's id in $AGENT (see CLI Agents).

List conversations

List the conversations created in a date range (UTC), newest first, twenty per page, each with its AI summary:

Bash
qwryai-cli tools:call query_conversations --args "{\"chatbotId\":\"$AGENT\",\"startDate\":\"2026-11-01\",\"endDate\":\"2026-11-30\",\"page\":1}"
JSON
{
  "success": true,
  "data": {
    "items": [
      {
        "_id": "<conversationId>",
        "conversationId": "<conversationKey>",
        "channel": "web",
        "lifecycle": "open",
        "routingState": "none",
        "metadata": {
          "aiSummary": "Customer wants a human support ticket for order 1043 being two weeks late.",
          "aiSummaryUpdatedAt": "2026-11-30T18:15:01.177Z"
        },
        "timestamps": { "created": "2026-11-30T18:14:52.697Z", "lastActivity": "2026-11-30T18:15:17.705Z" },
        "metrics": { "messageCount": 5, "aiMessageCount": 2, "agentMessageCount": 0 },
        "insights": { "sentiment": "negative", "topicIds": ["<topicId>"] }
      }
    ],
    "total": 391,
    "page": 1,
    "hasMore": true,
    "range": { "startDate": "2026-11-01", "endDate": "2026-11-30", "page": 1 },
    "timezone": "UTC"
  }
}

Pass an item's _id as conversationId to the other conversation tools.

Narrow the list with any of these filters; they combine:

FilterMatches
activity_statesongoing, ended, taken_over or paused
escalatedtrue for conversations escalated to a human
feedbackgood or bad ratings
sentiment, sources, topicsThe stored values get_conversation_facets lists
contactA contact's name or email

Get one conversation

Show a conversation and its messages, twenty per page, oldest first:

Bash
qwryai-cli tools:call get_conversation_detail --args "{\"chatbotId\":\"$AGENT\",\"conversationId\":\"<conversationId>\",\"page\":1}"
JSON
{
  "success": true,
  "data": {
    "conversation": { "_id": "<conversationId>", "channel": "web", "lifecycle": "open", "routingState": "none" },
    "page": 1,
    "order": "oldest_first",
    "messages": [
      {
        "id": "<messageId>",
        "sender": "user",
        "timestamp": "2026-11-30T18:14:52.931Z",
        "content": "I want to submit a complaint to a human: my delivery for order 1043 is two weeks late. Please create a support ticket.",
        "truncated": false
      },
      {
        "id": "<messageId>",
        "sender": "system",
        "timestamp": "2026-11-30T18:15:02.074Z",
        "content": "Ticket created: TKT-73",
        "truncated": false
      },
      {
        "id": "<messageId>",
        "sender": "ai",
        "timestamp": "2026-11-30T18:15:04.285Z",
        "content": "Thanks, Sam. Your complaint about the late delivery for order 1043 has been sent to our support team. Your ticket ID is **TKT-73**.",
        "truncated": false
      }
    ],
    "mayHaveMore": false
  }
}

Messages are cut to 800 characters, marked "truncated": true. Add "fullText":true for the whole text, and "newestFirst":true to start from the latest message.

Count conversations

Break a date range down by sentiment, source (channel), activity_state, topics or feedback:

Bash
qwryai-cli tools:call get_conversation_facets --args "{\"chatbotId\":\"$AGENT\",\"startDate\":\"2026-11-01\",\"endDate\":\"2026-11-30\",\"fields\":[\"source\",\"sentiment\"]}"

Act on a conversation

These tools act at once, as an agent in the Inbox would:

Bash
qwryai-cli tools:call send_agent_message --args "{\"chatbotId\":\"$AGENT\",\"conversationId\":\"<conversationId>\",\"content\":\"Hi Sam, I've chased the courier for order 1043.\"}"

send_agent_message replies as a human agent. It takes the conversation over: it's assigned to you and the AI stops replying until it's resolved. Add a note only your team sees with add_internal_note, and hand back with resolve_conversation, optionally with a reason. mark_conversation_read and mark_conversation_unread set the conversation's unread state in your Inbox.

To stop or restart AI replies in an open conversation that no human is handling, prepare a review with toggle_conversation_pause ("paused":true or false) and apply it.

Commands

ToolPurpose
query_conversationsList conversations in a date range, with filters
search_conversationsFind conversations whose messages contain some text
get_conversation_detailShow one conversation and its messages
get_conversation_facetsCount conversations by sentiment, channel, state, topic or rating
send_agent_messageReply as a human agent and take the conversation over
add_internal_noteAdd a private note for your team
resolve_conversationResolve a conversation a human handled
mark_conversation_read / mark_conversation_unreadSet the conversation's unread state for you
toggle_conversation_pausePause or resume AI replies (reviewed)

Explore the documentation