Activity Feeds v3 is in beta — try it out!

Overview

Stream Activity Feeds supports push notifications through Firebase Cloud Messaging (FCM) and Apple Push Notification (APN) providers.

Push notifications help keep users engaged by delivering real-time updates about activities, reactions, comments, and other feed events when the application is closed or in the background.

The Stream API doesn’t support web push notifications. However, if you’re building a mobile application using JavaScript technologies, you can set up mobile push notifications using the supported providers: Firebase Cloud Messaging (FCM) and Apple Push Notification (APN).

When Push Notifications Are Sent

Activity Feeds sends push notifications in the following scenarios:

  • New Follower when a user follows another user
  • Comments added to activities the user is involved with
  • Reactions added to the user’s activities
  • Comment Reactions added to the user’s comments
  • Mentions when a user is mentioned in activities or comments
  • Notification feeds - activities added to the default notification feed automatically trigger push notifications

Push Delivery Rules

Push notification delivery follows these rules for Activity Feeds:

  • Only users with registered devices receive push notifications
  • Push notifications are sent to all registered devices for a user (up to 25 devices)
  • Users must have proper permissions granted for notifications
  • Push notifications are sent for activity updates like new comments and reactions
  • Notifications respect the feed’s privacy settings and user permissions
  • Activities added to the default notification feed automatically trigger push notifications
  • You can skip push notifications for individual actions using the skip_push parameter on comments, reactions, and follows

Feed Groups and Push Notifications

Push notifications in Activity Feeds are configured at the feed group level. Each feed group can have its own push notification settings:

  • Built-in feed groups like notification and user come with default push configurations
  • Custom feed groups can be created with specific push notification settings
  • Activity types can be selectively enabled for push notifications using push_types

For detailed configuration options, refer to the Feed Group Push Configuration documentation.

Configuring Push Providers

You need to configure your push providers through the Stream Dashboard:

  1. Navigate to your Stream Dashboard
  2. Select your application
  3. Go to the Push Notifications section
  4. Click New Configuration and select your provider
  5. Upload your credentials (Firebase service account JSON, APN certificates, etc.)

For detailed configuration instructions, refer to the Push Providers & Multi Bundle documentation.

Getting Started

To set up push notifications for Activity Feeds, you need to:

  1. Configure your push notification provider on the Stream Dashboard
  2. Add client-side integration for your chosen provider in your app
  3. Register user devices with Stream’s API

Implementation Examples

Direct Push Notifications

Direct push notifications are sent immediately when events occur. Use skip_push: false (default) to enable direct push:

use GetStream\GeneratedModels;

// Comment with direct push notification (default behavior)
$feedsClient->addComment(new GeneratedModels\AddCommentRequest(
    objectID: $activity->id,
    objectType: "activity",
    comment: "Great post!",
    userID: "user-456",
    // skipPush: false (default) - sends push immediately
));

// Reaction with direct push notification
$feedsClient->addReaction($activity->id, new GeneratedModels\AddReactionRequest(
    type: "like",
    userID: "user-456",
    // skipPush: false (default) - sends push immediately
));

Notification Feed Push Notifications

Use create_notification_activity: true with skip_push: true to send push via the built-in notification feeds:

use GetStream\GeneratedModels;

// Comment that creates notification activity and sends via notification feed
$feedsClient->addComment(new GeneratedModels\AddCommentRequest(
    objectID: $activity->id,
    objectType: "activity",
    comment: "Great post!",
    userID: "user-456",
    createNotificationActivity: true,
    skipPush: true // Send via notification feed instead of direct push
));

// Reaction that creates notification activity
$feedsClient->addReaction($activity->id, new GeneratedModels\AddReactionRequest(
    type: "like",
    userID: "user-456",
    createNotificationActivity: true,
    skipPush: true // Send via notification feed
));

Custom Notification Feeds

Manually add activities to custom notification feeds for complete control (only for server-side SDKs):

use GetStream\GeneratedModels;

// Add a custom notification directly to a user's notification feed
$feedsClient->addActivity(new GeneratedModels\AddActivityRequest(
    feeds: ["notification:john"], // Target user's notification feed
    type: "milestone", // Custom activity type
    text: "You've reached 1000 followers!",
    userID: "<user id>",
    custom: (object)[
        "milestone_type" => "followers",
        "count" => 1000,
    ]
));

// Add activity to custom notification feed group
$feedsClient->addActivity(new GeneratedModels\AddActivityRequest(
    feeds: ["alerts:john"], // Custom notification feed group
    type: "system_alert",
    text: "Your subscription expires in 3 days",
    userID: "<user id>"
));
© Getstream.io, Inc. All Rights Reserved.