Quickstart
Send your first event in under 2 minutes.
Prerequisites
- An API token (get one here)
- A agent (
agent_key) created in the dashboard - A customer (
customer_key) created in the dashboard with a rate card that includes the agent
Set your token as an environment variable so the examples below work as-is:
export WITN_API_KEY=your_token_hereThe scenario
A customer support outcome: a ticket is billable after the agent replies, as long as the ticket is not escalated, reopened, or followed by a low CSAT score. If the customer abandons the conversation after the agent reply, no bad signal has arrived, so the outcome can confirm after the settlement period.
Step 1. Send signals
Outcomes are created on the first event. There is no separate create-outcome call. Every event carries agent_key and customer_key so the platform knows which contract to snapshot and which customer to bill.
# Agent replies — creates the outcome with the agent's contract snapshot
curl -X POST https://api.thewitn.com/v1/events \
-H "Authorization: Bearer $WITN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"key": "support:ticket:1001",
"action": "agent_replied",
"agent_key": "support",
"customer_key": "acme"
}'
# Optional bad signal — same key reuses the outcome and can flip it to FAILED
curl -X POST https://api.thewitn.com/v1/events \
-H "Authorization: Bearer $WITN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"key": "support:ticket:1001",
"action": "reopened",
"agent_key": "support",
"customer_key": "acme"
}'Both calls return 202 Accepted. Events are processed asynchronously. After agent_replied, the outcome transitions to PENDING with scheduled_resolution: "CONFIRMED". If a later reopened, escalated, or low csat event arrives before settlement, the scheduled resolution flips to FAILED.
key is your own identifier for this outcome. It must be globally unique and 8 to 255 characters. Every event with the same key targets the same outcome.
agent_key and customer_key must be consistent across all events with the same key. A mismatch surfaces in the DLQ as OUTCOME_IDENTITY_MISMATCH.