Skip to content

In-app inbox

Every notification you send to a user can also land in their inbox: a list your site shows itself, like a bell menu or a notifications page. It works in every browser, including where push notifications aren’t supported or are blocked, and new items arrive live.

The inbox is on or off per app in the app’s settings, and you can override it per notification with "inbox": true or false when sending. Inbox items are made for users only: the users you send to, or the users the targeted devices belong to.

In the browser, the inbox needs to know who is signed in. Call setUser with a user token from your server first:

const push = HivePush.init({ key: 'pk_your_public_key', region: 'global-1' });
await push.setUser(userId, token);

The browser doesn’t need to be subscribed to push notifications to use the inbox.

const { items, unread } = await push.inbox.list({ limit: 20 });

Items come newest first, up to 50 per call (limit), and unread is the user’s number of unread items. For the next page, pass the last item’s id as before:

const older = await push.inbox.list({ before: items[items.length - 1].id, limit: 20 });

An item looks like this:

{
"id": "inb_8c1d2e3f4a5b6c7d",
"notification_id": "ntf_5b0c9d2e7f1a3c4b",
"created_at": "2026-11-12T09:00:00.123Z",
"read_at": null,
"title": "Your order shipped",
"body": "It arrives on Thursday.",
"url": "https://shop.example/orders/77",
"icon": "https://shop.example/icon.png",
"data": {"order_id": 77}
}

It carries the notification’s content fields, including your data, so you can render it however you like.

await push.inbox.markRead('inb_8c1d2e3f4a5b6c7d'); // one item
await push.inbox.markRead(['inb_...', 'inb_...']); // several, up to 200 at a time
await push.inbox.markRead('all'); // everything

inbox.onMessage calls your function for every new item the moment it’s sent, so your bell count and list stay current without polling:

const stop = push.inbox.onMessage((item) => {
showToast(item.title);
unreadCount += 1;
});
// later, e.g. when the user signs out
stop();

If the connection drops, it reconnects on its own, waiting 1 second and doubling up to 30 seconds. Each user can have up to 5 live connections per app (one per open tab); a sixth is refused with 429 too_many_streams.

  • Each user keeps their newest 200 items; older ones are dropped as new ones arrive.
  • Items are kept for 90 days.
  • Deleting a user’s data removes their inbox at once and closes their live connections.