Pulse TypeScript SDK

Official TypeScript client for Pulse, the data analysis API for market researchers.

Install

Requires Node.js 18+.

npm install @rwai/pulse     # or: yarn add, pnpm add, bun add

Quickstart

Analyze sentiment for a small set of inputs using Starters. This example uses a user auth helper.

import { Starters, Auth } from "@rwai/pulse";

const inputs = [
  "I love the new features in the latest update!",
  "The product is okay, but it could be better.",
  "I'm not satisfied with the customer service I received.",
];

const result = await Starters.analyzeSentiment({ inputs, auth: Auth.userAuth() });
console.log(result);

Authentication

The SDK provides helpers for authentication. In many apps, Auth.userAuth() retrieves the current user session. You can also pass raw tokens.

import { Auth } from "@rwai/pulse";

// User/session auth (app-managed)
const auth = Auth.userAuth();

// Or pass a raw bearer token
const auth2 = Auth.bearerToken("<YOUR_API_KEY>");

Usage

Sentiment

import { Starters, Auth } from "@rwai/pulse";

const auth = Auth.userAuth();
const result = await Starters.analyzeSentiment({ inputs: ["Loved it", "Not great"], auth });
console.log(result);

Themes

import { Starters, Auth } from "@rwai/pulse";

const auth = Auth.userAuth();
const result = await Starters.generateThemes({ inputs: ["Love the camera", "Battery life is long"], auth });
console.log(result);

Similarity

import { Starters, Auth } from "@rwai/pulse";

const auth = Auth.userAuth();
const result = await Starters.similarityMatrix({ inputs: ["alpha", "beta", "gamma"], auth });
console.log(result);

Configuration

Configure base URL (self‑hosted), timeouts, and retries globally.

import { configure } from "@rwai/pulse";

configure({
  baseUrl: "https://core.researchwiseai.com/pulse/v1",
  timeoutMs: 30000,
  maxRetries: 3,
});

Error Handling

SDK calls reject with errors that include status code and message.

try {
  const result = await Starters.analyzeSentiment({ inputs: [], auth: Auth.userAuth() });
} catch (e: any) {
  console.error(e.status, e.message);
}

Logging & Debug

Enable verbose logs during development to troubleshoot requests.

import { configure } from "@rwai/pulse";

configure({ debug: true });

Resources