# Outcomes and events

> Tell us what actually happened, so a conversation that sounded fine but booked nothing is caught.

Your systems know things a transcript does not: whether the refund went through, whether the customer came back angry, whether a person had to step in. Send that and it appears on the conversation, next to our review.

## Outcome

Whether the conversation worked, by your own definition: `success` or `fail`. One per conversation; sending again replaces it.

Python:

```python
generalcontext.report_outcome(conversation.id, "fail", note="Customer reopened the ticket")
```

Node.js:

```ts
import { reportOutcome } from 'generalcontext';

await reportOutcome(conversation.id, 'fail', 'Customer reopened the ticket');
```

## Events

Anything that happened in your systems, any time later. Each event has an id you choose, so a retry is counted once.

Python:

```python
generalcontext.log_event(conversation.id, "order.refunded", {"amount": 42.5}, event_id=f"refund-{refund.id}")
```

Node.js:

```ts
import { logEvent } from 'generalcontext';

await logEvent({ sessionId: conversation.id, eventType: 'order.refunded', eventId: `refund-${refund.id}`, properties: { amount: 42.5 } });
```

HTTP:

```bash
curl https://generalcontextlabs.com/api/platform-collect/events \
  -H "Authorization: Bearer $GENERALCONTEXT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"events":[{"event_id":"refund-77","event_type":"order.refunded","timestamp":"2026-11-08T15:00:00Z","session_id":"conv-123","properties":{"amount":42.5}}]}'
```

The reply is `{ingested, skipped, failures}`. Up to 500 events per request. Properties are flat strings, numbers and booleans. From the SDK, both calls flush pending calls first, return true when accepted, and never raise.

> **Note:** The conversation must exist first. In a short-lived process, flush before you report.

## Examples

| Kind of agent | Events |
| --- | --- |
| Support | `ticket.reopened`, `ticket.escalated`, `csat.submitted` |
| Commerce | `order.refunded`, `order.cancelled` |
| Scheduling | `appointment.booked`, `appointment.no_show` |
| Any agent | `handoff.to_human`, `complaint.received` |
