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

# AI Support Chatbot

> Check user messages, tool results, and assistant replies in support conversations

AI support chatbots handle account data, refunds, order details, and emotionally charged conversations. Use the [Events API](/latest/events/overview) to check each part of the conversation separately and keep a clear record of what was flagged.

## What to Check

For a support chatbot, send Events for:

| Event           | Type      | Field     | Why it matters                                                                                        |
| --------------- | --------- | --------- | ----------------------------------------------------------------------------------------------------- |
| User message    | `message` | `content` | Detect abusive requests, sensitive data, jailbreaks, or unsafe instructions.                          |
| Tool result     | `tool`    | `output`  | Check returned account data, refund decisions, or internal notes before they influence the assistant. |
| Assistant reply | `message` | `content` | Detect unsafe advice, leaked data, or Policy-violating responses before showing them to the user.     |
| Agent state     | `agent`   | `state`   | Track handoff decisions, escalation state, and risk markers.                                          |

<Tip>Use the same `run_id` for all Events in one conversation turn. Use distinct `event_id` values for the user message, tool result, and assistant reply.</Tip>

<Warning>Before using these examples, attach your Policies to an active [Condition](/latest/condition/overview). Use an empty `{}` expression to match every Event, or add metadata to each Event to target specific user groups, regions, or workflow stages. Without a matching Condition, Events are processed without any Policies.</Warning>

## Basic Flow

1. Check the user's message when it arrives.
2. If your assistant calls tools, check any sensitive tool outputs before using them.
3. Check the assistant's final response before sending it to the user.
4. Store the returned `internal_event_id` values when you need to retrieve the exact results later.

## Example: Check a User Message

```bash theme={null}
curl -X POST "https://eu.whitecircle.com/api/event" \
  -H "Authorization: Bearer wc-your-api-key" \
  -H "Content-Type: application/json" \
  -H "whitecircle-version: 2026-06-01" \
  -d '{
    "event": {
      "type": "message",
      "event_id": "evt_user_turn_7",
      "role": "user",
      "content": "I need a refund. My account number is 123-45-6789."
    },
    "run_id": "support_conversation_123_turn_7",
    "external_session_id": "support_conversation_123"
  }'
```

## Example: Check Tool Output

```json theme={null}
{
  "run_id": "support_conversation_123_turn_7",
  "external_session_id": "support_conversation_123",
  "event": {
    "type": "tool",
    "event_id": "evt_order_lookup_turn_7",
    "name": "lookup_order",
    "call_id": "call_order_123",
    "output": {
      "order_id": "ord_123",
      "refund_eligible": true,
      "customer_tier": "vip",
      "internal_note": "Customer has disputed two previous charges."
    }
  }
}
```

## Example: Check Assistant Reply

```json theme={null}
{
  "run_id": "support_conversation_123_turn_7",
  "external_session_id": "support_conversation_123",
  "event": {
    "type": "message",
    "event_id": "evt_assistant_turn_7",
    "role": "assistant",
    "content": "Your order is eligible for a refund. I can start that process now."
  }
}
```

## Batch a Full Turn

You can send all Events for one turn in a single batch:

```json theme={null}
{
  "run_id": "support_conversation_123_turn_7",
  "external_session_id": "support_conversation_123",
  "events": [
    {
      "type": "message",
      "event_id": "evt_user_turn_7",
      "role": "user",
      "content": "I need a refund. My account number is 123-45-6789."
    },
    {
      "type": "tool",
      "event_id": "evt_order_lookup_turn_7",
      "name": "lookup_order",
      "output": {
        "order_id": "ord_123",
        "refund_eligible": true
      }
    },
    {
      "type": "message",
      "event_id": "evt_assistant_turn_7",
      "role": "assistant",
      "content": "Your order is eligible for a refund. I can start that process now."
    }
  ]
}
```

The response groups results into `messages`, `tools`, `agents`, and other typed buckets.

## Recommended IDs

| ID                    | Example                           | Recommendation                                        |
| --------------------- | --------------------------------- | ----------------------------------------------------- |
| `run_id`              | `support_conversation_123_turn_7` | Use one per conversation turn or assistant operation. |
| `external_session_id` | `support_conversation_123`        | Use your stable conversation ID.                      |
| `event_id`            | `evt_user_turn_7`                 | Use one per message, tool result, or assistant reply. |
| `internal_event_id`   | returned by White Circle          | Store when you need exact lookup later.               |

## Next Steps

<CardGroup cols={2}>
  <Card title="Check One Event" icon="bolt" href="/latest/events/check-event">
    Learn the single Event request and response shape.
  </Card>

  <Card title="Check Multiple Events" icon="list-check" href="/latest/events/check-events">
    Batch all Events for one support turn.
  </Card>

  <Card title="Get Event Results" icon="magnifying-glass" href="/latest/events/get-event">
    Retrieve exact or latest Event results.
  </Card>

  <Card title="Risk Scoring" icon="user" href="/latest/user/radar">
    Use user metadata and Policy violations to inspect user risk.
  </Card>
</CardGroup>
