Developers
Custom statistics
Declare how your app’s event types aggregate into org-wide statistics — the same rollups native integrations use for reports and MCP get_statistic_rollups.
Overview
Each developer app can publish a statistic manifest — up to 32 definitions describing id, label, pillar, format, aggregation, and which eventType values contribute. The manifest is stored on the app and loaded into the in-process registry when updated.
API: GET/PUT /api/v1/apps/statistics. Authenticate with the same wp_live_* key as ingest.
Manifest fields
| Field | Type | Notes |
|---|---|---|
| id | string | Unique id; must start with `{appSlug}.` |
| label | string | Display name (1–120 chars) |
| description | string | Help text (≤ 500 chars) |
| pillar | StatisticPillar | ACTIVITY | COMMUNICATION | DELIVERY | REVIEW | KNOWLEDGE |
| format | enum | number | duration_minutes | percent | time_of_day | rate_per_day |
| aggregation | enum | count | sumField | durationMinutes | rate | ratio |
| valueField | string? | Metadata field for sumField / ratio aggregations |
| sourceEventTypes | string[] | 1–32 event types that feed this statistic |
| sourceEventCategories | EventCategory[] | 1–8 categories (communication, code, …) |
| feedsDimensions | enum[] | Optional SPACE dimension hints (≤ 5) |
| defaultEnabled | boolean | Default true — org can toggle |
| ownedBy | enum | extractor | none (default none) |
Register definitions
PUT replaces the entire manifest. Body accepts either { "statistics": [ … ] } or a bare array. GET returns the current manifest.
curl -X PUT "https://wepeople.app/api/v1/apps/statistics" \
-H "Authorization: Bearer $WEPEOPLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"statistics": [
{
"id": "crm-hub.tickets_resolved",
"label": "Tickets resolved",
"description": "Support tickets closed per day",
"pillar": "DELIVERY",
"format": "number",
"aggregation": "count",
"sourceEventTypes": ["ticket.resolved"],
"sourceEventCategories": ["TASK_UPDATE"],
"feedsDimensions": ["efficiency"],
"defaultEnabled": true,
"ownedBy": "none"
}
]
}'{
"requestId": "req_01HP3K5V4J3M9NVT8XZKQ9YQ2E",
"statistics": [ … ]
}Linking events
When you ingest events, any statistic whose sourceEventTypes includes the event’s eventType is considered a recipient during rollup. Optionally set statisticId on an event to target one definition explicitly (must exist in your manifest).
Optionally override pillar on an event when one category feeds multiple pillars.
Example event with explicit statistic
{
"eventType": "ticket.resolved",
"category": "TASK_UPDATE",
"statisticId": "crm-hub.tickets_resolved",
"actor": { "externalId": "agent-7" },
"metadata": { "ticket_id": "SUP-431" }
}Limits
- Maximum 32 statistic definitions per app.
- Up to 32 source event types per definition.
- Invalid ids (wrong prefix) or schema violations return
invalid_body— see error codes.
Product UI for toggling statistics: Statistics guide.