---
title: "Job alerts"
label: "Job alerts"
description: "Build double-opt-in email alerts and signed-in alert management without mixing token models."
publishedAt: 2026-07-10
updatedAt: 2026-11-24
order: 6
status: "published"
---

Cavuno supports two alert experiences. Anonymous email alerts use confirmation and HMAC manage tokens; signed-in candidates manage alerts under `board.me.alerts`. These tokens are not board-user sessions.

## Prerequisites

- `board.context().features.jobAlerts` is `true`.
- A consent checkbox that is not preselected.
- Routes for the confirmation and email-management links Cavuno sends.
- A server-owned candidate session for `board.me.alerts`.

## Subscribe and confirm an email

```ts
// src/data/job-alerts.ts
import { board } from '../lib/board';

export async function subscribeToRemoteEngineering(email: string) {
  return board.jobAlerts.subscribe({
    email,
    consent: true,
    frequency: 'weekly',
    filters: {
      jobFunctions: ['engineering'],
      remoteOptions: ['remote'],
    },
    context: { source: 'jobs-search' },
  });
}

export function confirmJobAlert(token: string) {
  return board.jobAlerts.confirm({ token });
}
```

The subscription result always reports `status: 'submitted'` — a uniform response that never reveals whether the email was new or already subscribed (so it can't enumerate subscribers). A confirmation email is sent when the email isn't already subscribed. Confirmation itself always returns HTTP 200; branch on its `status`, which can be `confirmed`, `already_confirmed`, `expired`, `not_found`, `waitlisted` (confirmed, starting once the board can send to more people), or `unsubscribed` (a link sent before the alerts were turned off, which doesn't turn them back on; resume them from a manage link).

## Build the email management page

```ts
export async function loadAlertManagement(
  subscription: string,
  token: string,
) {
  return board.jobAlerts.manage({ subscription, token });
}

export async function updateAlertPreference(input: {
  subscriptionId: string;
  preferenceId: string;
  token: string;
  frequency: 'weekly';
}) {
  return board.jobAlerts.updatePreference({
    ...input,
    filters: { remoteOptions: ['remote'] },
  });
}
```

Preference updates are full replacements. Restate `frequency` and every filter the subscriber wants to keep.

Weekly is the only supported alert cadence.

Each person gets one weekly jobs email with all of their alerts and job matches. Its Unsubscribe link and the mail app's one-click unsubscribe go to Cavuno and turn off the whole weekly email, so your site has nothing to build for them. Its **Manage preferences** link opens your [email preferences page](/docs/sdk/reference/email-preferences), where the person changes a single alert or job matches.

Opening a digest's Unsubscribe link must change nothing: mail scanners and link checkers open every link in a message. Show an Unsubscribe button and run the unsubscribe from its action, passing the digest the page came from so the unsubscribe is attributed to that email:

```ts
import { parseJobAlertUnsubscribeParams } from '@cavuno/board';

export async function unsubscribeFromAlerts(input: {
  pageUrl: string;
  subscriptionId: string;
  token: string;
}) {
  return board.jobAlerts.unsubscribe({
    subscriptionId: input.subscriptionId,
    token: input.token,
    ...parseJobAlertUnsubscribeParams(input.pageUrl),
  });
}
```

## Record digest clicks

Digest job links open your job page with `ja_*` params. Report the click from the job page's server code so it counts toward the board's job alert engagement:

```ts
import { parseJobAlertClickParams } from '@cavuno/board';

export async function recordAlertClick(request: Request, jobId: string) {
  const click = parseJobAlertClickParams(request.url);
  if (!click) return;
  await board.jobAlerts
    .recordClick({
      ...click,
      jobId,
      userAgent: request.headers.get('user-agent') ?? undefined,
    })
    .catch(() => undefined);
}
```

Call it once per full `GET` of the job page, not on prefetches or `HEAD` requests, and do not hold the page for it. Pass the visitor's user agent so crawlers and link scanners are left out.

## Build signed-in alerts

```ts
const options = {
  cache: 'no-store' as const,
  headers: { authorization: `Bearer ${accessToken}` },
};

const alert = await board.me.alerts.create(
  {
    label: 'Remote engineering',
    frequency: 'weekly',
    jobFunctions: ['engineering'],
    remoteOptions: ['remote'],
  },
  options,
);
```

Use the returned `alert.id` for retrieve, update, and remove calls.

## Expected result

Anonymous subscribe and resend calls always return a uniform `status: 'submitted'`; confirmation returns an explicit status for every normal branch. Signed-in creation returns an active alert that appears in `board.me.alerts.list()`.

## Verify the result

- The subscription form is absent when job alerts are disabled.
- New subscriptions cannot be created without explicit consent.
- Expired and unknown confirmation tokens get distinct messages.
- Anonymous manage URLs work without a board-user session.
- Opening a job from a digest records a click; a job page opened without the `ja_*` params records none.
- Signed-in alert responses never enter a shared cache.

## Errors and edge cases

- Only job functions, place slugs, and remote options currently filter digest delivery. Seniority and salary values are stored but do not filter delivery.
- Resend always returns `status: 'submitted'` — uniform regardless of subscription/confirmation/throttle state (the per-subscription and per-IP throttle still applies server-side).
- Manage tokens grant access to one subscription. Treat them as secrets and keep them out of analytics and logs.
- Do not exchange a manage token for a candidate session.
- `subscribe` refuses an address whose domain has no mail server (usually a typo) with `email_domain_undeliverable` (422), creating and sending nothing; `details.suggestion` is the corrected address when there is one. Call `suggestEmailAddress` from `@cavuno/board/email` on blur to offer the same fix before submit.

## Production cautions

- Explain cadence and consent next to the subscription control.
- Use generic completion copy where revealing subscription existence would leak personal data.
- Preserve the complete current preference on replacement updates.
- Handle throttling without repeatedly calling resend.

Next, add signed-in communication with [Messaging](/docs/sdk/build-your-board/messaging).
