Overview

b.well Health SDK for Web

Welcome to the b.well SDK for Web - a powerful, type-safe library for building applications that connect to the b.well Connected Health platform. This TypeScript SDK provides a comprehensive set of tools for managing health data, user profiles, appointments, and healthcare provider connections.

Choose the TypeScript SDK when you:

  • Are building a web application with TypeScript/JavaScript
  • Need type-safe access to b.well's APIs and FHIR-compliant health data
  • Want framework flexibility (works with React, Vue, Angular, or vanilla JS)
  • Prefer a fluid API interface with full IntelliSense support

Integration at a Glance

Integrating the b.well TypeScript SDK follows a straightforward pattern:

  1. Install the SDK from NPM
  2. Initialize the SDK with your client configuration
  3. Authenticate users using OAuth 2.0 token exchange
  4. Access b.well services through fluid API managers

The SDK handles token storage, refresh, and request authorization automatically. See the Initialize and Authenticate guide for detailed implementation.


Installation

Install the SDK from NPM:

npm install @icanbwell/bwell-sdk-ts

NPM Package

Quick example:

import { BWellSDK } from "@icanbwell/bwell-sdk-ts";

const sdk = new BWellSDK({ clientKey: "YOUR_CLIENT_KEY" });
await sdk.initialize();
await sdk.authenticate({ token: "YOUR_TOKEN" });

const profile = await sdk.user.getProfile();

See the Initialize and Authenticate guide for complete setup instructions and authentication options.

Resources


Key Components

The TypeScript SDK organizes functionality through specialized managers, each handling a specific domain:

  • TypeScript SDK Core - Main SDK class and entry point for all operations
  • HealthManager - Access to patient health records and clinical data
  • UserManager - User profile management, consent handling, and identity verification
  • HealthSpaceManager - Appointments, scheduling, and healthcare facility management
  • ConnectionManager - Data source connections and OAuth management for external providers
  • SearchManager - Healthcare provider and resource discovery, including provider directory search and submission
  • QuestionnaireManager - Dynamic questionnaire processing and response handling


Workflow & Configuration Guides

The TypeScript SDK provides comprehensive workflow guides organized by functional area. Each guide includes method details, request patterns, and code examples.

Workflow GuidesDescription
Initialize and AuthenticateSDK initialization and user authentication with OAuth 2.0 token exchange
Account Creation & ConsentCreating user accounts, managing consent preferences, and consent records
Searching Health ResourcesDiscovering and searching for healthcare providers, facilities, and resources
Establishing and Managing ConnectionsConnecting to external healthcare data sources and managing provider connections
Health Record RetrievalAccessing patient health records including conditions, medications, labs, procedures, and clinical documents
Codings in Health Data Request & ResponseUnderstanding and working with FHIR coding systems, code sets, and terminology
User Account DeletionDeleting user accounts and handling data removal
Request Objects GuideType-safe request patterns and parameter handling


SDK Architecture & Key Features

Fluid API Pattern

The SDK uses an intuitive manager-based pattern for accessing all functionality:

const sdk = new BWellSDK({ clientKey: "YOUR_KEY" });
await sdk.initialize();
await sdk.authenticate({ token: "YOUR_TOKEN" });

// Access functionality through managers
const profile = await sdk.user.getProfile();
const conditions = await sdk.health.getConditions();
const appointments = await sdk.healthSpace.getAppointments();

Request Objects for Type Safety

Methods requiring parameters use typed request objects for validation and IntelliSense support:

import { AppointmentsRequest } from "@icanbwell/bwell-sdk-ts";

const appointments = await sdk.healthSpace.getAppointments(
  new AppointmentsRequest({ status: "booked" })
);

See the Request Objects Guide for complete documentation on available request types and patterns.

Consistent Result Handling

All SDK operations return BWellQueryResult or BWellTransactionResult for consistent error handling:

const result = await sdk.user.getProfile();

if (result.success()) {
  const profile = result.data();
  console.log("Profile:", profile);
} else {
  const error = result.error();
  console.error("Error:", error.message);
}

Configuration Options

Customize SDK behavior with configuration options:

import { BWellSDK, LogLevel } from "@icanbwell/bwell-sdk-ts";

const sdk = new BWellSDK({
  clientKey: "YOUR_CLIENT_KEY",
  logLevel: LogLevel.Info,
  retryPolicy: { attempts: 3, interval: 1000 },
  tokenStorage: customTokenStorage,
  language: "en" // or "es" for Spanish
});

See the Initialize and Authenticate guide for complete configuration documentation.