On this page
Sommatic Docs
Open portal

Notifications

How people learn about their tasks. A server-sent event stream pushes new tasks to their assignee, and the React SDK turns task events into toasts with actions, including due-soon and overdue reminders.

View as Markdown
Open in

A task only works if the right person sees it in time. Sommatic AI notifies at two levels: the backend pushes new tasks to the person they were assigned to, and the browser shows them as toasts that open, claim or snooze the task.

The task stream

GET /work-management/task/stream is a server-sent events (SSE) stream for one person. Pass the person’s identity as user[identity]:

GET /work-management/task/stream?user[identity]=<user-identity>
EventWhenData
connectedRight after the stream opens.{ "message": "Connected", "user_identity": "…" }
task-assignedA task is created with this person as its user assignee.{ "kind": "assigned", "task": { … } }
errorThe identity is missing or the stream failed.{ "message": "…" }

The server sends a keep-alive comment every 30 seconds. A person can hold several streams at once (one per tab); each one receives the events.

Listen with the React SDK

WorkManagementTaskStreamService from @sommatic/react-sdk wraps the stream. It reconnects on its own after an error.

JavaScript
import { WorkManagementTaskStreamService } from '@sommatic/react-sdk';

const taskStream = new WorkManagementTaskStreamService();
taskStream.setParams({ user: { identity: currentUser.identity } });

taskStream.on('task-assigned', ({ task }) => {
  showNewTask(task);
});

taskStream.connect();

// When the view unmounts
taskStream.disconnect();

Toasts in the browser

In the browser, task notifications are DOM events with the sommatic:: namespace. Any module can emit them, and the TaskNotificationToast component of @sommatic/react-sdk shows them.

JSX
import { TaskNotificationToast } from '@sommatic/react-sdk';

export default function Layout({ children }) {
  return (
    <>
      {children}
      <TaskNotificationToast />
    </>
  );
}

sommatic::task-notification

Emit it to show a toast:

JavaScript
window.dispatchEvent(
  new CustomEvent('sommatic::task-notification', {
    detail: {
      kind: 'assigned',
      task: {
        id: '<task-id>',
        title: 'Approve billing exception',
        priority: { id: 4, name: 'critical', title: 'Critical', color: '#d32f2f' },
        due_at: '1761916800000',
      },
      actions: [
        { id: 'open', title: 'Open' },
        { id: 'claim', title: 'Claim' },
      ],
    },
  }),
);
FieldRequiredWhat it is
kindYesassigned, dueSoon, overdue or completed.
taskYesid and title; optionally type, priority, status and due_at.
messageNotitle and subtitle that replace the defaults.
actionsNoUp to two buttons: { id, title, payload? }.
metaNosource and timestamp.
kindSeverityCloses after
assignedinfo (warning when the priority is critical)6 s
dueSoonwarning10 s
overdueerrorStays until closed
completedsuccess4 s

The toast respects the person’s notification preferences (pause, quiet hours, priorities, muted types) and shows at most three toasts in any 8 seconds, so a burst of events never buries the screen.

sommatic::task-notification-action

When a person clicks a toast button, the toast emits this event with task_id, action_id (open, claim, snooze, view) and an optional action_payload. Your application decides what to do:

JavaScript
window.addEventListener('sommatic::task-notification-action', (event) => {
  const { task_id, action_id } = event.detail;

  if (action_id === 'open') {
    openTask(task_id);
  }

  if (action_id === 'claim') {
    claimTask(task_id);
  }
});

snooze is handled by the toast: it silences dueSoon toasts for that task for 10 minutes by default (set action_payload.minutes to change it). The snooze is kept in the browser’s localStorage.

Due-soon and overdue reminders

useTaskSLAMonitor polls the active tasks of the person (every 15 minutes by default) and emits dueSoon when a task is due in less than 30 minutes and overdue when its due_at has passed. Each task is notified once per kind. The first check after the page loads is silent, so tasks that were already late do not all pop up at once.

JavaScript
import { useTaskSLAMonitor } from '@sommatic/react-sdk';

useTaskSLAMonitor(fetchActiveTasks, {
  enabled: Boolean(user?.identity),
  intervalMs: 60000,
  dueSoonThresholdMs: 1800000,
});

fetchActiveTasks is an async function that returns the person’s open tasks, for example from GET /work-management/task/inbox.

Next steps

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs