Skip to content

Guides

Getting started

Create a workspace, grab an API key, and send your first in-app notification.

Boson is notification infrastructure for product teams. This guide gets you to a live in-app notification.

1. Open the console

Sign in at the developer console and create a workspace. Boson issues an API key for that workspace.

2. Send an event

Every route except health expects the workspace key in the x-api-key header.

curl -X POST https://api.getboson.com/v1/events \
  -H "content-type: application/json" \
  -H "x-api-key: $BOSON_API_KEY" \
  -d '{
    "channel": "in_app",
    "subscriberId": "user_demo",
    "title": "Deploy finished",
    "body": "api-7f3c is live"
  }'

The API returns 202 with the notification id. A worker marks it sent after the channel handler runs.

3. Read the inbox

GET /v1/inbox/:subscriberId returns the latest in-app rows.
PATCH /v1/notifications/:id/read sets read_at.

4. Open the live socket

The browser cannot set x-api-key on a WebSocket, so pass apiKey as a query parameter:

const socket = new WebSocket(
  "wss://api.getboson.com/v1/ws/user_demo?apiKey=" + encodeURIComponent(apiKey)
);

socket.onmessage = (event) => {
  const note = JSON.parse(event.data);
  console.log(note.title, note.body);
};

Send another in_app event for the same subscriber. The worker publishes on Redis and the API forwards it.