Installation

This SDK is the client half of your integration. Feed groups, ranking, permissions, push setup and bulk imports are configured from your backend with a server-side SDK or the REST API, and the token your app connects with has to be signed there too. See the server-side overview for what belongs there, starting with tokens and authentication.

Build with Stream CLI and Agent Skills

The Stream CLI and Agent Skills give AI coding agents the tools and knowledge to work with Stream. There is no dedicated skill pack for JavaScript yet, but the default skills still help with live documentation and CLI-driven API work.

Install the CLI and the default skills:

curl -fsSL https://getstream.io/cli.sh | bash
getstream skills

Once installed, invoke /stream from your agent. It routes documentation lookups and API operations for you.

Stream Agent Skills can also be installed from skills.sh.

npm install @stream-io/feeds-client
# or using yarn
yarn add @stream-io/feeds-client

GitHub repository: https://github.com/GetStream/stream-feeds-js. Feel free to submit bug reports and feature requests.

The package can be used with both JavaScript and TypeScript.

Client configuration

import { FeedsClient } from "@stream-io/feeds-client";

const client = new FeedsClient("<API key>");
await client.connectUser({ id: "john" }, "<user token>");

The constructor accepts an optional options object. timeout sets the per-request timeout in milliseconds (default 3000), and base_url overrides the API endpoint:

import { FeedsClient } from "@stream-io/feeds-client";

const client = new FeedsClient("<API key>", { timeout: 5000 });
await client.connectUser({ id: "john" }, "<user token>");

Custom headers

custom_headers are sent along with every API request:

import { FeedsClient } from "@stream-io/feeds-client";

const client = new FeedsClient("<API key>", {
  custom_headers: {
    "x-stream-ext": "my-value",
  },
});
await client.connectUser({ id: "john" }, "<user token>");

custom_headers can't be used to overwrite the SDK's internal settings, and they apply to HTTP requests only, not to the WebSocket connection.