# Retrieve notification Source: https://docs.bodhveda.com/api-reference/endpoint/notifications/get-notification GET /notifications/{notification_id} Retrieve a single notification by its id. Sending is **asynchronous**: the [send endpoint](/api-reference/endpoint/notifications/send-notification) accepts the notification and returns its id with `status: "enqueued"`, then a worker resolves in-app delivery and — when the send included an `email` block — the email. Poll this endpoint to read the resolved in-app `status` and the email delivery outcome on `email` (whether it was `sent`, `delivered`, `bounced`, …). Retrieve a single notification by the `id` returned from [send a notification](/api-reference/endpoint/notifications/send-notification). Because sending is **asynchronous**, this is how you learn what actually happened to a send: * `status` — the **in-app** outcome. `enqueued` right after the send, then `delivered`, `muted` (preferences disallow), `quota_exceeded`, or `failed`. * `email` — the **email** outcome, present only when the send included an `email` block. It has its own lifecycle: `pending` → `sent` (provider accepted) → `delivered` / `bounced` / `complained` (from provider webhooks), or `failed` / `muted` / `no_contact`. Poll this endpoint after a send to confirm email delivery. `email.delivered_at` is set once the provider confirms delivery; `email.bounced_at` / `email.complained_at` flag problems. # Send notification Source: https://docs.bodhveda.com/api-reference/endpoint/notifications/send-notification POST /notifications/send Start sending notifications through Bodhveda API. A send names an optional `target` (`channel`/`topic`/`event`) and carries a `payload` (in-app), an `email` block, or both. The mediums it asks for are the mediums it carries. ### Targets and your catalog By default you can send **any** target, cataloged or not. Cataloging a target — creating a project preference for it — is what puts it on your recipients' preference screen and lets `email` resolve to deliverable; an uncataloged target still sends in-app, but no recipient can mute it. If the project has **strict targets** turned on (a per-project setting, **off by default**), this endpoint instead rejects a send whose `(target, medium)` has no matching catalog entry — see the `400` below. A `topic: any` catalog entry satisfies the check for every concrete topic beneath it, so one entry covers an unbounded set of runtime-generated topics; you never need one entry per resource id. A send carrying no `target` at all is never checked. Send a **direct** notification to a specific recipient or send a **broadcast** to all recipients subscribed to a `target`. * **Direct**: If `recipient_id` is set, `target` is optional. * **Broadcast**: If `recipient_id` is null, `target` is required. A send must carry **at least one content block** — `payload` for in-app, `email` for email. Omitting both returns a `400`, since such a send names no medium. **The target must be cataloged.** If your project has no project-level preference for the `(target, medium)` a send is asking for, the request is rejected with `400` and nothing is written — for direct and broadcast alike. A `topic: any` catalog entry satisfies the gate for every concrete topic beneath it. See [the catalog is a gate](/docs/concepts/preferences#the-catalog-is-a-gate). Sending is **asynchronous**. A direct send returns as soon as the notification is accepted — the response carries the notification `id` with `status: "enqueued"`. Preference gating, quota, and email are all resolved by a background worker. Read the resolved outcome back with [retrieve a notification](/api-reference/endpoint/notifications/get-notification). ## Delivering email Include the optional typed `email` block (`subject`, `html`, `text`) to also send an **email**. Its presence is your "email is eligible" signal — omit it and no email is sent (there is no fallback that derives an email from `payload`). See [mediums](/docs/concepts/mediums) for the full model. * **Broadcast email is capped.** A broadcast carrying an `email` block fans out to eligible recipients up to the project's `max_broadcast_recipients_for_email`. Exceeding the cap **blocks email entirely** rather than mailing an arbitrary subset — a truncated blast looks like it worked. * **No templating.** You render the subject/HTML/text yourself (e.g. with `@react-email`) and pass the result. `text` is optional and derived from `html` when omitted. * Past the gate, email fires only when the recipient's email preference is enabled and they have a **primary email** [contact](/api-reference/endpoint/recipients/contacts/create-contact). Otherwise the send still succeeds and the email is skipped. * The email is delivered by a background worker, so its outcome is **not** on the send response. Read it back on the notification's `email` field via [retrieve a notification](/api-reference/endpoint/notifications/get-notification). ## Email without an in-app notification On a **direct** send, `payload` is optional. Omit it and Bodhveda sends the email **without** creating an in-app notification — useful when the two mediums want different timing (an instant in-app row per event, but one debounced email covering several). ```json theme={null} { "recipient_id": "recipient_123", "target": { "channel": "conversation", "topic": "thread_7", "event": "reply" }, "email": { "subject": "3 new messages on your thread", "html": "

Vikram and 2 others replied.

" } } ``` The notification is still created and still returns an `id` — you need one to read the email outcome back — but its `status` is `not_requested` and it is excluded from the recipient's [feed](/api-reference/endpoint/recipients/notifications/list-notifications), their [unread count](/api-reference/endpoint/recipients/notifications/unread-count), and mark-all-read. The recipient's **in-app** preference does not apply to it; the email gates above still do. An explicit `"payload": null` is treated the same as omitting it. `payload` remains **required on a broadcast**. # Create a catalog entry Source: https://docs.bodhveda.com/api-reference/endpoint/preferences/create-project-preference POST /preferences Create a single catalog entry. **Strict**: an entry for the same `(channel, topic, event, medium)` returns `409`. Use `PATCH /preferences/{preference_id}` to change an existing entry, or `PUT /preferences` to set a whole catalog. Add one entry to your project's preference catalog. **Strict** — creating an entry whose `(channel, topic, event, medium)` already exists returns `409`. To change an existing entry use [update](/api-reference/endpoint/preferences/update-project-preference); to declaratively set a whole catalog use [bulk upsert](/api-reference/endpoint/preferences/upsert-project-preferences). # Delete a catalog entry Source: https://docs.bodhveda.com/api-reference/endpoint/preferences/delete-project-preference DELETE /preferences/{preference_id} Delete a catalog entry, un-cataloging the `(target, medium)`. Delete a catalog entry, un-cataloging the `(target, medium)`. Un-cataloging a `(target, email)` turns email off for any recipient who was relying on the catalog default (they had set no preference of their own). # Get a catalog entry Source: https://docs.bodhveda.com/api-reference/endpoint/preferences/get-project-preference GET /preferences/{preference_id} Retrieve a single catalog entry by ID. Retrieve a single catalog entry by its ID. # List the catalog Source: https://docs.bodhveda.com/api-reference/endpoint/preferences/list-project-preferences GET /preferences List every entry in the project's preference **catalog**. The project is taken from the API key. Requires a `Full access` key. List every entry in your project's preference **catalog** — the project-level rules that declare which `(target, medium)` pairs your project may send and the default a recipient inherits. The project is taken from the API key. This is distinct from a [recipient's own preferences](/api-reference/endpoint/recipients/preferences/list-preferences). To manage the catalog from the dashboard instead, go to **Bodhveda Console > Preferences**. # Update a catalog entry Source: https://docs.bodhveda.com/api-reference/endpoint/preferences/update-project-preference PATCH /preferences/{preference_id} Update a catalog entry's label and default. The natural key (`channel`/`topic`/`event`/`medium`) is immutable. Update a catalog entry's `name`, `description` and `default_enabled`. The natural key (`channel`/`topic`/`event`/`medium`) is immutable — to change it, delete the entry and create a new one. # Set up the catalog (bulk) Source: https://docs.bodhveda.com/api-reference/endpoint/preferences/upsert-project-preferences PUT /preferences Declaratively merge a whole catalog in one call — the primitive for a one-off "set up my project's preferences" script. Each item is upserted by its natural key (`channel, topic, event, medium`): new entries are inserted, existing ones have their label and default updated. Entries **not** in the array are left untouched, unless `prune=true`. Returns the full resulting catalog. Declaratively merge a whole catalog in one call — the primitive for a one-off "set up my project's preferences" script. Each item is upserted by its natural key (`channel, topic, event, medium`): new entries are inserted, existing ones have their name, description and default updated. Entries **not** in the array are left untouched. Pass `?prune=true` to also **delete** entries absent from the array, making it your entire desired catalog. Pruning un-catalogs a `(target, medium)`, which turns a non-`in_app` medium off for recipients relying on the default — so it is opt-in. Deliberate one-off removals go through [delete](/api-reference/endpoint/preferences/delete-project-preference). # Batch create recipients Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/batch-create-recipients POST /recipients/batch Create up to 100 recipients at once. Instead of creating one recipient per HTTP request, Bodhveda provides a batching endpoint that lets you create up to 1000 recipients in a single API call. # Add contact Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/contacts/create-contact POST /recipients/{recipient_id}/contacts Register a per-medium contact address for a recipient. Email needs a **primary** email contact to receive email. A duplicate `(medium, address)`, or a second primary for the same `(recipient, medium)`, returns `409`. Register a contact address for a recipient. To send email to a recipient, add an `email` contact and mark it `is_primary`. 💡 Sync this **server-side** (e.g. on your `/me` endpoint) so the address never rides a browser request. # Delete contact Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/contacts/delete-contact DELETE /recipients/{recipient_id}/contacts/{contact_id} Delete a recipient's contact. Requires an API key with **Full access** scope. Delete a recipient's contact. This requires an API key with **Full access** scope — a `Recipient access` key cannot delete contacts. # List contacts Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/contacts/list-contacts GET /recipients/{recipient_id}/contacts List all of a recipient's per-medium contact addresses. List a recipient's per-medium contact addresses. A recipient needs a **primary email** contact to receive email. # Set the primary contact Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/contacts/set-primary-contact PUT /recipients/{recipient_id}/contacts Idempotently ensure an address is the recipient's **primary** contact for a medium — create it if absent, update the existing primary in place if the address differs (which resets `verified_at`), or no-op if it already matches. Returns the resulting primary contact (`200`) either way, so a "keep the primary email current" sync is a single call. 💡 Sync this **server-side** so the address never rides a browser request. Idempotently ensure an address is the recipient's **primary** contact for a medium. Unlike [add contact](/api-reference/endpoint/recipients/contacts/create-contact) (which is strict and `409`s on conflict), this is a create-or-update: it creates the primary if absent, updates the existing primary in place if the address differs (which resets `verified_at`), or no-ops if it already matches — always `200`. 💡 This is the one call a **server-side** sync needs to keep a recipient's primary email current — no list-then-diff. Sync it server-side so the address never rides a browser request. # Update contact Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/contacts/update-contact PATCH /recipients/{recipient_id}/contacts/{contact_id} Update a contact's address and/or primary flag. Provide at least one field. Changing the address resets the contact's verification. Update a contact's address and/or its primary flag. Changing the address resets the contact's verification. # Create recipient Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/create-recipient POST /recipients Create a new recipient. If a recipient with the given `id` already exists, this will return a conflict error. 💡 You should use this API during your user sign up flow. # Delete recipient Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/delete-recipient DELETE /recipients/{recipient_id} Remove an existing recipient. # Delete notifications Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/notifications/delete DELETE /recipients/{recipient_id}/notifications Deletes one or more notifications for the specified recipient. # List notifications Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/notifications/list-notifications GET /recipients/{recipient_id}/notifications Retrieve a paginated list of notifications for a recipient, ordered by most recent first. This is the **recipient-facing** feed, so it excludes notifications the recipient was never shown: `muted` (their preferences disallowed it), `quota_exceeded`, and `not_requested` (an *email-only* send, which created no in-app notification). To see those, use the Console — they are exactly the rows you need when asking “why didn't they get it?”. # Unread count Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/notifications/unread-count GET /recipients/{recipient_id}/notifications/unread-count Returns the number of unread notifications for a recipient. This is the **recipient-facing** feed, so it excludes notifications the recipient was never shown: `muted` (their preferences disallowed it), `quota_exceeded`, and `not_requested` (an *email-only* send, which created no in-app notification). To see those, use the Console — they are exactly the rows you need when asking “why didn't they get it?”. # Update notifications state Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/notifications/update-state PATCH /recipients/{recipient_id}/notifications Updates the state of one or more notifications for the specified recipient. Only notifications visible in the recipient's feed are updated — `muted`, `quota_exceeded`, and `not_requested` notifications are skipped, and the returned count reflects only the rows actually changed. # Check preference Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/preferences/check-preference GET /recipients/{recipient_id}/preferences/check Resolve a single `(target, medium)` for a recipient: whether a send would **actually** deliver. `state.enabled` is the resolved decision, computed by the same cascade the delivery path uses — the recipient's exact rule → the recipient's `topic: any` rule → the project's exact rule → the project's `topic: any` rule → the medium's default (`in_app` delivers, every other medium does not). A `topic: none` target never takes an `any` rule. The target does **not** need to be in your catalog; any `(channel, topic, event)` resolves. `state.cataloged` reports whether a project-level rule exists for this exact `(target, medium)` — context, not a gate. 💡 You could use this API to conditionally render something based on whether the recipient has subscribed to the target or not. `state.enabled` is **resolved** — it is what a send to this `(target, medium)` would actually do, computed by the same [cascade](/docs/concepts/preferences#how-a-preference-resolves) the delivery path uses. The target does not need to be cataloged, or stored at all; any `(channel, topic, event)` resolves. * `inherited: false` means the recipient **has** explicitly overridden this `(target, medium)`; `true` means the value came from elsewhere in the cascade. * `cataloged: false` means your project has no rule declared for that exact `(target, medium)` — context for rendering, not a predictor of delivery. Remember the default is **per medium**: with nothing set anywhere, `in_app` resolves to `enabled: true` and `email` resolves to `enabled: false`. # List preferences Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/preferences/list-preferences GET /recipients/{recipient_id}/preferences Every `(target, medium)` known for this recipient, each with the state a send would **actually** act on. `state.enabled` is the **resolved** decision — the same answer the delivery path computes — not a raw stored row. Resolution walks, in order: 1. the recipient's rule for the exact target, 2. the recipient's `topic: any` rule for the channel/event, 3. the project's rule for the exact target, 4. the project's `topic: any` rule, 5. the medium's **default**. **The default is per medium:** `in_app` delivers, every other medium does not. A `topic: none` target never takes an `any` rule. The response covers every target in the project catalog **plus** any target this recipient has a rule of their own for, across the active mediums (`in_app` and `email`). So a recipient can have an entry for a `(target, medium)` you never cataloged — if they have an explicit rule for it, it is live, and this reports it. Each `state` carries: - `enabled` — whether a send to this `(target, medium)` would deliver. - `inherited` — `true` when the recipient has no rule of their own for this exact `(target, medium)`; the value came from elsewhere in the cascade. `false` means they set it explicitly. - `cataloged` — whether a project-level rule exists for this exact `(target, medium)`. This is **context, not a gate**: an explicit recipient rule on an uncataloged pair still delivers, and `in_app` delivers by default with no catalog entry at all. Use it to decide what to render, never to predict delivery — `enabled` is the answer. Every `(target, medium)` known for this recipient, each **resolved** — `state.enabled` is what a send would actually do, not a raw stored row. To manage project preferences (the catalog), use the [Project Preferences](/api-reference/endpoint/preferences/list-project-preferences) endpoints or **Bodhveda Console > Preferences**. 💡 You should show these preferences on your "Notification settings" screen where the recipient can see their current preferences and update them with [set preference](/api-reference/endpoint/recipients/preferences/set-preference). * `inherited: false` means the recipient **has** explicitly overridden this `(target, medium)`; `true` means the value came from elsewhere in the [cascade](/docs/concepts/preferences#how-a-preference-resolves) (a `topic: any` rule, the catalog, or the medium's default). * `cataloged: false` means your project has no rule declared for that exact `(target, medium)`. It is **not** a reason to treat the pair as unavailable — in-app delivers by default, and a recipient's own rule sends email regardless. It tells you what you declared, not what happens; `enabled` tells you what happens. The response includes entries for `(target, medium)` pairs you never cataloged, whenever they resolve to something a recipient can act on. That is deliberate: if a recipient has a rule for it, or a medium delivers by default, hiding it would show them a setting that disagrees with their inbox. # Set preference Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/preferences/set-preference PATCH /recipients/{recipient_id}/preferences Set a recipient's subscription state for a specific target. The `target` here can be used to set a project pereference (global-level) or a (resource-level) preference. You can use this API to : * Allow recipient to update their project preference on the "Notification's setting" screen. * Allow recipient to subscribe to something. Example, "Subscribe a channel on YouTube" via `target` like `yt_channel:mr_beast:new_video` with `subscribed: true`. # Retrieve recipient Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/retrieve-recipient GET /recipients/{recipient_id} Retrieve a recipient. # Update recipient Source: https://docs.bodhveda.com/api-reference/endpoint/recipients/update-recipient PATCH /recipients/{recipient_id} Update the name of a recipient. # Introduction Source: https://docs.bodhveda.com/api-reference/introduction Send notifications, manage recipients, their notifications and preferences. ## Base URL ``` https://api.bodhveda.com ``` All endpoints in this documentation are prefixed with `https://api.bodhveda.com`. ## Authentication All requests require the `Authorization` header with a Bearer token: ``` Authorization: Bearer YOUR_API_KEY ``` Replace `YOUR_API_KEY` with your actual API key that looks like `bv_xxxxxxxxx`. ### API Key Scopes There are 2 scopes for an API KEY: * **Full access** – All APIs are accessible with this scope. Use only on the **server side**. * **Recipient access** – All the recipient's API are accessible with this scope. Fetch and manage only their own notifications and preferences. Intended for **client-side/browser** use. > ⚠️ **Security Warning:**\ > If your `recipient_id` values are predictable (e.g., auto-incrementing integers), you **should not** expose `Recipient access` scoped API keys on the frontend.\ > Instead, route requests through your own backend to ensure recipient access is properly scoped and protected. ### Authentication Errors * If the API key is missing or invalid, you will receive a `401 Unauthorized` response. * If the API key does not have sufficient permissions, you will receive a `403 Forbidden` response. ## Response Structure All responses follow this structure: ```json theme={null} { "status": "success", // or "error" "status_code": 200, "message": "Human readable message", "errors": [], // array of error objects, if any "data": {} // or [ ] response data, if any } ``` ##### Error Object ```json theme={null} { "message": "Short error message", "description": "Detailed technical description", "property_path": "field_name", "invalid_value": "the value that caused the error" } ``` #### Example Success Response ```json theme={null} { "status": "success", "status_code": 200, "message": "Direct notification sent successfully to recipient user_123.", "data": { "notification": { "id": 42069, "recipient_id": "user_123", "payload": { "title": "Welcome!", "message": "Hey there! Thank you for joining Bodhveda." }, "broadcast_id": null, "target": { "channel": "users", "topic": "none", "event": "sign_up_welcome" }, "read": false, "opened": false, "created_at": "2025-08-11T20:53:06.081316+05:30", "updated_at": "2025-08-11T20:53:06.081316+05:30" }, "broadcast": null } } ``` #### Example Error Response ```json theme={null} { "status": "error", "status_code": 400, "message": "Invalid request payload", "errors": [ { "message": "Recipient ID is required", "description": "Recipient ID cannot be empty", "property_path": "recipient_id", "invalid_value": "" } ] } ``` ## Response codes Bodhveda uses standard HTTP codes to indicate the success or failure of your requests. In general, `2xx` HTTP codes correspond to success, `4xx` codes are for user-related failures, and `5xx` codes are for infrastructure issues. | Status | Description | | ------ | ----------------------------------------- | | `2xx` | Successful request. | | `400` | Invalid input or malformed request | | `401` | The API Key is missing or invalid. | | `403` | The API key has insufficient permissions. | | `404` | The resource was not found. | | `409` | The resource already exists. | | `429` | The rate limit was exceeded. | | `5xx` | Indicates an error with Bodhveda servers. | ## Rate Limiting * The API enforces rate limits to prevent abuse. * If you exceed the allowed rate, you will receive a `429 Too Many Requests` response. * Standard limit: 100 requests per minute for a project (subject to change). # Mediums Source: https://docs.bodhveda.com/docs/concepts/mediums In-app and email delivery in Bodhveda A **medium** is a delivery transport. Bodhveda supports two today: * **`in_app`** — the notification inbox you read via the [notifications API](/api-reference/endpoint/recipients/notifications/list-notifications). This is the default and always available. * **`email`** — an email delivered through your own email provider (Resend in v1). Configured per project in the [Console](https://console.bodhveda.com). A single [send](/api-reference/endpoint/notifications/send-notification) can fan out to both. You control which mediums are attempted per send by the **content blocks** you include. ## Content block implies intent Each medium has its own content block on the send call, and **including a block is how you say "attempt this medium"**: * `payload` ⇒ the notification is written to the **in-app** inbox. * `email` ⇒ email is **eligible** for this send. There is no `mediums` array to set, and **no fallback that derives an email from `payload`** — if there is no `email` block, no email is sent. ```json theme={null} { "recipient_id": "recipient_123", "target": { "channel": "digest", "topic": "none", "event": "sent" }, "payload": { "title": "Your daily digest is ready." }, "email": { "subject": "Your daily digest", "html": "

Your daily digest

3 new follow-ups today.

" } } ``` The rule cuts both ways: **omit `payload` and no in-app notification is created**. ## Email-only sends On a **direct** send, `payload` is optional. A send carrying only an `email` block delivers the email and creates **no in-app notification**: ```json theme={null} { "recipient_id": "recipient_123", "target": { "channel": "conversation", "topic": "thread_7", "event": "reply" }, "email": { "subject": "3 new messages on your thread", "html": "

Vikram and 2 others replied.

" } } ``` This exists because in-app and email often want **different timing**. A support inbox wants one in-app row per reply, the instant it happens — but a single *debounced* email covering the last five minutes, rather than five separate emails. That is two sends: an instant in-app one, and a later email-only one. Without this, the debounced email would drop a duplicate row into the feed minutes after the instant one. A send must carry **at least one** content block. Omitting both `payload` and `email` returns a `400` — such a send names no medium, so it would do nothing. An explicit `"payload": null` counts as omitted. The notification still exists — you get an `id` back, and it carries the email delivery outcome for [retrieval](/api-reference/endpoint/notifications/get-notification) and shows up in the Console. It just isn't a recipient-facing one: its `status` is `not_requested`, and it is excluded from the recipient's [feed](/api-reference/endpoint/recipients/notifications/list-notifications), their [unread count](/api-reference/endpoint/recipients/notifications/unread-count), and mark-all-read. Because in-app was never requested, the recipient's **in-app** preference is irrelevant to such a send. It is still gated by the email catalog, the recipient's email preference, and a primary email contact, exactly like any other email. `payload` remains **required on a broadcast** — see below. ## Email on a broadcast A broadcast may carry an `email` block, and each matching recipient gets their own email. The per-medium gates below apply per recipient, so a broadcast reaches the intersection of its audience and the recipients whose email preference is on and who have a primary email contact. Two rules are specific to broadcasts: * **`payload` is required.** Email-only broadcasts are not supported, unlike email-only direct sends. A broadcast is the high blast-radius path, and "it also landed in their inbox" is what makes a mistaken send visible and recoverable afterwards. Without this rule, a fire-and-forget mass email would leave no in-product trace. * **The email fan-out is capped per project**, at 100 recipients by default. This is a safety rail, not a billing limit — raise it in your project's email settings when you mean to. Exceeding the cap **blocks the email half of the broadcast entirely** rather than emailing the first 100. A partial mass email is worse than none: you cannot tell who got it without reading the delivery rows, and re-sending double-sends everyone who did. The in-app half still delivers to the full audience. The cap is enforced at fan-out, not at request time — the audience is not known when the send is accepted. ## Each medium is gated independently Even when an `email` block is present, email fires only when **all** of the following hold: 1. **Catalog** — the project has declared the `(target, email)` pair as a subscribable [preference](/docs/concepts/preferences). 2. **Preference** — the recipient's **email** preference for that target is enabled. 3. **Contact** — the recipient has a **primary email** [contact](/docs/concepts/recipients). In-app and email preferences are toggled **independently** for the same target, so a recipient can keep the in-app bell while turning email off (and vice-versa). When a medium is skipped or fails, the send still succeeds (a partial-medium failure never rejects the whole send). Because sends resolve asynchronously, the per-medium outcome is not in the send response — read it back from [retrieve a notification](/api-reference/endpoint/notifications/get-notification), which carries the in-app `status` and the `email` delivery outcome. ## Unsubscribe Every outbound email carries the one-click `List-Unsubscribe` headers that Gmail and Yahoo require. Bodhveda hosts that page itself — when a recipient clicks it, Bodhveda flips that recipient's **email** preference for that target off, exactly as if they had toggled it in your settings UI. Subsequent sends then record the email as `muted`. That surface is automatic and there is nothing to call. The **visible unsubscribe link in your email body** is yours to build, and the same bulk-sender rules expect one. See [Unsubscribe](/docs/concepts/unsubscribe) for both surfaces, and for what a spam complaint does. # Notifications Source: https://docs.bodhveda.com/docs/concepts/notifications What are notifications in Bodhveda? A **notification** is a message sent to a recipient about an event. Notifications can be: * **Direct**: Sent to a specific recipient. * **Broadcast**: Sent to all recipients subscribed to a target. Notifications include a payload (custom data) and are categorized by their target. A direct notification can also fan out to **email** by including an `email` block on the send — see [mediums](/docs/concepts/mediums). Email is direct-only; broadcasts remain in-app. On a direct send the `payload` is **optional**: omit it and Bodhveda delivers the email without creating an in-app notification (an [email-only send](/docs/concepts/mediums#email-only-sends)). A send must carry at least one of `payload` or `email`. Broadcasts always require a `payload`. ### Status Every notification carries a `status` — the **in-app** outcome, resolved asynchronously after the send is accepted: | Status | Meaning | | ---------------- | ------------------------------------------------------------------- | | `enqueued` | Accepted; the worker has not resolved it yet. | | `delivered` | Written to the recipient's inbox. | | `muted` | The recipient's preferences disallowed it. | | `quota_exceeded` | The project was over its plan limit. | | `failed` | Delivery failed. | | `not_requested` | The send carried no `payload`, so no in-app delivery was requested. | `not_requested` is the odd one out: it is set **when the send is accepted** and never changes, because there is nothing to resolve. Those notifications are hidden from the recipient's feed, unread count, and mark-all-read — but they still carry the email delivery outcome, so you can retrieve one by `id` to see whether the email sent. Each *other* medium's outcome lives on its own delivery record rather than on this scalar — retrieve a notification by `id` to read the `email` outcome alongside `status`. A direct notification will always be delivered to the recipient unless the recipient has unsubscribed that target. A broadcast notification will only be delivered to the recipients who are subscribed to the target. #### How does Bodhveda determine if a recipient should receive a broadcast notification or not? Let's assume a broadcast was sent for a new comment that was made on post with id `12345`. The target used for this broadcast is `posts:12345:new_comment`. Bodhveda will lookup recipients who have subscribed to this target via either `posts:12345:new_comment` or via `posts:any:new_comment` target. `any` has special behaviour in Bodhveda. Learn more about [targets](/docs/concepts/targets) and [preferences](/docs/concepts/preferences). # Preferences Source: https://docs.bodhveda.com/docs/concepts/preferences How notification preferences work **Preferences** let recipients control which notifications they receive. Preferences are set per target and can be: * **Inherited**: Using the project's default setting. * **Overridden**: Explicitly set by the recipient. Use recipient's project preferences to build notification settings screens for your users. ## Preferences are per medium Each preference applies to a single [medium](/docs/concepts/mediums). The `in_app` and `email` preferences for the same target are toggled **independently**, so a recipient can keep the in-app bell on while turning email off. * **Project-level** preferences form the **catalog**: they set the default for a `(target, medium)`. Only `in_app` and `email` can be cataloged today. * **Recipient-level** preferences are the per-recipient opt-in/opt-out for a `(target, medium)`. When you [set](/api-reference/endpoint/recipients/preferences/set-preference) or [check](/api-reference/endpoint/recipients/preferences/check-preference) a preference, pass a `medium` (`in_app` or `email`). **It defaults to `in_app`** when omitted, so existing integrations keep working unchanged. ## Strict targets **Strict targets** is a per-project setting that turns the catalog into a gate: with it on, a send whose `(target, medium)` has no project-level preference is rejected with `400` and nothing is written. ```json theme={null} { "message": "Target billing/none/invoice_paid is not in this project's catalog for the in_app medium. Create a project preference for it before sending, or turn off strict targets in your project settings." } ``` **It is off by default.** With it off, sends to targets you have never cataloged are accepted, and the medium's default decides what happens — in-app delivers, email does not. ### Why off by default Strictness is a maturity setting, not a correctness rule. On from the start, your very first targeted send fails with *"create a project preference for it before sending"* — at the moment you have built nothing and have no reason to know what a catalog is. That is a wall, not a guardrail. The order that works is the order you will naturally take: 1. Send something untargeted. No setup at all. 2. Add a `target`, because you want per-notification analytics. 3. Discover preferences, because you want recipients to be able to mute it. 4. Seed the catalog from your deploy, so it stops drifting from your code. 5. **Turn strict targets on**, once your catalog is stable and you want a typo to fail loudly. ### When to turn it on Turn it on once your catalog is seeded from your deploy pipeline and you would rather a bad send fail than succeed quietly. What you get is the difference between a bug found on the first call and one found the week someone asks why they were never notified. The alternative — accepting the send and recording it as muted — hands you a `200` for a notification that will never reach a human, and makes "the recipient opted out" indistinguishable from "you typo'd the event name". So Bodhveda rejects rather than muting. Leaving it off has a real cost worth naming: **an uncataloged target has no preference surface.** It appears on no settings screen, so a recipient cannot discover it, let alone switch it off. Off does not mean *no consequences*, it means *the consequences are silent*. Your console's project settings list the targets you have sent but not cataloged, so turning strict targets on is never a blind switch — you can see exactly what would start failing. ### What the gate checks The gate checks **existence**, not `default_enabled`. A cataloged entry with `default_enabled: false` is a real state — *defined, currently switched off* — so sending to it is accepted and simply reaches nobody. Only a missing entry is an error. It applies per medium, to the mediums a send actually asks for. A send carrying only `payload` needs an `in_app` entry; one carrying only `email` needs an `email` entry; one carrying both needs both. It applies to **direct sends and broadcasts alike**. With strict targets off, a broadcast to an uncataloged target is accepted and reaches the recipients who explicitly subscribed to it, if any; the rest are reported as `excluded_not_cataloged` in the broadcast's audience breakdown. **A send with no `target` at all is never gated,** whatever the setting — it claims no target, so there is nothing to check it against. ## How a preference resolves Whether a target delivers is **resolved**, not read from a single row. The first rule that matches wins: 1. A **mandatory** catalog entry for the target (see below). 2. The recipient's rule for the exact target. 3. The recipient's `topic: any` rule for that channel/event. 4. The project's rule for the exact target (the catalog). 5. The project's `topic: any` rule. 6. The **medium's default** — in-app delivers, every other medium does not. A `topic: none` target never takes an `any` rule — `none` means "this rule has no topic". The [preference read](/api-reference/endpoint/recipients/preferences/list-preferences) reports `state.cataloged` and `state.mandatory` separately from `state.enabled`. Use them to decide what to render on a settings screen; use `enabled` to know what will actually happen. ## Wildcards satisfy the gate A `topic: any` catalog entry matches every concrete topic under that channel and event — for the gate exactly as for resolution. One entry covers an unbounded set of runtime-generated topics. This is what makes per-resource muting practical. Catalog `comments/any/reply` once, then send `comments/post_812/reply`, `comments/post_913/reply`, and so on. Every send passes the gate, and a recipient rule on one exact target mutes that one thread and nothing else — no state on your side. Do not conclude that a per-resource target needs one catalog entry per resource id. It never does, and a catalog with a row per post is one that cannot be seeded from your code. One wildcard entry is the whole answer. ## Mandatory entries Some notifications must not be optional: password resets, security alerts, billing failures, a one-shot welcome. But everything in the catalog is normally something a recipient can switch off. Set `mandatory: true` on a catalog entry to resolve that. The entry exists, so sends pass the gate; the recipient's toggle is refused with a `400`, and any rule they already had is ignored. Mandatory is **independent of strict targets**. It is a property of the catalog entry, not of the gate, so it behaves identically whether or not strict targets is on: the entry is what makes the target non-negotiable, and cataloging it is what you had to do anyway to give recipients a switch you then refuse to honour. Render mandatory entries as **locked**, not as a switch. A toggle that saves and changes nothing is worse than one that refuses — the recipient walks away believing they opted out. `default_enabled` still applies to a mandatory entry, so setting it `false` stops the notification. Mandatory removes the *recipient's* choice, not yours. ## Seed the catalog from your deploy Your desired catalog lives in your code; the real one lives in Bodhveda. They drift the moment you ship a new event and forget to update Bodhveda to match. Derive the catalog from whatever already defines your events, and push it with [upsert preferences](/api-reference/endpoint/preferences/upsert-project-preferences) as a **step in your deploy pipeline** rather than a one-time setup task. It is an idempotent merge, so a deploy that changes nothing is a no-op. This is worth doing before you turn strict targets on, and it is worth doing even if you never do. With the gate off, drift is silent: the notification sends, but the target is on no settings screen, so no recipient can mute it. Once strict targets is on, seed **before** the new code starts serving, and let a failed seed **fail the deploy**. Ship code that sends a target you have not cataloged yet and every one of those notifications returns `400`. Stopping the deploy leaves your previous version running, which only sends targets that are already cataloged. Run it on **every** deploy, not just the deploy that adds an event. A catalog seeded by hand is a catalog that falls behind the code that depends on it. If you want to build something like Reddit where an author is subscribed to their own post and any other user can explictly *follow* someone else's post as well. * For the author, you can send a direct notification and it will always deliver unless the recipient explicity unsubscribe to that target. You should still use `target` so that you get analytics based on targets. * For the user who wants to follow someone else's post, you should subscribe the recipient to that target and if they unfollow the post, unsubscribe them from that target. * You could subscribe the author to their post's target so that whenever some event is triggered on that post, you can just send a broadcast notification and the author and the *other user* both will recieve the notification. # Recipients Source: https://docs.bodhveda.com/docs/concepts/recipients Understand recipients in Bodhveda A **recipient** is an end user who receives notifications. Each recipient has a unique `id` and can have preferences for different notification targets. Recipients are created when you send notifications or explicitly via the API. ## Contacts To deliver over a [medium](/docs/concepts/mediums) other than the in-app inbox, a recipient needs a **contact** — a per-medium address. To receive **email**, a recipient must have a **primary email** contact. Manage contacts under [`/recipients/{recipient_id}/contacts`](/api-reference/endpoint/recipients/contacts/list-contacts): * Each contact has a `medium` (only `email` is used today; `sms`, `web_push`, and `mobile_push` are reserved), an `address`, and an `is_primary` flag. * Only **one primary** contact is allowed per `(recipient, medium)`. Email is sent to the primary email contact. * Adding a duplicate address, or a second primary for the same medium, returns `409`. * Creating, listing, and updating contacts work with a `Full access` **or** `Recipient access` API key; **deleting** a contact requires `Full access`. Sync a recipient's email **server-side** (for example on your `/me` endpoint) rather than from the browser, so the address never travels on a client-side call. # Targets Source: https://docs.bodhveda.com/docs/concepts/targets Learn about notification targets in Bodhveda A **target** defines *who should get a notification* and *how it should be categorized*. It typically consists of: * **Channel**: Broad category (e.g., `posts`) * **Topic**: Subcategory or specific resource (e.g., `post_id_123`, `any`, or `none`) * **Event**: What happened (e.g., `new_comment`) Targets are used for both sending notifications and managing recipient preferences. You can send any target out of the box. Giving a target a project-level preference — **cataloging** it — is what puts it on your recipients' settings screen so they can mute it. Once your catalog is stable you can turn on [strict targets](/docs/concepts/preferences#strict-targets) and an uncataloged target becomes a `400` instead. #### `any` and `none` have special meaning: * `any` means **all topics under this channel/event**. * `none` means **only the base channel/event**. * `any` is **not** a valid `topic` when sending a notification, but both are valid for preferences. A preference with the target `posts:any:new_comment` will match a notification with target `posts:post_id_123:new_comment`, but a preference with the target `posts:none:new_comment` will **only** match a notification with target `posts:none:new_comment`. This applies to [strict targets](/docs/concepts/preferences#strict-targets) too, which is what makes per-resource targets practical: catalog `posts:any:new_comment` once and every `posts:post_id_123:new_comment` you send passes, however many post ids there turn out to be. One entry per post id is never the answer. # Unsubscribe Source: https://docs.bodhveda.com/docs/concepts/unsubscribe How recipients opt out of email, and what you have to build Every email you send through Bodhveda needs a way out of it. There are **two** unsubscribe surfaces: | Surface | Who builds it | Where it appears | Works on | | ------------------------------- | --------------------------- | ---------------------------------------------------------------- | ------------------------ | | **One-click header** (RFC 8058) | **Bodhveda**, automatically | The *Unsubscribe* chip your mail client shows next to the sender | Direct **and** broadcast | | **In-body link** | **You**, in your email HTML | The "unsubscribe" line in your email footer | Direct only | Both end in the same place: the recipient's **email** preference for that target, switched off. The header alone is a complete unsubscribe. **You do not have to build anything** — the in-body link is an addition you make when you want the way out to be visible in the message itself, and it is worth making for anything a recipient might describe as promotional. ## The one-click header is automatic Bodhveda attaches `List-Unsubscribe` and `List-Unsubscribe-Post` headers to every outbound email, and hosts the page they point at. You do not call anything, configure anything, or put anything in your template — this surface is already done. ``` List-Unsubscribe: List-Unsubscribe-Post: List-Unsubscribe=One-Click ``` The token in that URL is self-contained and signed: it names the project, the recipient, and the target, and Bodhveda verifies the signature rather than looking anything up. It is valid for **180 days** from the send, because a recipient may reasonably unsubscribe from a months-old email. The hosted page is deliberately split across two methods: * **`GET`** verifies the token and renders a confirmation page. It changes nothing. * **`POST`** performs the unsubscribe. This is both what the confirmation button submits and what Gmail and Yahoo call directly for one-click. The `GET` is side-effect-free on purpose. Mail scanners, link prefetchers, and security appliances fetch every URL in a message, headers included. A mutating `GET` would unsubscribe recipients who never clicked anything. Gmail's and Yahoo's bulk-sender rules require this header, and require the unsubscribe to take effect within two days. Bodhveda's takes effect immediately. ## The in-body link is yours to build — on direct sends Those same bulk-sender rules also want a **visible** unsubscribe link in the message body of promotional mail. Bodhveda does not give you one: the signed token above is built on the send path and goes straight into the header. It is never returned to you, and there is no endpoint that mints one. So the footer link points at **a page you host**, and that page calls [set preference](/api-reference/endpoint/recipients/preferences/set-preference) with `medium: "email"` and `enabled: false`. The only real problem to solve is that the page is reached from an inbox, where nobody is logged in. A bare `?user=123` would let anyone unsubscribe anyone, so the link needs a signed token of your own. This works on **direct** sends, where you know the recipient at the moment you compose the email. On a broadcast you do not — you make one call and Bodhveda picks the audience — so there is no per-recipient link to embed. See [Broadcasts rely on the header](#broadcasts-rely-on-the-header). ### 1. Sign a token HMAC the recipient id with a secret only your server knows. No database row, nothing to expire. ```ts unsubscribe-token.ts theme={null} import { createHmac, timingSafeEqual } from "crypto"; const PURPOSE = "unsub-digest-email"; const secret = () => process.env.UNSUBSCRIBE_SECRET!; const sign = (recipientId: string) => createHmac("sha256", secret()).update(`${PURPOSE}:${recipientId}`).digest("base64url"); export function createUnsubscribeToken(recipientId: string): string { const payload = Buffer.from(recipientId, "utf8").toString("base64url"); return `${payload}.${sign(recipientId)}`; } // Returns the recipient id if the token is authentic, otherwise null. export function verifyUnsubscribeToken(token: string): string | null { const [payload, providedSig] = token.split("."); if (!payload || !providedSig) return null; const recipientId = Buffer.from(payload, "base64url").toString("utf8"); if (!recipientId) return null; const expected = Buffer.from(sign(recipientId)); const provided = Buffer.from(providedSig); if (expected.length !== provided.length) return null; if (!timingSafeEqual(expected, provided)) return null; return recipientId; } ``` Include the `PURPOSE` string in what you sign. It stops a token minted for unsubscribing from being replayed against some other feature that happens to sign the same recipient id with the same secret. Compare signatures with a constant-time function (`timingSafeEqual`, `hmac.Equal`), never `===`. A plain string comparison leaks how much of a signature is correct, one byte at a time. ### 2. Put the link in the footer ```ts theme={null} const url = `https://yourapp.com/unsubscribe?token=${createUnsubscribeToken(recipientId)}`; await bodhveda.notifications.send({ recipient_id: recipientId, target: { channel: "digest", topic: "none", event: "sent" }, email: { subject: "Your daily digest", html: `

3 new follow-ups today.

Unsubscribe from these emails.

`, }, }); ``` Build the token per send. Do not store it — it is derived from the recipient id, so it is free to recompute. ### 3. Flip the preference on your page ```ts theme={null} import { Bodhveda } from "@bodhveda/js"; const bodhveda = new Bodhveda(process.env.BODHVEDA_API_KEY!); export async function unsubscribe(token: string) { const recipientId = verifyUnsubscribeToken(token); if (!recipientId) return { ok: false }; await bodhveda.recipients.preferences.set(recipientId, { target: { channel: "digest", topic: "none", event: "sent" }, medium: "email", state: { enabled: false }, }); return { ok: true }; } ``` Setting `enabled: false` is **idempotent** — it upserts the same row every time. That is what makes it safe for a link prefetcher to hit your page, and it is why you can unsubscribe on page load rather than behind a confirmation button, if you would rather spend one click than two. Offer a **Resubscribe** button on the resulting page and a prefetch costs the recipient nothing. Mark the page `noindex`. It is a public URL carrying a token, and it has no business in a search index. ### Or just link to your settings screen If your emails go to signed-in users and you would rather not host a token flow at all, link the footer to your own notification settings page. It is one line and it is honest. The trade is that it costs a login. A recipient who wants out and hits a login wall marks the message as spam instead, which is strictly worse for you than an unsubscribe — a complaint hurts your sending reputation, and Bodhveda unsubscribes them anyway. ## Broadcasts rely on the header A [broadcast that carries email](/docs/concepts/mediums#email-on-a-broadcast) has **no in-body unsubscribe link, and cannot have one.** You make a single send and Bodhveda resolves the audience during fan-out, so at the moment you write the HTML there is no recipient to build a link for — and by the time there is, you are not in the loop. Your own signed token cannot close this gap either, for the same reason. This is not a degraded experience. Bodhveda builds a genuine per-recipient signed URL for every broadcast email and attaches the same `List-Unsubscribe` headers it attaches to direct mail, so every recipient gets a working one-click unsubscribe in their mail client. The header is doing the whole job, and it is the job that Gmail and Yahoo actually check. It holds up because broadcast email is not a bulk-mail channel here. The fan-out is capped at **100 recipients per broadcast** by default, while the bulk-sender rules that expect a visible body link start at thousands of messages a day. A capped, target-scoped broadcast to the people watching one thread is not the thing those rules were written for. If you raise the cap and start sending genuinely promotional broadcasts, header-only stops being enough — that mail wants a visible unsubscribe in the body and Bodhveda cannot yet put one there. Send promotional email as direct sends, where you can embed your own link. ## What unsubscribing actually does Every path — the hosted one-click page, your own page, a spam complaint, a toggle in your settings UI — converges on the same write: a **recipient-level preference** for that `(target, email)`, set to disabled. That means: * Subsequent sends to that target still succeed, but the email is recorded as `muted` with `failure_reason: preference_disabled`. You can see it on [retrieve a notification](/api-reference/endpoint/notifications/get-notification) and in the Console. * The recipient's **in-app** notifications for the same target are untouched. Mediums are [gated independently](/docs/concepts/mediums) — unsubscribing from email is not going quiet. * Your settings screen reflects it immediately, because it reads the same resolved preference. Resubscribing is the same call with `enabled: true`. ## Unsubscribe is per target, not global An unsubscribe switches off **one target**, not email as a whole. A recipient who unsubscribes from your daily digest still gets replies to their conversation threads. That is usually what you want — it is the difference between "stop this one thing" and "stop everything". There is no single "all email off" switch. To offer one, disable each cataloged `(channel, event)` pair for that recipient. A `topic: any` recipient rule covers every topic under one channel and event with a single write, so the loop is over your catalog's channel/event pairs, not over every resource id. A recipient who wanted everything off and only lost one target will unsubscribe again from the next email, and then report it as spam. If your product sends more than one kind of email, give them a real global switch. ## Mandatory targets refuse the unsubscribe A [mandatory](/docs/concepts/preferences#mandatory-entries) catalog entry cannot be switched off — the write is refused with a `400`, from the hosted page and your own page alike. Password resets and security alerts are supposed to be undeclinable. Email on a mandatory target therefore carries **no `List-Unsubscribe` header at all**. Bodhveda suppresses it deliberately: advertising one-click unsubscribe would put an *Unsubscribe* chip in the recipient's mail client that fails when clicked, and a chip that does nothing is worse than no chip — the recipient walks away believing they opted out. No header is the honest signal that this mail is not optional. Do not put your own in-body unsubscribe link on a mandatory target either. The [set preference](/api-reference/endpoint/recipients/preferences/set-preference) call behind it is refused with the same `400`, so the link would fail exactly like the header would have. ## Spam complaints unsubscribe too When your email provider reports a **complaint** (the recipient hit "report spam"), Bodhveda disables that recipient's email preference for that target automatically, exactly as an unsubscribe would. The complaint is also recorded on the delivery row, so you can see it. This is target-scoped, matching an explicit unsubscribe. It is not an address-level suppression across every target. Complaint handling depends on your provider's webhook reaching Bodhveda. Configure it in your project's email settings, or complaints will be invisible and the recipient will keep receiving mail they have already reported. # Introduction Source: https://docs.bodhveda.com/docs/introduction Bodhveda helps you add in-app notifications to your product in minutes, not weeks. ## Get started Bodhveda is [open source](https://github.com/MudgalLabs/bodhveda), so feel free to create issues to report bugs, request features or anything you may need. Found a bug? [Open an issue](https://github.com/MudgalLabs/bodhveda/issues). Need help? Email [hey@ceoshikhar.com](mailto:hey@ceoshikhar.com). Start sending notifications in minutes. Explore the API in depth. Explore the available Bodhveda SDKs for different langauges and frameworks. Explore concepts that make up Bodhveda.
# Quickstart Source: https://docs.bodhveda.com/docs/quickstart Send your first notification in minutes using Bodhveda API or Console. ## Prerequisites To follow this guide with the API, you’ll need to: * Go to [Bodhveda Console](https://console.bodhveda.com). * Create a **new project**. * Click on **API Keys** in the sidebar. * Click on **Create API Key** and generate an API key with `Full access` scope. ## Send direct notification with API Use the [send notification](/api-reference/endpoint/notifications/send-notification) API to send a direct notification to a [recipient](/docs/concepts/recipients). If the recipient doesn't exist, Bodhveda creates it automatically when sending a direct notification. ```bash theme={null} curl -X POST https://api.bodhveda.com/notifications/send \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "recipient_id": "recipient_123", "payload": { "title": "Welcome!", "message": "Thanks for joining." } }' ``` Then you can use the [list recipient's notifications](/api-reference/endpoint/recipients/notifications/list-notifications) API and you will see the notification you just sent earlier. This send carries no `target`, and adding one needs no setup either — targets work out of the box. Targets are how you get per-notification [preferences](/docs/concepts/preferences) and analytics, so they are the next thing to reach for. Cataloging a target — creating a project preference for it — is what puts it on your recipients' settings screen so they can mute it. Until you do, the notification still sends, but nobody can switch it off. Once your catalog is stable you can turn on **strict targets** in your project settings, and an uncataloged target becomes a `400` instead of a silent gap. A `topic: any` entry covers every concrete topic beneath it, so one row like `post/any/comment` is enough for `post/123/comment`, `post/456/comment`, and the rest — no catalog write per post. ```bash theme={null} curl -X GET "https://api.bodhveda.com/recipients/recipient_123/notifications" \ -H "Authorization: Bearer YOUR_API_KEY" ``` ```json theme={null} [ { "id": 42069, "recipient_id": "recipient_123", "payload": { "title": "Welcome!", "message": "Thanks for joining." } // ... other fields. } ] ``` ## Send broadcast notification with API Broadcast to multiple recipients. This requires some setup: * At least one [recipient](/docs/concepts/recipients) must exist. * At least one project [preference](/docs/concepts/preferences) must exist. ##### **Create a recipient** Use [create recipient](/api-reference/endpoint/recipients/create-recipient) API to create a recipient in your project. ```bash theme={null} curl -X POST https://api.bodhveda.com/recipients \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"recipient_id": "user@example.com", "name": "Jane Doe"}' ``` ##### **Create a project preference** Before broadcasting, you must add at least one project preference to define a target (channel, topic, event): 1. Go to [Bodhveda Console](https://console.bodhveda.com). 2. Click on **Preferences** in the sidebar. 3. Click on **Create Preference**. 4. Define a target by mentioning the channel, topic, and event, give it a name (and an optional description), and set default to enabled. 5. Save the preference. This way all recipients are by default subscribed to this target in your project. ##### **Send broadcast notification** Use the [send notification](/api-reference/endpoint/notifications/send-notification) API to send a broadcast notification to a [target](/docs/concepts/targets) that was used to create the project preference. ```bash theme={null} curl -X POST https://api.bodhveda.com/notifications/send \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "target": { "channel": "announcements", "topic": "product", "event": "new_feature" }, "payload": { "title": "Big News!", "message": "We just launched a new feature." } }' ``` No recipient\_id makes this notification turn into a broadcast. All recipients subscribed to this target will receive this notification. ## Send notification from Console You can also send notifications from the [Bodhveda Console](https://console.bodhveda.com): 1. Go to **Notifications** tab. 2. Click on **Send Notification** to send a direct notification to a recipient or a broadcast to subscribed recipients. ##### **Next Steps** Explore the API in depth. Explore concepts that make up Bodhveda. # SDKs Source: https://docs.bodhveda.com/docs/sdks Explore the available Bodhveda SDKs for different langauges and frameworks. ### Languages These SDKs are make it easier to interact with the Bodhveda's REST APIs. * [JavaScript/TypeScript](https://github.com/MudgalLabs/bodhveda/blob/main/sdk/js/core) * [Go](https://github.com/MudgalLabs/bodhveda/tree/main/sdk/go) ### Frameworks These SDKs extend the language SDKs to give you higher level primitives to build your custom notification experiences. * [React](https://github.com/MudgalLabs/bodhveda/tree/main/sdk/js/react)