Skip to content

Webhooks, Notifications, Presence & Realtime

FynnCloud’s host event platform lets your app backend stay in sync with Core user/file changes, display persistent notifications and unread badges across web and mobile, read/elevate user presence, and fan out live updates over the host’s single per-tab SSE connection—without every app opening its own WebSocket per browser tab.

All app-backend endpoints below authenticate with X-FynnCloud-App-ID + X-FynnCloud-App-Secret against FYNNCLOUD_INTERNAL_API_URL and are exempt from per-IP .api rate limiting (since app containers call from a single internal IP).

Capability Discovery (GET /api/apps/capabilities)

Section titled “Capability Discovery (GET /api/apps/capabilities)”

Before calling host features, query GET /api/apps/capabilities (no extra scope required):

{
"notifications": true,
"badges": true,
"presence": true,
"events": true,
"realtime": true,
"push": true
}

Declare event subscriptions in manifest.json:

{
"permissions": ["users:events", "files:all:read"],
"events": {
"endpoint": "/webhooks/fynncloud",
"subscriptions": ["user.created", "user.updated", "user.deleted", "group.members.changed", "file.uploaded"]
}
}
Event Required Scope Payload Fields (data)
user.created, user.updated users:events { id, username, displayName, avatarUpdatedAt, hasAvatar }
user.deleted users:events { id, username }
group.members.changed users:events { groupId, groupDeleted, memberIds } (Note: group.updated / group.deleted are not dispatched separately—deletions arrive with groupDeleted: true)
file.uploaded, file.updated, file.deleted, file.moved files:all:read File metadata envelope (fileId, ownerId, name, parentId, …)
notification.action notifications:send (targeted to owning app) { userID, notificationId, key, actionId } — fired automatically when a user clicks an action button on a host notification

Every webhook POST includes X-FynnCloud-Signature: sha256=<hex> computed as HMAC-SHA256(FYNNCLOUD_APP_SECRET, rawBody). Always verify using constant-time comparison before processing.


2. Persistent Notifications & Badges (notifications:send)

Section titled “2. Persistent Notifications & Badges (notifications:send)”

Send or Update Notifications (POST /api/apps/notifications)

Section titled “Send or Update Notifications (POST /api/apps/notifications)”

Notifications are idempotently keyed by (appId, userId, key). Sending a new payload with the same key updates the existing notification in place across all connected web tabs and dispatches encrypted mobile push alerts automatically:

{
"userIds": ["<userUUID>"],
"key": "call:room-42",
"kind": "call",
"title": "Incoming call from Alice",
"body": "Design Sync",
"route": "/rooms/room-42",
"icon": "heroicons:phone-arrow-down-left",
"avatarUserId": "<callerUUID>",
"avatarText": "AL",
"sound": "loop",
"persistent": true,
"desktop": true,
"priority": "high",
"ttlSeconds": 45,
"metadata": { "callId": "c_91", "roomId": "room-42", "mode": "video" },
"actions": [
{ "id": "accept", "label": "Answer", "icon": "heroicons:phone", "variant": "primary", "navigate": true, "route": "/rooms/room-42?join=1" },
{ "id": "decline", "label": "Decline", "icon": "heroicons:phone-x-mark", "variant": "danger", "navigate": false }
]
}
  • Response (200 OK): { "delivered": 1, "ids": { "<userUUID>": "<notificationUUID>" } }.
  • expiresAt / ttlSeconds: Set either an explicit ISO-8601 expiresAt or ttlSeconds so stale calls/alerts auto-expire cleanly.
  • Do Not Disturb suppression: When a recipient’s resolved presence is dnd, FynnCloud automatically overrides effectiveSound to "none" on both web SSE notifications and mobile HPKE push dispatches (preventing CallKit VoIP ringing while DND is active).
  • Dismiss (POST /api/apps/notifications/dismiss): Body { "key": "call:room-42", "userIds": ["<userUUID>"] } (omit userIds to dismiss for all recipients). Returns { "dismissed": <count> } and dispatches a silent background dismiss push to clear mobile lock screens.

Set Unread App Badges (PUT /api/apps/badges)

Section titled “Set Unread App Badges (PUT /api/apps/badges)”
{
"badges": [
{ "userId": "<userUUID>", "badge": { "count": 3, "dot": "primary", "pulse": false, "tooltip": "3 unread messages" } },
{ "userId": "<otherUUID>", "badge": null }
]
}

Returns 204 No Content and updates the user’s App Switcher rail icon and (N) browser tab badge in real time.


FynnCloud computes every user’s resolved presence by combining three signals:

  1. Live connectivity (active /api/events SSE heartbeat in Redis)
  2. Manual user status (auto, online, busy, dnd, away, offline + optional statusMessage up to 100 chars)
  3. App Activity Overlays (highest precedence wins: in_call > presenting > in_meeting > focus)

Requires user:read. Optional query ?userIds=<uuid1>,<uuid2> (up to 200 IDs):

{
"online": [{ "userId": "<uuid>", "lastSeenAt": "2026-12-02T14:00:00Z" }],
"users": [
{
"userId": "<uuid>",
"status": "busy",
"presenceMode": "auto",
"activity": "in_call",
"activityAppId": "talk",
"activityLabel": "In a call",
"statusMessage": "Back at 15:00",
"lastSeenAt": "2026-12-02T14:00:00Z"
}
]
}

Users who manually set presenceMode: "offline" (Appear offline) are filtered out of online.

Publishing Elevated App Activity (PUT /api/apps/presence/activity)

Section titled “Publishing Elevated App Activity (PUT /api/apps/presence/activity)”

Requires presence:write. Lets an app temporarily elevate a user’s activity headline without overwriting their manual presence setting:

{
"userId": "<userUUID>",
"activity": "in_call",
"label": "In a call",
"ttlSeconds": 120
}
  • activity: "in_call", "presenting", "in_meeting", "focus", or null to clear immediately.
  • ttlSeconds: 15–300 seconds (stored in Redis presence:activity:{userID_lower} with up to 360s safety cap; refresh periodically while the call/session remains active).

4. Host-Multiplexed Real-Time Events (realtime:push)

Section titled “4. Host-Multiplexed Real-Time Events (realtime:push)”

Instead of opening a dedicated WebSocket/SSE per app per tab, apps with realtime:push publish events to POST /api/apps/realtime/publish. FynnCloud fans them out over Redis Pub/Sub to each recipient’s single GET /api/events SSE stream, and the host web shell forwards only your app’s events into your iframe via fynncloud.onRealtime().

Publishing Events (POST /api/apps/realtime/publish)

Section titled “Publishing Events (POST /api/apps/realtime/publish)”
{
"events": [
{
"userIds": ["<uuid1>", "<uuid2>"],
"event": "message.created",
"data": { "roomId": "r1", "messageId": "m99" }
}
]
}
  • Response (200 OK): { "accepted": 1, "recipients": 2 }.
  • Enforced limits:
    • Request body cap: 4 MB
    • Max events per request: 100
    • Max recipients per event: 5,000
    • Max encoded { appId, event, data } payload per event: 256 KB (send a small resync hint for large updates)
    • Event name regex: [A-Za-z0-9_.:-] (1–64 chars)

Both the web shell and standalone OAuth native apps (with realtime:push, user:read, or notifications:send) can subscribe directly to GET /api/events (text/event-stream):

  • Emits initial ready ({ serverTime, streamId }), replays active persistent notification.upsert and badge snapshots, then streams live app.realtime, notification.upsert, notification.dismiss, badge, and presence.updated events.
  • Sends : ping keepalive comments every 25 seconds (also re-checking grant/app-password revocation and touching user presence).
  • Maximum stream lifetime: 10 minutes (bounded by token expiration); clients reconnect and trigger onRealtimeReady() to resynchronize any missed state.
  • When authenticated with an AppAccessToken, AppNotificationsController.shouldDeliver strictly isolates the stream to envelopes belonging to appToken.appID (plus presence.updated if user:read is granted).