SDK
The Membrane SDK provides typed accessors for all Membrane resources from TypeScript and JavaScript.
Install
npm install @membranehq/sdkInitialize
import { MembraneClient } from '@membranehq/sdk'
// With a static token (server-side scripts, internal tools)
const membrane = new MembraneClient({
token: process.env.MEMBRANE_ACCESS_TOKEN,
})
// With dynamic token fetching (customer-scoped, browser)
const membrane = new MembraneClient({
fetchToken: async () => {
const response = await fetch('/api/membrane-token')
const { token } = await response.json()
return token
},
})Usage
The SDK provides typed accessors for all Membrane resources:
// 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({
input: { email: '[email protected]', name: 'Jane' },
})
// List flows
const flows = await membrane.flows.find()
// Open connection UI for a customer
await membrane.integration('salesforce').openNewConnection()Resource Accessors
| Accessor | Description |
|---|---|
membrane.connections | Manage connections to external apps |
membrane.integrations | Configure integrations |
membrane.actions / membrane.action(key) | Run and manage actions |
membrane.flows / membrane.flow(key) | Manage automation flows |
membrane.dataSources / membrane.dataSource(key) | Work with data sources |
membrane.fieldMappings / membrane.fieldMapping(key) | Configure field mappings |
membrane.customers / membrane.customer(id) | Manage customers/tenants |
membrane.screens / membrane.screen(key) | Access UI screens |
membrane.appEventTypes | Manage app event types |
membrane.appDataSchemas | Manage app data schemas |
Each accessor supports standard operations: .find(), .get(), .create(), .patch(), .archive().
Browser & Node.js
The SDK works in both Node.js and browser environments. Separate builds are provided automatically — your bundler will pick the right one.
Next steps
- React SDK — React hooks and components built on top of this SDK
- Embedded UI — pre-built embeddable screens for your product
- API Reference — full endpoint documentation
- Authentication — token generation for customer-scoped access
Updated about 11 hours ago