Build a notification inbox with seen/unseen state, real-time delivery, push notification setup, and granular event-based triggers.
SDK v7.x · Last verified March 2026 · iOS · Android · Web · Flutter
Speed run — just the code
TypeScript SDK gap: Client.registerPushNotification is not available in the TypeScript SDK. iOS and Android use native push token registration. In TS/Web, configure push notifications via your web push service (e.g., Firebase Messaging). Tracking: see .docs-ops/evals/sdk-tickets-to-file.md.
// 1. Get notification tray itemsconst { data } = await notificationTray.getNotificationTrayItems({ limit: 20 });// 2. Mark a notification as seenawait notificationTray.markTraySeen('notificationId');// 3. Register push token// Push token registration not in TS SDK (see Warning above)// Configure push via your web push service (e.g., Firebase Messaging)});// 4. Subscribe to real-time tray updatesnotificationTray.onNotificationTraySeenUpdated(({ data }) => { showBadge(data.unseenCount);});
Full walkthrough below ↓
Platform note — code samples below use TypeScript. Every method has an equivalent in the iOS (Swift), Android (Kotlin), and Flutter (Dart) SDKs — see the linked SDK reference in each step.
Notifications are your primary re-engagement tool. This guide covers building an in-app notification tray with seen/unseen tracking, setting up push notifications across all platforms, and subscribing to real-time social events.
Prerequisites: SDK installed and authenticated. For push notifications: APNs certificate (iOS) or FCM credentials (Android) configured in Admin Console → Settings → Integrations.Also recommended: Complete Build a Social Feed and Community Platform first — notifications are triggered by feed and community events.
After completing this guide you’ll have:
An in-app notification tray with seen/unseen state and real-time delivery
Push notifications (APNs and FCM) registered and firing for key events
Notification triggers mapped to SDK events and webhook callbacks
When the user opens the tray, mark all unseen items as seen. Or mark individual items as seen on tap. Both bulk and per-item marking are supported.
import { notificationTray } from '@amityco/ts-sdk';// Mark all as seenawait notificationTray.markTraySeen();// Or mark a single itemawait item.markSeen();
Each notification item contains targetType and targetId fields you can use to deep-link to the source content (post, comment, user, or community).Reference all notification types → Notification Events Reference
After the user logs in, retrieve the device token and register it with the SDK. This associates the device with the authenticated user so the backend can route pushes correctly.
import { Client } from '@amityco/ts-sdk';// Register a device token (web push or React Native FCM token)await client.registerPushNotification({ token: deviceToken });
Let users control what they’re notified about at a granular level. Settings are organised by module (SOCIAL, CHAT, LIVE_STREAM) and apply across all of the user’s devices.
1
Get current notification settings
Read the user’s current preferences to populate a settings screen.
import { UserRepository } from '@amityco/ts-sdk';// Notification settings API: see push-notification docs for v6 SDK approachconsole.log('Notifications enabled:', settings.isEnabled);settings.modules.forEach(m => console.log(m.moduleType, m.isEnabled));
2
Update notification module settings
Enable or disable individual modules, or turn off all notifications at once.
import { UserRepository } from '@amityco/ts-sdk';// Disable social, keep chat enabled// Notification settings update: see push-notification docs for v6 SDK approach// await legacySettingsUpdate({ modules: [ { moduleType: 'social', isEnabled: false }, { moduleType: 'chat', isEnabled: true }, ],});// Or disable all notifications at once// Notification settings update: see push-notification docs for v6 SDK approach// await legacySettingsUpdate({ isEnabled: false });
For finer control, users can configure which notification types they receive per community (new post, new comment, mentions). This is separate from the global user setting above.Full reference → Community Notification Settings
Admin Console — Push notification settings for community and chat events
Webhook: trigger notifications for moderation actions
When a moderator removes content, use webhook events (post.deleted, user.banned) to send a custom in-app or push notification explaining the action to the affected user.→ Webhook Events
Notification analytics
Track notification open rates and click-through rates in Admin Console → Analytics Dashboard → Engagement Metrics to understand which notification types drive the most re-engagement.
Polling for notifications on a timer — This drains battery and creates unnecessary API calls. Use real-time tray subscriptions instead:
// ❌ Bad — polling every 5 secondssetInterval(() => fetchNotifications(), 5000);// ✅ Good — real-time tray subscriptionnotificationTray.onNotificationTraySeenUpdated(({ data }) => { updateBadge(data.unseenCount);});
Not handling push permission rejection — On iOS, users can deny push permissions. Always check the permission status and provide an in-app fallback (notification tray) when push is disabled.
Registering push tokens before login — Push token registration requires an active session. Always call registerPushNotification after login() completes, not in parallel.
Provide granular opt-out: users should be able to mute a specific community without turning off all notifications
Rate-limit push if a post gets hundreds of reactions — send “50+ reactions on your post” not one push per reaction
Dive deeper: Discovery & Engagement API Reference has full parameter tables, method signatures, and platform-specific details for every API used in this guide.