# Notifications

> Delivery channels and per-type preferences.

URL: https://renzo-digital.com/docs/resources/notifications

Renzo sends messages, such as market summaries and price alerts, by email, Telegram and WhatsApp. These calls let a customer see the channels, connect Telegram or WhatsApp, and choose which types arrive on which channel. Every call needs a token. Calls that change something also need a username.

## Endpoints

| Operation | What it does | Auth |
| --- | --- | --- |
| `GET /api/v1/notifications/types` | List the notification types with their default channels. Cursor-paginated. | Token |
| `GET /api/v1/notifications/preferences` | Read the matrix of types by channels. | Token |
| `PUT /api/v1/notifications/preferences` | Switch cells on or off. | Token and username |
| `GET /api/v1/notifications/channels` | List the channels and whether each can reach you now. | Token |
| `POST /api/v1/notifications/channels/{channel}/connect` | Start connecting a messaging app. Answers `201`. | Token and username |
| `DELETE /api/v1/notifications/channels/{channel}` | Disconnect a messaging app. Answers `204`. | Token and username |

Without a username, calls that need one answer `409` [`profile_incomplete`](https://renzo-digital.com/docs/error-codes#profile_incomplete). See [Account](https://renzo-digital.com/docs/resources/account). Any mutating call accepts an `Idempotency-Key`. See [Idempotency](https://renzo-digital.com/docs/concepts/idempotency).

## Example: turn on Telegram for a summary

First connect Telegram. The answer is `201` with a single-use link:

```bash tab="curl"
curl -X POST "$BASE/api/v1/notifications/channels/telegram/connect" \
  -H "Authorization: Bearer $TOKEN"
```

```python tab="Python"
import os

import requests

BASE = os.environ["BASE"]
TOKEN = os.environ["TOKEN"]

answer = requests.post(
    f"{BASE}/api/v1/notifications/channels/telegram/connect",
    headers={"Authorization": f"Bearer {TOKEN}"},
)
answer.raise_for_status()
print(answer.json())
```

```js tab="Node.js"
const { BASE, TOKEN } = process.env;

const answer = await fetch(`${BASE}/api/v1/notifications/channels/telegram/connect`, {
  method: "POST",
  headers: { Authorization: `Bearer ${TOKEN}` },
});
if (!answer.ok) throw new Error(`HTTP ${answer.status}`);
console.log(await answer.json());
```

```json title="Response"
{
  "channel": "telegram",
  "deep_link": "https://t.me/RenzoAlertsBot?start=Zk3p9QxT2mVw",
  "expires_at": "2026-11-04T13:40:00Z"
}
```

Open `deep_link` in Telegram and press Start. Then switch the type on for that channel:

```bash tab="curl"
curl -X PUT "$BASE/api/v1/notifications/preferences" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"preferences": [{"type_key": "market.pre_market_summary", "channel": "telegram", "enabled": true}]}'
```

```python tab="Python"
import os

import requests

BASE = os.environ["BASE"]
TOKEN = os.environ["TOKEN"]

answer = requests.put(
    f"{BASE}/api/v1/notifications/preferences",
    headers={"Authorization": f"Bearer {TOKEN}"},
    json={
        "preferences": [
            {
                "type_key": "market.pre_market_summary",
                "channel": "telegram",
                "enabled": True,
            },
        ],
    },
)
answer.raise_for_status()
print(answer.json())
```

```js tab="Node.js"
const { BASE, TOKEN } = process.env;

const answer = await fetch(`${BASE}/api/v1/notifications/preferences`, {
  method: "PUT",
  headers: { Authorization: `Bearer ${TOKEN}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    preferences: [
      {
        type_key: "market.pre_market_summary",
        channel: "telegram",
        enabled: true,
      },
    ],
  }),
});
if (!answer.ok) throw new Error(`HTTP ${answer.status}`);
console.log(await answer.json());
```

The answer is `200` with the whole matrix:

```json title="Response"
{
  "channels": ["email", "whatsapp", "telegram", "wechat"],
  "types": [
    {
      "type_key": "market.pre_market_summary",
      "label": "Pre-market summary",
      "description": "A short summary of the markets before the US open.",
      "channels": [
        { "channel": "email", "available": true, "connected": true, "enabled": true, "locked": false },
        { "channel": "whatsapp", "available": true, "connected": false, "enabled": false, "locked": true },
        { "channel": "telegram", "available": true, "connected": true, "enabled": true, "locked": false },
        { "channel": "wechat", "available": false, "connected": false, "enabled": false, "locked": false }
      ]
    }
  ],
  "email_suppression": null
}
```

## Rules and edge cases

- **Channels.** The names are `email`, `whatsapp`, `telegram` and `wechat`. `email`, `telegram` and `whatsapp` deliver. `available` is `false` when a channel cannot deliver yet, as with `wechat`, or with `whatsapp` until Meta approves its message template. On `GET /api/v1/notifications/channels`, `price_alerts_available` says whether price alerts can go out on that channel now. For `whatsapp` it is `false` while Meta has paused or recategorized the price-alert template, even when `available` is `true` because the summaries still send.
- **Email needs no setup.** It is `connected` from the start. Asking to connect or disconnect it answers `422` [`notification_channel_not_connectable`](https://renzo-digital.com/docs/error-codes#notification_channel_not_connectable).
- **WhatsApp.** It comes with any paid plan. `locked` is `true` on a cell or channel when the caller is on the free plan. WhatsApp carries price alerts and the pre-market and post-market summaries only. Connecting or turning it on from the free plan answers `403` [`notification_channel_locked`](https://renzo-digital.com/docs/error-codes#notification_channel_locked), with the `channel` and the `capability` (`notifications.whatsapp`) in the body. A customer who loses Premium keeps the WhatsApp cells as set, but nothing is queued for WhatsApp until Premium returns.
- **Connecting WhatsApp.** `POST .../channels/whatsapp/connect` answers `201` with a `deep_link` (a `https://wa.me/...` link with the text filled in) and `expires_at`. The customer must open it and press Send in WhatsApp. Renzo connects the account when that message arrives. There is no redirect back, so poll `GET /api/v1/notifications/channels` until `whatsapp` is `connected`. The customer can stop any time: reply `STOP` in WhatsApp or disconnect.
- **Connecting Telegram.** The `deep_link` is single-use. It works for 10 minutes, and `expires_at` says when it stops. After that, ask for a new one. A channel that cannot deliver right now answers `422` [`notification_channel_unavailable`](https://renzo-digital.com/docs/error-codes#notification_channel_unavailable).
- **Connected details.** A connected channel shows `display_name` and `connected_at`. Both are `null` when nothing is linked.
- **Disconnecting.** Delivery stops at once and the linked account is forgotten. Disconnecting twice is not an error. Price alerts that no chosen channel can reach any more are paused. See [Price alerts](https://renzo-digital.com/docs/resources/price-alerts).
- **Unknown channel.** A channel name Renzo does not know answers `422` [`notification_channel_unknown`](https://renzo-digital.com/docs/error-codes#notification_channel_unknown).
- **Preference cells.** A cell you never set shows the type's default. `PUT` takes `preferences`, a list of `{type_key, channel, enabled}`. Cells you leave out keep their value. The answer is the whole matrix.
- **Unknown type.** An unknown `type_key` answers `404` [`notification_type_not_found`](https://renzo-digital.com/docs/error-codes#notification_type_not_found).
- **Unavailable channel.** Connecting a channel that cannot connect now, or turning a cell on for a channel that is unknown or cannot deliver answers `422` [`notification_channel_unknown`](https://renzo-digital.com/docs/error-codes#notification_channel_unknown) or [`notification_channel_unavailable`](https://renzo-digital.com/docs/error-codes#notification_channel_unavailable). The last one lists `available_channels`. On connect it holds the messaging channels that can be connected now. On a preference it holds the channels that work for that type, so a type that WhatsApp does not carry names the others.
- **Email problems.** `email_suppression` is `bounce` when the address bounced, or `spam` when you marked our email as spam. It is `null` when email works. Turning an email cell on clears `spam`.
- **Types.** Each type has a stable `key`, a `label`, `default_channels`, and a `schedule_kind` of `hourly`, `daily` or `event`. An event is sent when something happens. For `daily`, `send_hour_local` is the hour (0 to 23) in your time zone. Types are managed by Renzo, so the list can grow.
- **Plan.** A type may have `min_product`, the lowest plan that gets it. It is `null` when every plan does. See [Plans and limits](https://renzo-digital.com/docs/concepts/plans-and-limits).
- **Paging.** `limit` on the types list defaults to 20 and may not pass 100. See [Pagination](https://renzo-digital.com/docs/concepts/pagination).
- **Messages.** Email messages carry an unsubscribe link. See [Email unsubscribe](https://renzo-digital.com/docs/resources/email). Price alert messages carry a stop link. See [Price alerts](https://renzo-digital.com/docs/resources/price-alerts).

## Errors

| Code | Status | When |
| --- | --- | --- |
| [`notification_channel_unknown`](https://renzo-digital.com/docs/error-codes#notification_channel_unknown) | 422 | The channel name is not one Renzo knows. |
| [`notification_channel_not_connectable`](https://renzo-digital.com/docs/error-codes#notification_channel_not_connectable) | 422 | The channel needs no connection step, such as email. |
| [`notification_channel_unavailable`](https://renzo-digital.com/docs/error-codes#notification_channel_unavailable) | 422 | The channel cannot deliver right now, or does not carry this type. The body lists `available_channels`: on connect, the channels that can be connected now; on a preference, the channels that carry that type. |
| [`notification_channel_locked`](https://renzo-digital.com/docs/error-codes#notification_channel_locked) | 403 | The channel, such as WhatsApp, needs a paid plan. |
| [`notification_type_not_found`](https://renzo-digital.com/docs/error-codes#notification_type_not_found) | 404 | No notification type has this key. |
| [`profile_incomplete`](https://renzo-digital.com/docs/error-codes#profile_incomplete) | 409 | The account has no username yet. |

Sign-in and request errors, such as [`token_expired`](https://renzo-digital.com/docs/error-codes#token_expired) and [`validation_failed`](https://renzo-digital.com/docs/error-codes#validation_failed), can come from any call. See [Errors](https://renzo-digital.com/docs/concepts/errors).

## Reference

- [Notifications in the API reference](https://renzo-digital.com/docs/api#tag/notifications)
