The easiest way to add a notification feed to your site. Aggregation, real-time, follows, counts and react components enable you to build a highly relevant notification feed.
With only a few lines of code, Stream allows you to add a notification feed. You have full control over the user experience. Have a look at how Product Hunt uses Stream:
The Stream API just works – we appreciate the fact that we simply don’t have to worry about it. It’s simple for us to add new notifications & it scales with us. This gives us time to focus on other priorities.Product Hunt
Follow topics or announcements to easily notify large groups at once.
Grouping together common events on an activity is simple with aggregation.
Display the count of the number of unseen or unread notifications.
Receive notifications in realtime via Webhook or SQS.
In this code example we add a like activity to Josh’ notification feed. Note that you can add custom fields to the activity. Next we’ll read the feed. Note how the data is aggregated. By default the activities are aggregated by time and verb. You can change or disable aggregation logic in the dashboard. The response also includes the number of unseen and unread notifications.
import stream
client = stream.connect('api_key', 'api_secret')
def notify_ping(user, ping, ping_target):
activity = {'actor': user.username, 'verb': 'ping', 'object': ping.id}
feed = client.feed('notification', ping_target.id)
feed.add_activity(activity)
feed = client.feed('notification', current_user.id)
activities = feed.get()['results']
feed = client.feed('notification', current_user.id)