Skip to main content
The Membrane JavaScript SDK provides typed accessors for all Membrane resources. It works in both Node.js and browser environments.

Install

npm install @membranehq/sdk

Initialize

import { MembraneClient } from '@membranehq/sdk'

// With a static token
const membrane = new MembraneClient({
  token: process.env.MEMBRANE_ACCESS_TOKEN,
})

// With dynamic token fetching — for long-lived environments (like web pages)
// where the token may expire and needs to be refreshed
const membrane = new MembraneClient({
  fetchToken: async () => {
    const response = await fetch('/api/membrane-token')
    const { token } = await response.json()
    return token
  },
})
See Authentication for how to get an access token.

Usage

// List integrations
const integrations = await membrane.integrations.find()

// Get a specific connection
const connection = await membrane.connection('hubspot').get()

// Run an action
const result = await membrane.action('create-contact').run({
  email: 'jane@example.com',
  name: 'Jane',
})

// Open connection UI
await membrane.ui.connect({ integrationKey: 'salesforce' })

SDK Reference

See the SDK Reference for the full list of accessors, methods, and types.