newOS for Developers

Back to Search Methods

Activity Stream

Real-time feed of user and network activity

intermediateGET /user/activityStream

Overview

The activity stream provides a chronological feed of events from users you follow and your own actions. This includes new posts, follows, powerups, and mood updates.

The stream uses reactive signals to push updates in real-time without polling.

API Endpoint

GET/user/activityStream

Query Parameters:

  • since — ISO timestamp to fetch events after
  • types — Filter by event types (optional)
  • limit — Max events to return (default 50)

Usage Example

import { activityStream } from "@newgraph-signals/actions/activityStream";

// Subscribe to activity stream
const stream = activityStream();

// React to new events
effect(() => {
  const events = stream.value;
  events.forEach(event => {
    console.log(`New event: ${event.type}`, event);
  });
});

// Filter by event type
const postEvents = activityStream({
  types: ["post.created", "post.updated"]
});

Event Types

TypeDescription
post.createdNew post published
user.followedNew follower
powerup.sentPowerup/Watts received
mood.updatedMood content changed
access.grantedAccess given to mood

Response Schema

{
  value: [
    {
      id: string;
      type: string;           // Event type
      actor: {                // Who triggered
        id: string;
        username: string;
      };
      target: {               // What was affected
        id: string;
        type: string;
      };
      created: string;        // ISO timestamp
      metadata: object;       // Event-specific data
    }
  ]
}