Skip to content

Quick Start

Get from zero to a streamed answer in three steps.

  1. Install the SDK

    Terminal window
    npm install @riseanalytics/finn-sdk
  2. Connect and ask a question

    import { FinnClient } from '@riseanalytics/finn-sdk';
    const finn = new FinnClient({
    url: process.env.FINN_URL, // e.g. https://finn.example.com
    apiKey: process.env.FINN_API_KEY, // your static API key
    });
    await finn.connect();
    const turn = finn.sendMessage('How many active members do I have?');
    // Tokens stream in as Finn answers.
    for await (const chunk of turn) {
    process.stdout.write(chunk.text);
    }
    const result = await turn.completed;
    console.log('\nconversationId:', result.conversationId);
    await finn.disconnect();
  3. Run it

    Terminal window
    FINN_URL=https://finn.example.com FINN_API_KEY=your-key node index.mjs

If you don’t need live tokens, use ask() — it does the loop for you and resolves once with the full answer:

const { text } = await finn.ask('How many active members do I have?');
console.log(text);

See Sending messages & streaming for the difference between ask() and sendMessage().

  • new FinnClient({ url, apiKey }) created a client (nothing connects yet).
  • connect() opened the WebSocket and authenticated with your API key.
  • sendMessage(...) returned a MessageTurn — an async-iterable you loop over to read tokens as they arrive.
  • turn.completed resolved with the final TurnResult, including the conversationId you’d reuse for a follow-up.