skills/build-product-integrations/SKILL.md
Build apps that integrate with external services via Membrane. Use when the user wants to add integrations to their product — let their customers connect to Slack, HubSpot, Salesforce, GitHub, Google Sheets, Jira, or any other app, execute actions, sync data, or handle webhooks. Covers backend token generation, frontend connection UI, running actions, data collections, and AI agent tooling.
npx skillsauth add membranehq/agent-skills build-product-integrationsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Build apps that integrate with external services via Membrane. Uses the Membrane CLI.
Use this skill when you need to add third-party integrations to a product — connecting customers to external apps, running actions on their behalf, syncing data, or providing AI agent tools.
Membrane is an integration engine. You define what your app needs (which external apps, what operations, what data) and Membrane handles authentication, API calls, and data transformation.
Workspace — your project in Membrane. Contains all integrations, connectors, and configuration for your product.
Customer — a user or organization in your product. Each customer gets their own set of connections and integration state. Identified by a unique ID you choose (e.g. your user/org ID).
Connector — a pre-built adapter for an external app (e.g. Slack, HubSpot). Handles authentication (OAuth, API keys), API client setup, and connection testing. Membrane has connectors for thousands of apps — if one doesn't exist, Membrane Agent can build it.
Integration — the relationship between your product and an external app. Defined in your workspace, it groups connectors, actions, data collections, and flows for a specific app.
Connection — an authenticated link between a customer and an external app. Created when a customer goes through the OAuth/auth flow. Contains credentials managed by Membrane.
Action — a single operation on a connected app (e.g. "Send message", "Create task", "List contacts"). Has typed inputSchema and outputSchema. Can be run via API or used as AI agent tools.
Data Collection — a consistent API for working with external app data like a database table. Supports list, find, search, create, update, delete operations.
Flow — multi-step async logic triggered by events, schedules, or API calls. Composed of trigger, function, and control nodes.
Membrane elements exist at three layers:
integrationId). Example: a "Create Jira Issue" action.connectionId). Can customize integration-level elements per customer.Integration-level elements need implementations per integration. Connection-level elements can override/customize integration-level defaults.
Membrane uses JWT tokens for API access:
iss claim)External app credentials (OAuth tokens, API keys) are managed by Membrane — your app never handles them directly.
Always follow this pattern when working with Membrane:
Example: User wants to list Slack channels
# Step 1: Search for a "list channels" action
npx @membranehq/cli action list --connectionId <slack-conn-id> --intent "list channels" --limit 5 --json
# Step 2: If found, run it
npx @membranehq/cli action run <actionId> --connectionId <slack-conn-id> --json
# Step 3: If NOT found, delegate to Membrane Agent
npx @membranehq/cli agent-session create --agent action-building --message "Create an action to list Slack channels for connection <slack-conn-id>" --json
npx @membranehq/cli agent-session get <sessionId> --wait --json
# Then search again and run the newly created action
Example: User wants to add a new app (e.g. Notion)
# Step 1: Search for existing Notion connector
npx @membranehq/cli search notion --elementType connector --json
# Step 2: If found, create a connection
npx @membranehq/cli connect --connectorId <connectorId>
# Step 3: If NOT found, delegate to Membrane Agent
npx @membranehq/cli agent-session create --agent connection-building --message "Build a connector for Notion (https://notion.so)" --json
npx @membranehq/cli agent-session get <sessionId> --wait --json
# Then create a connection with the new connector
This pattern applies to everything in Membrane. When an element (action, connector, data collection, flow) doesn't exist, always delegate to Membrane Agent to build it — never try to build it yourself.
Authenticate with the Membrane CLI for development and testing:
npx @membranehq/cli login --tenant
Alternatively, install globally (npm i -g @membranehq/cli@latest) and use membrane login --tenant.
Always use --tenant to get a tenant-scoped token — this authenticates on behalf of a specific tenant (workspace + customer), so you don't need to pass --workspaceKey and --tenantKey on every subsequent command.
This opens a browser or prints an authorization URL. The user authenticates in Membrane, then selects a workspace and tenant.
Credentials are stored in ~/.membrane/credentials.json.
If browser login is not available (remote/headless), the CLI prints an authorization URL. Ask the user to open it and enter the code they see:
npx @membranehq/cli login complete <code>
In production, your backend generates JWT tokens per customer per request:
import jwt from 'jsonwebtoken'
function generateMembraneToken(customerId, customerName) {
return jwt.sign(
{
id: customerId,
name: customerName,
},
process.env.MEMBRANE_WORKSPACE_SECRET,
{
issuer: process.env.MEMBRANE_WORKSPACE_KEY,
expiresIn: '2h',
},
)
}
Create an endpoint on your backend (e.g. /api/membrane-token) that returns this token. The frontend SDK calls this to authenticate.
There are three main ways to use Membrane in your app:
npm install @membranehq/sdk
import { MembraneClient } from '@membranehq/sdk'
const membrane = new MembraneClient({
fetchToken: async () => {
const response = await fetch('/api/membrane-token')
const { token } = await response.json()
return token
},
})
// List available integrations
const integrations = await membrane.integrations.find()
// Open connection UI (popup)
await membrane.ui.connect({ integrationKey: 'hubspot' })
// List customer's connections
const connections = await membrane.connections.find()
// Reconnect a disconnected connection
await membrane.ui.connect({ connectionId: 'conn_123' })
// Delete a connection
await membrane.connection('conn_123').archive()
npm install @membranehq/react
import { MembraneProvider, useIntegrations, useConnections, useMembrane } from '@membranehq/react'
function App() {
return (
<MembraneProvider
fetchToken={async () => {
const res = await fetch('/api/membrane-token')
const { token } = await res.json()
return token
}}
>
<IntegrationsPage />
</MembraneProvider>
)
}
function IntegrationsPage() {
const { items: integrations, loading } = useIntegrations()
const { items: connections } = useConnections()
const membrane = useMembrane()
const handleConnect = (integrationKey) => {
membrane.ui.connect({ integrationKey })
}
// ... render integrations list with connect buttons
}
Use the Membrane API directly from your backend.
Base URL: https://api.getmembrane.com (or https://api.integration.app)
Auth: Authorization: Bearer <token>
# List integrations
GET /integrations
# List connections
GET /connections
# Create connection request (returns auth URL)
POST /connection-requests
{"connectorId": "<id>"}
# Check connection request status
GET /connection-requests/<id>
# List actions for a connection
GET /actions?connectionId=<id>
# Run an action
POST /actions/<id>/run?connectionId=<cid>
{"input": {"channel": "#general", "text": "Hello!"}}
Membrane provides a pre-built connection UI that handles OAuth flows and credential collection:
https://ui.integration.app/embed/integrations/{INTEGRATION_KEY}/connect?token={TOKEN}
Use in an iframe or redirect. Optional query params:
redirectUri — redirect back after connectionallowMultipleConnections=1 — allow multiple connections per integrationname — pre-set connection nameFor reconnecting disconnected connections:
https://ui.integration.app/embed/connections/{CONNECTION_ID}/refresh?token={TOKEN}
Actions are operations on connected apps. Find and run them:
# Search actions by intent
npx @membranehq/cli action list --connectionId abc123 --intent "send a message" --limit 10 --json
# Run an action
npx @membranehq/cli action run <actionId> --connectionId abc123 --input '{"channel": "#general", "text": "Hello!"}' --json
# Search actions
GET /actions?connectionId=abc123&intent=send+a+message&limit=10
# Run action
POST /actions/<actionId>/run?connectionId=abc123
{"input": {"channel": "#general", "text": "Hello!"}}
Each action has:
id — unique identifiername, description — what it doesinputSchema — JSON Schema of accepted parametersoutputSchema — JSON Schema of the return valueThe result is in the output field of the response.
Membrane actions can serve as tools for AI agents. Two approaches:
Use when you know which tools the agent needs before the session starts.
GET /connectionsGET /actions?connectionId=<id>const tools = actions.items.map((action) => ({
id: action.id,
name: action.name,
description: action.description,
inputSchema: action.inputSchema,
}))
POST /actions/<id>/run?connectionId=<cid> with {"input": {...}}Use when tools depend on user intent or conversation context.
Search actions by natural language intent:
GET /actions?connectionId=abc123&intent=send+a+message
This uses semantic search to find the best matching actions.
Membrane provides an official MCP server for AI agents:
https://mcp.integration.app/sse?token={TOKEN}&productKey={PRODUCT_KEY}
Works with Claude, Cursor, and any MCP-compatible agent.
Membrane Agent is an AI agent that builds integration elements (connectors, actions, data collections, flows) for you. You should not build these yourself — delegate to Membrane Agent instead.
Use the CLI to create agent sessions:
npx @membranehq/cli agent-session create --agent <agentName> --message "<description>" --json
Available agent types:
connection-building — builds connectors for external appsaction-building — builds actions for connected appsmembrane — general-purpose Membrane agent (can build any element)Create a session with a clear description of what you need:
npx @membranehq/cli agent-session create --agent action-building --message "Create an action to send a message in a Slack channel for connection abc123" --json
Poll until complete — the agent works asynchronously:
npx @membranehq/cli agent-session get <sessionId> --wait --json
state: "busy" — still working, poll againstate: "idle" — done with current requeststatus: "completed" — session finishedsummary — description of what was done (available when idle)Send follow-ups if needed:
npx @membranehq/cli agent-session send <sessionId> --message "Also add support for thread replies" --json
Abort if something goes wrong:
npx @membranehq/cli agent-session abort <sessionId> --json
Delegate to Membrane Agent:
Build yourself:
When creating agent sessions, provide:
for connection abc123)Build a connector for Notion (https://notion.so))Create an action to list all tasks assigned to the current user)If no connector exists for an app:
# Search first
npx @membranehq/cli search notion --elementType connector --json
# If not found, build one
npx @membranehq/cli agent-session create --agent connection-building --message "Build a connector for Notion (https://notion.so)" --json
# Poll for completion
npx @membranehq/cli agent-session get <sessionId> --wait --json
# After built, create a connection
npx @membranehq/cli connect --connectorId <connectorId>
If the action you need doesn't exist:
# Search first
npx @membranehq/cli action list --connectionId abc123 --intent "create a task" --limit 10 --json
# If not found, build one
npx @membranehq/cli agent-session create --agent action-building --message "Create an action to create a task with title, description, and assignee for connection abc123" --json
# Poll for completion
npx @membranehq/cli agent-session get <sessionId> --wait --json
# Search again to get the action ID
npx @membranehq/cli action list --connectionId abc123 --intent "create a task" --limit 10 --json
Check connection status:
npx @membranehq/cli connection get <connectionId> --json
Key fields:
disconnected: true — credentials expired or revoked, needs reconnectionerror — details about what went wrongReconnect:
npx @membranehq/cli connect --connectionId <connectionId>
When an action fails, the response includes error details. Common issues:
inputSchema for required fieldsIf action list --intent doesn't return what you need:
npx @membranehq/cli action list --connectionId abc123 --jsonAll commands support --json for structured JSON output. Add --workspaceKey <key> and --tenantKey <key> to override defaults.
npx @membranehq/cli connection list [--json] # List all connections
npx @membranehq/cli connection get <id> [--json] # Get a connection by ID
npx @membranehq/cli connect --connectorId <id> # Create connection via browser OAuth
npx @membranehq/cli connect --connectionId <id> # Reconnect existing connection
Opens a browser for authentication. Use --non-interactive to print the URL instead.
npx @membranehq/cli connection-request create [options] [--json] # Create connection request
npx @membranehq/cli connection-request get <requestId> [--json] # Check request status
Options: --connectorId <id>, --integrationId <id>, --integrationKey <key>, --connectionId <id> (reconnect), --name <name>
Status values: pending, success, error, cancelled
npx @membranehq/cli action list [--connectionId <id>] [--intent <text>] [--limit <n>] [--json] # List/search actions
npx @membranehq/cli action run <actionId> --connectionId <id> [--input <json>] [--json] # Run an action
npx @membranehq/cli search <query> [--elementType <type>] [--limit <n>] [--json] # Search connectors, integrations, etc.
npx @membranehq/cli agent-session create --agent <agentName> --message <text> [--json] # Create session
npx @membranehq/cli agent-session list [--json] # List sessions
npx @membranehq/cli agent-session get <id> [--wait] [--timeout <seconds>] [--json] # Get status
npx @membranehq/cli agent-session send <id> --message <text> [--json] # Send follow-up
npx @membranehq/cli agent-session abort <id> [--json] # Abort session
npx @membranehq/cli agent-session messages <id> [--json] # Get messages
If the CLI is not available, make direct API requests.
Base URL: https://api.getmembrane.com
Auth header: Authorization: Bearer $MEMBRANE_TOKEN
| CLI Command | API Equivalent |
| ------------------------------------------------------------ | ------------------------------------------------------------------- |
| connection list --json | GET /connections |
| connection get <id> --json | GET /connections/:id |
| search <q> --json | GET /search?q=<q> |
| connection-request create --connectorId <id> --json | POST /connection-requests with {"connectorId": "<id>"} |
| connection-request get <id> --json | GET /connection-requests/:id |
| action list --connectionId <id> --intent <text> --json | GET /actions?connectionId=<id>&intent=<text> |
| action run <id> --connectionId <cid> --input <json> --json | POST /actions/:id/run?connectionId=<cid> with {"input": <json>} |
| agent-session create --message <text> --json | POST /agent/sessions with {"prompt": "<text>"} |
| agent-session get <id> --wait --json | GET /agent/sessions/:id?wait=true |
| agent-session send <id> --message <text> --json | POST /agent/sessions/:id/message with {"input": "<text>"} |
| agent-session abort <id> --json | POST /agent/sessions/:id/interrupt |
All requests go to the Membrane API. No other external services are contacted directly by this skill.
| Endpoint | Data Sent |
| ------------------------------- | --------------------------------------------------------------------- |
| https://api.getmembrane.com/* | Auth credentials, connection parameters, action inputs, agent prompts |
~/.membrane/ with restricted file permissions.By using this skill, data is sent to Membrane. Only install if you trust Membrane with access to your connected apps.
tools
Use this skill when writing code that reads, writes, syncs, or reacts to data in an external app. Applies to SaaS products, internal tools, scripts, batch jobs, and CLIs. The skill uses Membrane as the integration engine — it handles OAuth and credential lifecycle (authentication, token refresh, reconnect), exposes vendor operations through a uniform interface, delivers events via webhooks, generates connectors on demand for apps not yet in the workspace, and captures every action run and raw API exchange in structured logs. Works against any external app.
development
Connect to any external app and perform actions on it. Use when the user wants to interact with external services like Slack, Linear, HubSpot, Salesforce, Jira, GitHub, Google Sheets, or any other app — send messages, create tasks, sync data, manage contacts, or perform any API operation.
tools
Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layers like Lobster, ACPX, plugins, or plain code. Keep conditional logic in the caller; use TaskFlow for flow identity, child-task linkage, waiting state, revision-checked mutations, and user-facing emergence.
tools
# Lobster Lobster executes multi-step workflows with approval checkpoints. Use it when: - User wants a repeatable automation (triage, monitor, sync) - Actions need human approval before executing (send, post, delete) - Multiple tool calls should run as one deterministic operation ## When to use Lobster | User intent | Use Lobster? | | ------------------------------------------------------ | --------------------------