Skip to content
Anlyon
Esc
↑↓navigate↵open⌘Jpreview
On this page

Notifications

Choose which Anlyon alerts your team gets (approvals waiting, outcomes that need a person, broken connections, usage and billing) and send them to email, Slack, Discord, a signed webhook or the console inbox.

Anlyon raises a notification when something needs a person: an agent’s request is waiting for approval, a request expired unanswered, an outcome could not be settled automatically, a connected account stopped working, or the workspace is close to an allowance. Each one goes to the console inbox and to the channels you turn on.

Without them, an agent that is waiting on a human just stops, and nobody finds out until a customer asks why nothing happened. The alerts below are what turn a parked request or a broken connection into something your team sees within minutes, without you building polling or alerting of your own.

How notifications reach you

  1. Something happens that has a notification type, such as approval_requested.
  2. Anlyon records the notification in the workspace’s console inbox.
  3. If the type is in the workspace’s enabledTypes, Anlyon sends it to every channel that is turned on: email, a webhook, Slack and Discord.
  4. Each member can mute types for their own inbox. Muting never stops delivery to the channels or to other members.

The three team alerts (approval_expired, outcome_unknown and connection_broken) are stricter: when their type is off, nothing is raised at all, not even an inbox entry.

Notification types

Type Sent when On by default
approval_requested An approval is waiting for a decision. The title names the request, and metadata.approvalId identifies it. Yes
approval_expired A request expired with nobody deciding it. Yes
outcome_unknown An action’s outcome could not be settled by automatic checks and needs a person. See When the outcome is unknown. Yes
connection_broken A connected account stopped working and needs to be reconnected. See Connected accounts. Yes
budget_alert An API key reached the alert threshold of its monthly budget, at most once per key per month. At the cap its requests are refused with BUDGET_EXCEEDED. Yes
quota_warning Usage of a monthly allowance crossed one of your alert thresholds. Yes
quota_exceeded Usage of a monthly allowance reached 100%. Yes
payment_failed A payment for the plan did not go through. Yes
security_alert A security event needs attention. Yes
api_key_expiring An API key is close to its expiry date. Sent at most once a week per key. No
plan_upgraded, plan_downgraded The workspace plan changed. No
feature_enabled A feature was turned on for the workspace. No
system_alert A platform event needs attention. No

“On by default” is the enabledTypes list a new workspace starts with. A workspace created before the three team alerts existed keeps the list it had until an admin turns them on, in Settings → Defaults (see Workspace defaults) or with enabledTypes below. The API also accepts delivery_failure_spike, which applies only to the delivery namespaces that predate governed actions.

How usage alerts are counted

Usage alerts are taken against the month’s allowance, with this month’s action packs added. Action executions always alert at 80% and 100%, besides the thresholds you set. Each threshold alerts at most once a month, and when usage crosses several thresholds at once, only the highest one alerts. A threshold below 100% raises quota_warning, and 100% raises quota_exceeded.

Channels

Channel What it does Turn it on
Console inbox Listed in the console and through the API. inAppEnabled, on by default
Email Sent to the addresses in emailRecipients. emailEnabled, on by default
Webhook One signed POST to your endpoint. webhookEnabled and webhookUrl
Slack, Discord Posted to a channel you connected in the console. slackEnabled, discordEnabled

Email alerts on Early Beta Access are capped at 500 per workspace per UTC month, and each recipient counts as one. Paid plans have no monthly cap. A workspace with no plan sends no email alerts. Past the cap, alerts still reach the inbox and the other channels.

Read and clear the inbox

Listing and counting need notifications:read. Marking read and dismissing need notifications:write. Both scopes are in the default key set. Read state belongs to the workspace, so a notification one member dismisses is gone for everyone.

import { Client } from '@anlyonhq/sdk';

const anlyon = new Client({ apiKey: process.env.ANLYON_API_KEY! });

const { data } = await anlyon.notifications.list({ unreadOnly: true, limit: 50 });
for (const notification of data?.notifications ?? []) {
  console.log(notification.type, notification.title);
  await anlyon.notifications.markAsRead(notification.id);
}

const { data: unread } = await anlyon.notifications.getUnreadCount();
console.log(unread?.count);
# List. Add ?unreadOnly=true and ?limit= (1 to 100, default 50).
curl "https://api.anlyon.com/api/v2/notifications?unreadOnly=true&limit=50" \
  -H "Authorization: Bearer $ANLYON_API_KEY"

# Count the unread ones
curl https://api.anlyon.com/api/v2/notifications/unread-count \
  -H "Authorization: Bearer $ANLYON_API_KEY"

# Mark one as read, or all of them
curl -X PATCH https://api.anlyon.com/api/v2/notifications/$NOTIFICATION_ID/read \
  -H "Authorization: Bearer $ANLYON_API_KEY"
curl -X PATCH https://api.anlyon.com/api/v2/notifications/read-all \
  -H "Authorization: Bearer $ANLYON_API_KEY"

# Dismiss one
curl -X DELETE https://api.anlyon.com/api/v2/notifications/$NOTIFICATION_ID \
  -H "Authorization: Bearer $ANLYON_API_KEY"
from anlyon import Client

client = Client()  # reads ANLYON_API_KEY

page = client.notifications.list(unread_only=True, limit=50).data
for notification in page["notifications"]:
    print(notification["type"], notification["title"])
    client.notifications.mark_read(notification["id"])

print(client.notifications.unread_count().data["count"])

The list answers:

{
  "success": true,
  "data": {
    "notifications": [
      {
        "id": "8d1f6a52-3c0e-4f7b-9a0d-2b6c1e4f9a31",
        "type": "approval_requested",
        "priority": "high",
        "title": "Approval needed: Refund order 1042",
        "message": "An agent is waiting for your decision.",
        "metadata": { "approvalId": "apr_01JD7Q2V9K3M", "kind": "action" },
        "actionUrl": "https://console.anlyon.com/approvals?id=apr_01JD7Q2V9K3M",
        "actionLabel": "Review",
        "isRead": false,
        "readAt": null,
        "createdAt": "2026-10-27T09:12:00.000Z",
        "expiresAt": "2026-10-28T09:12:00.000Z"
      }
    ],
    "unreadCount": 1,
    "total": 1
  }
}

The API reference has each call: list, unread count, mark one read, mark all read and dismiss.

Mute types for yourself

Every member has their own muted types in each workspace. A muted type is left out of your own list and unread count. It is still raised, still sent to email, Slack, Discord and the webhook, and still shown to every other member.

Reading needs notifications:read and changing needs notifications:write. No role is needed. Both calls need a person, so they work from the console and from an OAuth connection. An API key has no person and gets 403 USER_IDENTITY_REQUIRED.

import { Client } from '@anlyonhq/sdk';

// An OAuth access token, not an API key: muting belongs to a person.
const anlyon = new Client({ apiKey: process.env.ANLYON_OAUTH_TOKEN! });

await anlyon.notifications.updateMyPreferences({ mutedTypes: ['quota_warning'] });
const { data } = await anlyon.notifications.getMyPreferences();
console.log(data?.mutedTypes);
curl -X PATCH https://api.anlyon.com/api/v2/notifications/preferences/me \
  -H "Authorization: Bearer $ANLYON_OAUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "mutedTypes": ["quota_warning"] }'
import os

from anlyon import Client

client = Client(api_key=os.environ["ANLYON_OAUTH_TOKEN"])

client.notifications.update_my_preferences(muted_types=["quota_warning"])
print(client.notifications.my_preferences().data["mutedTypes"])
{ "success": true, "data": { "mutedTypes": ["quota_warning"], "updatedAt": "2026-10-27T12:00:00.000Z" } }

mutedTypes replaces the whole list. Send [] to mute nothing. It takes any of the notification types above. In the console this is Settings → Notifications → My notifications.

Change where the workspace’s alerts go

The workspace preferences decide which types are sent and where, for every member.

What you do API key scope Role, for a console session or an OAuth connection
Read workspace preferences notifications:read Any member
Update workspace preferences notifications:manage Admin
Send a test webhook notifications:manage Admin

notifications:manage is a privileged scope: no key gets it by default, so an agent cannot silence its own approval alerts or point them at another address. An OAuth connection gets it from the Notification channels group, which is off unless you turn it on. In the console a member sees these settings and an admin changes them.

OAuth tokens issued before 2026-10-03 do not carry notifications:write or notifications:manage. Such a client must ask for consent again before it can mark notifications read, dismiss them, or change notification settings.

Send only the fields you want to change:

import { Client } from '@anlyonhq/sdk';

// An operator key holding notifications:manage, never the agent's key.
const operator = new Client({ apiKey: process.env.ANLYON_OPERATOR_KEY! });

await operator.notifications.updatePreferences({
  emailEnabled: true,
  emailRecipients: ['oncall@example.com'],
  quotaAlertThresholds: [60, 80, 95, 100],
  enabledTypes: ['approval_requested', 'approval_expired', 'outcome_unknown', 'connection_broken', 'quota_exceeded'],
});

const { data } = await operator.notifications.getPreferences();
console.log(data?.enabledTypes);
curl -X PATCH https://api.anlyon.com/api/v2/notifications/preferences \
  -H "Authorization: Bearer $ANLYON_OPERATOR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "emailEnabled": true,
    "emailRecipients": ["oncall@example.com"],
    "quotaAlertThresholds": [60, 80, 95, 100],
    "enabledTypes": ["approval_requested", "approval_expired", "outcome_unknown", "connection_broken", "quota_exceeded"]
  }'
import os

from anlyon import Client

operator = Client(api_key=os.environ["ANLYON_OPERATOR_KEY"])

operator.notifications.update_preferences(
    email_enabled=True,
    email_recipients=["oncall@example.com"],
    quota_alert_thresholds=[60, 80, 95, 100],
    enabled_types=["approval_requested", "approval_expired", "outcome_unknown", "connection_broken", "quota_exceeded"],
)

The Python SDK takes email_enabled, webhook_enabled, in_app_enabled, email_recipients, webhook_url, webhook_secret, quota_alert_thresholds and enabled_types. To turn Slack or Discord on or off, use the console or the HTTP call.

The answer, and GET /api/v2/notifications/preferences, return the whole set:

{
  "success": true,
  "data": {
    "emailEnabled": true,
    "webhookEnabled": false,
    "inAppEnabled": true,
    "slackEnabled": false,
    "discordEnabled": false,
    "emailRecipients": ["oncall@example.com"],
    "webhookUrl": null,
    "hasWebhookSecret": false,
    "quotaAlertThresholds": [60, 80, 95, 100],
    "enabledTypes": ["approval_requested", "approval_expired", "outcome_unknown", "connection_broken", "quota_exceeded"],
    "createdAt": "2026-10-01T10:00:00.000Z",
    "updatedAt": "2026-10-27T12:00:00.000Z"
  }
}
Field Meaning
emailEnabled, webhookEnabled, inAppEnabled, slackEnabled, discordEnabled Turn a channel on or off.
emailRecipients Up to 50 email addresses.
webhookUrl, webhookSecret The webhook endpoint, and the secret that signs its requests (up to 4,096 characters). null clears either one. The secret is never returned: hasWebhookSecret says whether one is set.
quotaAlertThresholds Up to 20 whole percentages from 0 to 100. The default is 50, 75, 90 and 100.
enabledTypes The notification types that are sent. It replaces the whole list.

A body with none of these fields answers 400. The API reference has read and update.

Receive alerts on a webhook

Point alerts at your endpoint

Use a secret so you can check that a request came from Anlyon. A Standard Webhooks secret (whsec_ followed by base64) works best, because the receiving libraries take it as is.

curl -X PATCH https://api.anlyon.com/api/v2/notifications/preferences \
  -H "Authorization: Bearer $ANLYON_OPERATOR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "webhookEnabled": true,
    "webhookUrl": "https://your-app.com/webhooks/anlyon-alerts",
    "webhookSecret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"
  }'

Send a test request to an endpoint before you save it. The test request is a notification.test event signed with X-Anlyon-Signature only. An endpoint that does not answer 2xx within 10 seconds gives 400 webhook_test_failed:

curl -X POST https://api.anlyon.com/api/v2/notifications/preferences/test-webhook \
  -H "Authorization: Bearer $ANLYON_OPERATOR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "webhookUrl": "https://your-app.com/webhooks/anlyon-alerts", "webhookSecret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw" }'

The endpoint must be a public HTTPS or HTTP address. An address that resolves to a private or internal network is refused.

What a request carries

{
  "event": "notification.approval_requested",
  "timestamp": "2026-10-27T09:12:00.000Z",
  "workspaceId": "2f8a1f72-7cf9-4fef-95e8-df9de5f2f5d0",
  "data": {
    "notificationId": "8d1f6a52-3c0e-4f7b-9a0d-2b6c1e4f9a31",
    "type": "approval_requested",
    "priority": "high",
    "title": "Approval needed: Refund order 1042",
    "message": "An agent is waiting for your decision.",
    "metadata": { "approvalId": "apr_01JD7Q2V9K3M", "kind": "action" }
  }
}
Header Value
X-Anlyon-Event The event field, for example notification.approval_requested.
X-Anlyon-Timestamp The timestamp field.
webhook-id, webhook-timestamp, webhook-signature Standard Webhooks headers, sent when a secret is set. webhook-id is the notification id.
X-Anlyon-Signature sha256=<hex>: an HMAC-SHA256 of the raw body alone, sent when a secret is set.

Verify the signature

Verify the Standard Webhooks headers: they sign the id and the timestamp with the body, so you can refuse a captured request replayed later. webhook-signature is v1,<base64>, an HMAC-SHA256 of <webhook-id>.<webhook-timestamp>.<raw body>. The key is the base64 after whsec_ when the secret has that form, and the secret’s own bytes otherwise.

import { createHmac, timingSafeEqual } from 'node:crypto';

const TOLERANCE_SECONDS = 300;

export function verifyAlert(rawBody: string, headers: Headers, secret: string): boolean {
  const id = headers.get('webhook-id');
  const timestamp = headers.get('webhook-timestamp');
  const signatures = headers.get('webhook-signature');
  if (!id || !timestamp || !signatures) return false;
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > TOLERANCE_SECONDS) return false;

  const key = secret.startsWith('whsec_') ? Buffer.from(secret.slice(6), 'base64') : Buffer.from(secret, 'utf8');
  const expected = Buffer.from(createHmac('sha256', key).update(`${id}.${timestamp}.${rawBody}`).digest('base64'));

  return signatures.split(' ').some((entry) => {
    const [version, value] = entry.split(',');
    const given = Buffer.from(value ?? '');
    return version === 'v1' && given.length === expected.length && timingSafeEqual(given, expected);
  });
}

X-Anlyon-Signature remains for receivers built against it. It covers the body and nothing else, so it does not bound how old a request is. The SDK’s Receiver class verifies the Anlyon-Signature header of signed deliveries, a different format, and not these headers.

How notification delivery behaves

  • A webhook alert is one POST with a 30-second timeout and no retry. Make your handler safe to call more than once, and do not rely on its arrival for anything that must happen. To act on approvals reliably, subscribe to events and webhooks.
  • An alert reports. It does not stop anything. A quota_warning leaves usage running. Refusals come from the limits themselves.
  • One channel failing does not stop the others. Each channel is sent on its own.

Errors

Status and code When What to do
403 missing scope A key without notifications:read reads, or without notifications:write changes the inbox, or without notifications:manage changes workspace preferences. The message names the scope. Use a key that holds it.
403 permission A console session or an OAuth connection whose member is not an admin changes workspace preferences. Ask an admin.
403 USER_IDENTITY_REQUIRED An API key calls /notifications/preferences/me. Use a console session or an OAuth token.
400 webhook_test_failed The test endpoint did not answer 2xx. Check the URL and that the endpoint is reachable from the internet.
400 VALIDATION_ERROR A field is out of range, an unknown type is named, or the body is empty. Fix the body.

Was this page helpful?