Create activity feed
How to build an activity feed of notifications using OneSignal
What is an activity feed?
An activity feed lets users see the history of notifications they've received within your app.
OneSignal primarily focuses on delivery of messages, so at this current time OneSignal does not store notifications sent history of each individual user. However, you can implement this yourself by storing the data on your own server or on the device.
Option 1: Saving to server
Recommended Approach
Instead of using background processing in your app, you may choose to create all your notifications with our Create notification REST API and additionally save a copy of the contents on your server. Then each time your app is started check your server for updates.
Once the data is stored by your app or on your server, you can display it to the user when you choose.
Option 2: Create an activity feed using OneSignal Event Streams
OneSignal’s Event Streams feature offers a powerful way to create dynamic and personalized activity feeds by streaming real-time user events from your app to your backend systems or data warehouse. This enables you to build an activity feed that reflects in-app user behavior—such as follows, likes, comments, or purchases—without manually managing notifications or feed entries in your app.
How It Works
Event Streams allows you to export real-time notification delivery events, user behavior, and other OneSignal events (like email/SMS opens and clicks) to destinations like:
- Webhooks (your own HTTP endpoints)
- Amazon Kinesis
- Amazon S3
- Google Cloud Storage
- BigQuery
- And more
Once connected, your system receives these events as they happen and can use them to populate an activity feed UI or power engagement analytics.
Steps to Set Up an Activity Feed with Event Streams
-
Enable Event Streams
- Go to the OneSignal Dashboard > Settings > Event Streams.
- Select a destination such as a Webhook or your cloud data pipeline (e.g., Amazon Kinesis).
- Choose the types of events you want to stream (e.g.,
message.sent
,message.delivered
,message.clicked
).
-
Configure Your Backend to Handle Event Data
-
Set up your webhook or event consumer to ingest the real-time event data.
-
Parse the incoming events to extract useful fields like:
external_id
(the user ID)event
type (message.delivered
, etc.)timestamp
contents
(message content)additional_data
(custom metadata)
-
-
Store and Structure Activity Feed Entries
-
Store these events in your database in a format suitable for querying and rendering in an activity feed.
-
For example, you might store:
{ "message.id": "f3c9cd09-10d7-4f59-b9bc-66e16607f1d5", "message.name": "the-name-you-set", "message.title": "Claim 50% Off Today", // email subject example "message.title": "{'en':'the message title/headings'}", // push title example "message.contents": "{'en':'the message content'}", "message.template_id": "the-template-uuid-if-set", "message.url": "the-message-url", "message.app_url": "the-message-app-url", "message.web_url": "the-message-web-url" }
-
-
Render the Feed in Your App
- Build a frontend component (e.g., React, SwiftUI, or Android View) that queries and displays the recent events for a logged-in user.
- Optionally allow filtering or grouping by event type.
-
Enhance with Additional Metadata
- You can enrich events with
additional_data
when sending notifications via OneSignal to include structured context (e.g.,{"action":"commented", "post_id":"xyz123"}
). - This helps you create descriptive feed entries like: “Jane commented on your post.”
- You can enrich events with
Example Use Cases
- E-commerce: Show recent purchases, shipping updates, and special offers.
- Social Apps: Display interactions such as likes, comments, or follows.
- SaaS Platforms: Track workspace activities like task assignments, mentions, or updates.
Benefits
- Real-time updates via serverless streaming
- Customizable logic and display using your own infrastructure
- Scalable and decoupled architecture that works with your existing data stack
Option 3: Save the notification when received
This option may be less reliable for cases when the device is turned off for an extended period of time (see Notification Behavior & Payload Information for more details). Also, if the device or user removes the app from memory like app being force quit on Android it will not get the notification (see Notifications Not Shown for more details). For iOS 9 and older, this option will not work unless the app is running in the background or foreground when receiving the push.
First, you must setup the required code to cause your application to be woken up in the background whenever a notification is received (even if it's not clicked).
iOS - This requires a Notification Service Extension which should already be setup when following our Mobile SDK Setup Guide to add one to your Xcode project.
For iOS 9 and older device support you will need to use the content-available
flag. Read Apple's content-available guide for details on receiving and processing the event.
Within the Notification Service Extension, you can capture the Notification Payload and process it within your Activity Feed. For details on how to capture the OneSignal Notification Payload see our iOS Notification Service Extensions Feature Guide.
Android - Read our Android Background Data guide for details on receiving and processing the event.
When you process the event, you can save a copy of the notification to your app.
Updated 4 days ago