JavaScript SDK
JavaScript SDK
The Membrane JavaScript SDK provides typed accessors for all Membrane resources. It works in both Node.js and browser environments.
See Authentication for how to get an access token.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
npm install @membranehq/sdk
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
},
})
// 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' })