Notifications API
Every /v1/notifications endpoint: send a notification.
Base URL: https://api.nibify.app.
Send a notification
POST/v1/notifications
Creates an informational Message: it arrives on the phone, lands in the Inbox and is marked read when it is looked at, and asks for nothing back. There is no pending state, no expiry and no callback — what happens to it next reaches you as the message.delivered and message.read events of a webhook endpoint, if you subscribe to them. Send surface for a rich body; a surface that dispatches an action belongs to POST /v1/requests and is refused here. Send threadKey to say it inside a conversation you have already opened: the Message takes the next sequence of that Thread and stays informational, because it still asks for nothing.
Headers
| Field | Description |
|---|---|
Authorizationstring · required | Bearer sk_test_…: an API key of your project. |
Request body
| Field | Description |
|---|---|
senderobject · required | Who the person sees the Notification as coming from. |
sender.string · required | The name the person sees, free text. Not empty. |
sender.string | An icon for the sender, free text, kept and returned as sent. Nothing draws it: the person sees the sender by its name. Not empty. |
notificationobject · required | What the push says. |
notification.string · required | The title of the push and of its Inbox row. Not empty. |
notification.string · required | The text of the push and of its Inbox row. Not empty. |
prioritystring | How loudly the Notification announces itself: low only in the Inbox, normal with a push, high with a push that may break through the person’s quiet hours. One of low, normal, high. Defaults to normal. |
surfaceobject | UI shown when the person opens the Notification, checked against the catalog. It may not dispatch an action: a Surface that asks for an answer is a Request. |
surface.string · required | The id of the component the Surface is drawn from: always root, and one of components must carry it. Not empty. |
surface.object · required | The flat JSON state the components bind to by JSON Pointer, and the source of the values an action sends back. |
surface.array of objects · required | The components, as a flat list, each one checked against the catalog. Not empty. |
threadKeystring | Your name for a conversation: the Notification joins the Thread with this key, and asks for nothing there either. Without it, the Notification is a Thread of its own. 1 to 200 characters. |
Example
import { Card, Column, Nibify, Text } from '@nibify/sdk'; const nibify = new Nibify({ apiKey: 'sk_test_…' }); const surface = { root: 'root', dataModel: {}, components: [ Card('root', { child: 'body' }), Column('body', { children: ['title', 'text'] }), Text('title', { text: 'Kiwi Studio invoice filed', variant: 'h4' }), Text('text', { text: '$1,420, consulting, due Oct 30.' }), ], }; await nibify.notify({ sender: { name: 'invoice-flow' }, notification: { title: 'Kiwi Studio invoice filed', body: '$1,420, consulting, due Oct 30.', }, surface, });
Responses
| Status | Description |
|---|---|
201 | The notification was created and is on its way. |
401 | unauthorized for a missing or unusable key, api_key_revoked for a revoked one. |
402 | plan_limit_reached. The Messages the account’s plan allows this month in this key’s Environment are spent — Requests and notifications together, across every Project of the account, counted from the first day of the month in UTC. test and live have a monthly allowance each, counted apart, so a spent test never refuses a live key, nor the other way round. The message names the Environment, the plan, its limit, the day the count starts again and where to upgrade. Nothing was created. Unlike a 429 there is no Retry-After: retrying is refused the same way until the month turns or the plan changes. |
422 | surface_invalid names the component and property at fault, the root the renderer would not find, or a surface that dispatches an action — which is a Request and belongs to POST /v1/requests. invalid_request_body is a malformed envelope, and it is also what a field of a Request sent here gets: quickActions, expiresAt and callbackUrl are refused by name rather than ignored, because a notification that silently dropped a callbackUrl would leave an agent waiting for a call that is never made. |
429 | rate_limited. This project is over its requests-per-second ceiling or its daily volume in the environment this key speaks for; the message says which of the two it was. The budget is the project’s and not the key’s, so another API key of the same project shares it — the test and live halves are counted apart. Nothing was created and nothing was counted: retrying after Retry-After is safe. Header Retry-After: how many seconds to wait before retrying. Always a whole number, never below 1. |
Response body, 201
| Field | Description |
|---|---|
messageIdstring · required | The Notification’s id, as the message.delivered and message.read events name it. |
threadIdstring · required | The Thread the Notification joined. |
sequenceinteger · required | The Notification’s position in its Thread, starting at 1. |
interactionTypestring · required | A Notification asks for nothing, in a Thread or out of one. Always informational. |
createdAtstring · required | When the Notification was created. An RFC 3339 timestamp. |
environmentstring · required | The Environment of the API key that created it. One of test, live. |
minCatalogVersioninteger or null · required | The lowest catalog version that can draw the Surface, worked out by the server. Null when there is no Surface. |
warningsarray of objects · required | What did not stop the Message but changes how it is shown: catalog_version_too_low when no installed app can draw the Surface. |
warnings[].string · required | What the warning is about, for a program to branch on. Always catalog_version_too_low. |
warnings[].string · required | The same warning, in a sentence for a person. |