Notifications: box.notifications
Apps can send push notifications from one person to another: "your turn" in a game, "Sam added milk" on a shared list. They go to accounts, on every device where that person turned them on.
// From a button: browsers only ask after a tap
const state = await box.notifications.enable(); // "on", "off", "denied", "needs_install", "unsupported"
if (state === "needs_install") box.installHint.open(); // iPhone: add to the Home Screen first
// When it's someone else's move (their id from box.account.current())
await box.notifications.send(otherPlayerId, {
title: "Your turn",
body: "Sam played 7♦",
url: "/game?id=42", // the page a tap opens
tag: "turn-42", // replaces an older notification with the same tag
});
Reminders can wait until later and be cancelled when they're no longer needed:
// After a move: nudge the next player tomorrow unless they move first
box.notifications.schedule(next.id, { title: "Still your turn" }, { in: "24h", key: "remind-42" });
// When they move
box.notifications.cancel("remind-42");
Scheduling again with the same key replaces the waiting reminder. Reminders go off between 1 minute and 30 days later; each person can have 50 waiting.
On iPhone and iPad, notifications work only once the app is on the Home Screen and opened from there (Apple's rule); Android and desktop browsers work in a tab. Sending is best-effort: send says who was reached and who wasn't (not_enabled, limit, failed), and only throws for a malformed message. One call reaches up to 20 people; each person can send 120 an hour, and 30 an hour to the same person. Outside Makeship nothing is sent.