integrate-anything

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Self-Integration

自集成

Connect to any external app and perform actions on it. Uses the Membrane CLI.
连接任意外部应用并在其上执行操作,使用Membrane CLI实现。

Authentication

认证

Authenticate with the Membrane CLI:
bash
npx @membranehq/cli login --tenant
Alternatively, you can install the membrane CLI globally (
npm i -g @membranehq/cli@latest
) and use
membrane login --tenant
instead.
Always use
--tenant
to get a tenant-scoped token — this authenticates on behalf of a specific tenant (workspace + customer) in Membrane, so you don't need to pass
--workspaceKey
and
--tenantKey
on every subsequent command.
This will either open a browser for authentication or print an authorization URL to the console, depending on whether interactive mode is available. The user authenticates in Membrane, then selects a workspace and tenant (user inside workspace).
When login process is completed, the credentials are stored locally in
~/.membrane/credentials.json
and used in subsequent commands automatically.
通过Membrane CLI完成认证:
bash
npx @membranehq/cli login --tenant
你也可以全局安装Membrane CLI(
npm i -g @membranehq/cli@latest
),改用
membrane login --tenant
命令。
请始终使用
--tenant
参数获取租户范围的令牌——它会代表Membrane中的特定租户(工作区+客户)完成认证,后续所有命令无需再传递
--workspaceKey
--tenantKey
参数。
该命令会根据交互式模式是否可用,要么打开浏览器完成认证,要么在控制台打印授权URL。用户在Membrane完成认证后,选择对应的工作区和租户(工作区内的用户)即可。
登录流程完成后,凭证会存储在本地
~/.membrane/credentials.json
文件中,后续命令会自动调用。

Non-interactive Authentication

非交互式认证

If interactive browser login is not possible (e.g. remote/headless environment) the
membrane login
command will print an authorization URL to the terminal. The user can then open the URL in their browser and complete the login process.
If this is the case, ask the user to enter the code they see in the browser after completing the login process.
When user enters the code, complete the login process with:
bash
npx @membranehq/cli login complete <code>
All commands below use
npx @membranehq/cli
(or just
membrane
if installed globally). Add
--json
to any command for machine-readable JSON output to stdout. Command without
--json
flag will print the result in a human-readable (and often shorter) format.
如果无法使用交互式浏览器登录(例如远程/无界面环境),
membrane login
命令会在终端打印授权URL,用户可以在浏览器中打开该URL完成登录流程。
如果是这种情况,请提示用户输入完成登录流程后浏览器中显示的验证码。
用户输入验证码后,使用以下命令完成登录流程:
bash
npx @membranehq/cli login complete <code>
以下所有命令均使用
npx @membranehq/cli
(如果全局安装了可直接用
membrane
)。任意命令都可以添加
--json
参数,让标准输出返回机器可读的JSON格式;不带
--json
参数的命令会返回人类可读(通常更简洁)的结果格式。

Workflow

工作流程

Step 1: Get a Connection

步骤1:获取连接

A connection is an authenticated link to an external app (e.g. a user's Slack workspace, a HubSpot account). You need one before you can run actions.
连接是指向外部应用的已认证链路(例如用户的Slack工作区、HubSpot账户),执行动作前你需要先获取连接。

1a. Find or create a connection

1a. 查找或创建连接

Use
connection ensure
to automatically search existing connections, integrations, connectors, and apps — and return the best match or create a new one:
bash
npx @membranehq/cli connection ensure "Slack" --json
This is the fastest way to get a connection. It searches in priority order: existing connections > integrations > connectors > external apps. If nothing is found, it creates a new connection and starts building a connector automatically.
If the returned connection has
state: "READY"
, skip to Step 2.
使用
connection ensure
自动搜索现有连接、集成、连接器和应用,返回最佳匹配结果或自动创建新连接:
bash
npx @membranehq/cli connection ensure "Slack" --json
这是获取连接最快的方式,搜索优先级为:现有连接 > 集成 > 连接器 > 外部应用。如果没有找到匹配项,它会创建新连接并自动开始构建连接器。
如果返回的连接
state: "READY"
,直接跳转到步骤2

1b. Wait for the connection to be ready

1b. 等待连接就绪

If the connection is in
BUILDING
state, poll until it's ready:
bash
npx @membranehq/cli connection get <id> --wait --json
The
--wait
flag long-polls (up to
--timeout
seconds, default 30) until the state changes. Keep polling until
state
is no longer
BUILDING
.
The resulting state tells you what to do next:
  • READY
    — connection is fully set up. Skip to Step 2.
  • CLIENT_ACTION_REQUIRED
    — the user or agent needs to do something. The
    clientAction
    object describes the required action:
    • clientAction.type
      — the kind of action needed:
      • "connect"
        — user needs to authenticate (OAuth, API key, etc.). This covers initial authentication and re-authentication for disconnected connections.
      • "provide-input"
        — more information is needed (e.g. which app to connect to).
    • clientAction.description
      — human-readable explanation of what's needed.
    • clientAction.uiUrl
      (optional) — URL to a pre-built UI where the user can complete the action. Show this to the user when present.
    • clientAction.agentInstructions
      (optional) — instructions for the AI agent on how to proceed programmatically.
    After the user completes the action (e.g. authenticates in the browser), poll again with
    connection get <id> --json
    to check if the state moved to
    READY
    .
  • CONFIGURATION_ERROR
    or
    SETUP_FAILED
    — something went wrong. Check the
    error
    field for details.
如果连接处于
BUILDING
状态,轮询查询直到状态变更:
bash
npx @membranehq/cli connection get <id> --wait --json
--wait
参数会启用长轮询(最长为
--timeout
指定的秒数,默认30秒)直到状态变更,持续轮询直到
state
不再是
BUILDING
返回的状态会指示下一步操作:
  • READY
    —— 连接已完全配置完成,跳转到步骤2
  • CLIENT_ACTION_REQUIRED
    —— 需要用户或Agent执行操作,
    clientAction
    对象描述了所需操作:
    • clientAction.type
      —— 需要的操作类型:
      • "connect"
        —— 用户需要完成认证(OAuth、API密钥等),覆盖首次认证和断开连接的重认证场景。
      • "provide-input"
        —— 需要补充更多信息(例如要连接的具体应用)。
    • clientAction.description
      —— 所需操作的人类可读说明。
    • clientAction.uiUrl
      (可选)—— 预制UI页面的URL,用户可在该页面完成操作,存在时请展示给用户。
    • clientAction.agentInstructions
      (可选)—— 给AI Agent的程序化操作指引。
    用户完成操作后(例如在浏览器中完成认证),再次调用
    connection get <id> --json
    轮询检查状态是否变为
    READY
  • CONFIGURATION_ERROR
    SETUP_FAILED
    —— 出现错误,查看
    error
    字段获取详情。

Alternative: Create a connection with more control

替代方案:更可控地创建连接

If you need more control over the connection creation, you can use
connection create
instead:
bash
npx @membranehq/cli connection create "Connect to Slack" --json
This creates a new connection with an intent and starts building in the background. Then follow step 1b to wait for it.
如果你需要对连接创建过程有更多控制,可以改用
connection create
命令:
bash
npx @membranehq/cli connection create "Connect to Slack" --json
该命令会根据指定意图创建新连接并在后台开始构建,之后按照步骤1b等待连接就绪即可。

Step 2: Get an Action

步骤2:获取动作

An action is an operation you can perform on a connected app (e.g. "Create task", "Send message", "List contacts").
动作是你可以在已连接应用上执行的操作(例如“创建任务”、“发送消息”、“列出联系人”)。

2a. Search for actions

2a. 搜索动作

Search using a natural language description of what you want to do:
bash
npx @membranehq/cli action list --connectionId abc123 --intent "send a message" --limit 10 --json
You should always search for actions in the context of a specific connection.
Each result includes
id
,
name
,
description
,
inputSchema
(what parameters the action accepts), and
outputSchema
(what it returns).
If no suitable action exists, go to step 2b.
使用自然语言描述你要执行的操作进行搜索:
bash
npx @membranehq/cli action list --connectionId abc123 --intent "send a message" --limit 10 --json
请始终在指定连接的上下文中搜索动作。
每个搜索结果包含
id
name
description
inputSchema
(动作接受的参数定义)和
outputSchema
(动作返回的结果定义)。
如果没有找到合适的动作,跳转到步骤2b。

2b. Create an action (if none exists)

2b. 创建动作(如果不存在合适的动作)

Describe what you want the action to do — Membrane will build it automatically using an agent:
bash
npx @membranehq/cli action create "send a message in a channel" --connectionId abc123 --json
This returns an action object. The action starts in
BUILDING
state while Membrane builds it in the background.
描述你需要的动作功能,Membrane会使用Agent自动构建该动作:
bash
npx @membranehq/cli action create "send a message in a channel" --connectionId abc123 --json
该命令会返回动作对象,动作初始状态为
BUILDING
,Membrane会在后台完成构建。

2c. Wait for the action to be ready

2c. 等待动作就绪

Poll until the action leaves the
BUILDING
state:
bash
npx @membranehq/cli action get <id> --wait --json
The
--wait
flag long-polls (up to
--timeout
seconds, default 30) until the state changes. Keep polling until
state
is no longer
BUILDING
.
The resulting state tells you what to do next:
  • READY
    — action is fully built. Proceed to Step 3.
  • CONFIGURATION_ERROR
    or
    SETUP_FAILED
    — something went wrong. Check the
    error
    field for details.
After the action is built, you can also search for it again (step 2a) to confirm.
轮询查询直到动作离开
BUILDING
状态:
bash
npx @membranehq/cli action get <id> --wait --json
--wait
参数会启用长轮询(最长为
--timeout
指定的秒数,默认30秒)直到状态变更,持续轮询直到
state
不再是
BUILDING
返回的状态会指示下一步操作:
  • READY
    —— 动作已完全构建完成,前往步骤3
  • CONFIGURATION_ERROR
    SETUP_FAILED
    —— 出现错误,查看
    error
    字段获取详情。
动作构建完成后,你也可以重新执行步骤2a的搜索确认动作可用。

Step 3: Run an Action

步骤3:执行动作

Execute the action using the action ID from step 2 and the connection ID from step 1:
bash
npx @membranehq/cli action run <actionId> --connectionId abc123 --input '{"channel": "#general", "text": "Hello!"}' --json
Provide
--input
matching the action's
inputSchema
.
The result is in the
output
field of the response.
使用步骤2获取的动作ID和步骤1获取的连接ID执行动作:
bash
npx @membranehq/cli action run <actionId> --connectionId abc123 --input '{"channel": "#general", "text": "Hello!"}' --json
请提供与动作
inputSchema
匹配的
--input
参数。
执行结果会包含在响应的
output
字段中。

CLI Reference

CLI参考

All commands support
--json
for structured JSON output to stdout. Add
--workspaceKey <key>
and
--tenantKey <key>
to override project defaults.
所有命令都支持
--json
参数返回结构化JSON标准输出,可添加
--workspaceKey <key>
--tenantKey <key>
参数覆盖项目默认值。

connection

connection

bash
npx @membranehq/cli connection ensure <intent> [--name <name>] [--json]         # Find or create connection (recommended)
npx @membranehq/cli connection list [--json]                                    # List all connections
npx @membranehq/cli connection get <id> [--wait] [--timeout <n>] [--json]       # Get connection (--wait to long-poll)
npx @membranehq/cli connection create <intent> [--name <name>] [--json]         # Create connection with intent
bash
npx @membranehq/cli connection ensure <intent> [--name <name>] [--json]         # 查找或创建连接(推荐)
npx @membranehq/cli connection list [--json]                                    # 列出所有连接
npx @membranehq/cli connection get <id> [--wait] [--timeout <n>] [--json]       # 获取连接(--wait启用长轮询)
npx @membranehq/cli connection create <intent> [--name <name>] [--json]         # 根据意图创建连接

action

action

bash
npx @membranehq/cli action list [--connectionId <id>] [--intent <text>] [--limit <n>] [--json]                  # List/search actions
npx @membranehq/cli action create <intent> --connectionId <id> [--name <name>] [--json]                          # Create action with intent
npx @membranehq/cli action get <id> [--wait] [--timeout <n>] [--json]                                            # Get action (--wait to long-poll)
npx @membranehq/cli action run <actionId> --connectionId <id> [--input <json>] [--json]                          # Run an action
bash
npx @membranehq/cli action list [--connectionId <id>] [--intent <text>] [--limit <n>] [--json]                  # 列出/搜索动作
npx @membranehq/cli action create <intent> --connectionId <id> [--name <name>] [--json]                          # 根据意图创建动作
npx @membranehq/cli action get <id> [--wait] [--timeout <n>] [--json]                                            # 获取动作(--wait启用长轮询)
npx @membranehq/cli action run <actionId> --connectionId <id> [--input <json>] [--json]                          # 执行动作

search

search

bash
npx @membranehq/cli search <query> [--elementType <type>] [--limit <n>] [--json]   # Search connectors, integrations, etc.
bash
npx @membranehq/cli search <query> [--elementType <type>] [--limit <n>] [--json]   # 搜索连接器、集成等资源

Fallback: Raw API

备选方案:原生API

If the CLI is not available, you can make direct API requests.
Base URL:
https://api.getmembrane.com
Auth header:
Authorization: Bearer $MEMBRANE_TOKEN
Get the API token from the Membrane dashboard.
CLI CommandAPI Equivalent
connection ensure "<text>" --json
POST /connections/ensure
with
{"intent": "<text>"}
connection list --json
GET /connections
connection get <id> --wait --json
GET /connections/:id?wait=true
connection create "<text>" --json
POST /connections
with
{"intent": "<text>"}
search <q> --json
GET /search?q=<q>
action list --connectionId <id> --intent <text> --json
GET /actions?connectionId=<id>&intent=<text>
action create "<text>" --connectionId <cid> --json
POST /actions
with
{"intent": "<text>", "connectionId": "<cid>"}
action get <id> --wait --json
GET /actions/:id?wait=true
action run <id> --connectionId <cid> --input <json> --json
POST /actions/:id/run?connectionId=<cid>
with
{"input": <json>}
如果无法使用CLI,你可以直接发起API请求。
基础URL:
https://api.getmembrane.com
认证头:
Authorization: Bearer $MEMBRANE_TOKEN
你可以从Membrane控制台获取API令牌。
CLI命令对应API
connection ensure "<text>" --json
POST /connections/ensure
附带参数
{"intent": "<text>"}
connection list --json
GET /connections
connection get <id> --wait --json
GET /connections/:id?wait=true
connection create "<text>" --json
POST /connections
附带参数
{"intent": "<text>"}
search <q> --json
GET /search?q=<q>
action list --connectionId <id> --intent <text> --json
GET /actions?connectionId=<id>&intent=<text>
action create "<text>" --connectionId <cid> --json
POST /actions
附带参数
{"intent": "<text>", "connectionId": "<cid>"}
action get <id> --wait --json
GET /actions/:id?wait=true
action run <id> --connectionId <cid> --input <json> --json
POST /actions/:id/run?connectionId=<cid>
附带参数
{"input": <json>}

External Endpoints

外部端点

All requests go to the Membrane API. No other external services are contacted directly by this skill.
EndpointData Sent
https://api.getmembrane.com/*
Auth credentials, connection parameters, action inputs, agent prompts
所有请求都会发送到Membrane API,该技能不会直接调用其他外部服务。
端点发送的数据
https://api.getmembrane.com/*
认证凭证、连接参数、动作输入、Agent提示词

Security & Privacy

安全与隐私

  • All data is sent to the Membrane API over HTTPS.
  • CLI credentials are stored locally in
    ~/.membrane/
    with restricted file permissions.
  • Connection authentication (OAuth, API keys) is handled by Membrane — credentials for external apps are stored by the Membrane service, not locally.
  • Action inputs and outputs pass through the Membrane API to the connected external app.
By using this skill, data is sent to Membrane. Only install if you trust Membrane with access to your connected apps.
  • 所有数据通过HTTPS传输到Membrane API。
  • CLI凭证存储在本地
    ~/.membrane/
    目录下,文件权限做了限制。
  • 连接认证(OAuth、API密钥)由Membrane处理,外部应用的凭证由Membrane服务存储,不会保存在本地。
  • 动作的输入和输出会通过Membrane API转发到已连接的外部应用。
使用该技能意味着数据会发送到Membrane,仅当你信任Membrane可以访问你连接的应用时再安装使用。