Notification Preferences API
Manage your personal notification preferences programmatically. These endpoints control whether kenbun sends you direct messages when triggers fire on leads you own, and which event types you want muted.
Preferences are personal — you can only read or write your own settings, never another team member's. Each setting is scoped to the active Organizational Unit.
GET /me/notification-prefs
Retrieve your notification preferences for the active Organizational Unit. The response always lists all four canonical event types. Any event type you have not explicitly muted defaults to muted: false.
Authentication
Required: Yes. Bearer token (JWT) for browser/SPA clients.
Request
Endpoint: GET /me/notification-prefs
Headers:
Accept: application/json
Example:
curl -X GET "https://api.kenbun.io/me/notification-prefs" \
-H "Authorization: Bearer <token>" \
-H "Accept: application/json"
Response
Status: 200 OK
Response Fields:
| Field | Type | Description |
|---|---|---|
notifications_enabled | boolean | Master toggle. When false, all kenbun direct messages to this user are muted regardless of per-event-type settings. |
slack_user_id | string or null | A masked version of the user's Slack identifier (for example, U12•••XYZ). null if the user has not been mapped yet. |
prefs | array | One entry per canonical event type. |
prefs[].event_type | string | One of milestone.entered, milestone.exited, sequence.completed, surge.fired. |
prefs[].muted | boolean | true if this event type is muted for the user. |
Example Response:
{
"notifications_enabled": true,
"slack_user_id": "U12•••XYZ",
"prefs": [
{ "event_type": "milestone.entered", "muted": false },
{ "event_type": "milestone.exited", "muted": true },
{ "event_type": "sequence.completed", "muted": false },
{ "event_type": "surge.fired", "muted": false }
]
}
Common Errors
| Status | Meaning | Solution |
|---|---|---|
| 400 | No active Organizational Unit | Set an active Organizational Unit before calling. |
| 401 | Unauthorized | Verify your bearer token is valid. |
| 500 | Internal Server Error | Retry later or contact support. |
PUT /me/notification-prefs
Update your master toggle, your per-event-type mute settings, or both. Both fields are optional. Omitted fields are left unchanged.
Authentication
Required: Yes. Bearer token (JWT).
Request
Endpoint: PUT /me/notification-prefs
Headers:
Content-Type: application/json
Accept: application/json
Request Body
| Field | Required | Type | Description |
|---|---|---|---|
notifications_enabled | No | boolean | Master toggle. When false, all direct messages are muted. When omitted, the existing value is preserved. |
prefs | No | array | One entry per event type to update. Event types not included in the array are left at their current setting. |
prefs[].event_type | Yes (within an entry) | string | One of the four canonical event types. Any other value returns 400. |
prefs[].muted | Yes (within an entry) | boolean | true to mute this event type, false to enable. |
Example Request Body:
{
"notifications_enabled": true,
"prefs": [
{ "event_type": "milestone.exited", "muted": true },
{ "event_type": "surge.fired", "muted": false }
]
}
Example:
curl -X PUT "https://api.kenbun.io/me/notification-prefs" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"notifications_enabled": true,
"prefs": [
{ "event_type": "milestone.exited", "muted": true }
]
}'
Response
Status: 200 OK
{ "status": "ok" }
Common Errors
| Status | Meaning | Solution |
|---|---|---|
| 400 | Unknown event_type value | Use one of milestone.entered, milestone.exited, sequence.completed, surge.fired. |
| 400 | No active Organizational Unit | Set an active Organizational Unit before calling. |
| 400 | Malformed JSON body | Verify the request body is valid JSON. |
| 401 | Unauthorized | Verify your bearer token. |
| 500 | Internal Server Error | Retry later. |
Canonical Event Types
The four event types accepted by these endpoints map to the trigger types in kenbun:
| Event Type | Fires For |
|---|---|
milestone.entered | A lead's score crosses a milestone threshold upward |
milestone.exited | A lead's score drops below a milestone threshold |
sequence.completed | A lead completes a configured event sequence |
surge.fired | A surge trigger fires on a lead |
Any other value in prefs[].event_type causes the request to be rejected with a 400 response.
Notes
- Preferences are stored per user, per Organizational Unit. The Organizational Unit is read automatically from your account context.
- Default behavior is opt-out: new users have no stored preferences and receive every event type until they explicitly mute one.
- The
slack_user_idfield is masked for display purposes only. It is never returned in cleartext from this endpoint.
Related Endpoints
- Slack Identity Management — Admin endpoints for syncing and overriding Slack user identities
- Members — List Organizational Unit members
- Lead Owner Assignment — Assign leads to team members
Related Documentation
- Notification Preferences — End-user guide to the Settings > Notifications page
- Owner Notifications — How triggers route DMs to lead owners