Skip to main content
The SDK provides the data layer only — no built-in UI. Bind to its data and events and render your own.

Prerequisites

Integration of iOS SDK.

Initialize Feed Client

Options
If you are passing tenant_id in feed (or have set it via identify / changeTenant), make sure that tenant is included in the scope.tenant_id key while creating userToken passed during identifying user, else a 403 error will be thrown due to scope mismatch.

Feed Client

Get Feed Data Store

Returns the current notification store — the list of notifications plus metadata like page info and badge counts. You can call this anytime to get updated store data.

Initialize Socket for Realtime Updates

Keep exactly one active socket per feed. Multiple live sockets cause duplicated events, doubled badge increments, and inflated counts. Avoid:
  • Recreating the feed without teardown. removeAll() (or removeInstance(_:)) the old feed before calling feeds.initialize(...) again.
  • Owning the feed somewhere short-lived. A feed re-created with its view opens a socket each time; own it in a single, stable place and reuse it.
  • Skipping cleanup on dismiss/logout. An unclosed socket keeps running in the background — tear down in deinit or on logout.

Fetch Notification Data

Gets the first page of notifications from the SuprSend server and sets it in the notification store (it also fetches badge counts on the first call).

Fetch More Notifications

Gets the next page and appends it to the notification store. Call this only when pageInfo.hasMore == true.

Listening for Updates

Subscribe to feed.emitter to keep your UI in sync. It fires two events:
  • .storeUpdate — the notification store changed (new notification, state update, pagination, mutations, socket events). Listen to this and update your local state so that the UI is refreshed.
  • .newNotification — use this listener to show a toast notification when a new notification is received.

Removing Feed

Removes the feed client and aborts its socket connection.
Reconnecting: In background mode iOS suspends app activity. When the app comes from background to foreground, remove existing feed instances and reconnect the socket and emitters, then refetch data.

Action Methods

Read more about seen, read, and interacted. Response returned by the action methods (markAsRead, changeActiveStore, etc.):

Notification Structure

Notification States

  • Seen: seen_on flag is used to check if the notification has been seen in SuprSend analytics. If it’s null, the notification has not been seen yet — call markBulkAsSeen when the notification enters the viewport and seen_on is null.
  • Read: read_on flag is used to check if the notification has been read. This doesn’t update SuprSend analytics and is only for visual purposes. If read_on is null, show a dot on the notification indicating it’s unread. Call markAsRead when read_on is null, or markAsUnread when read_on has a timestamp. Marking as read will also set seen_on if not already set.
  • Interacted: interacted_on flag is used to set the notification as clicked in SuprSend analytics. If interacted_on is null and the user clicks on the notification, call markAsInteracted. This will also set read_on and seen_on if not already set.