self-integration

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 API.
连接任意外部应用并对其执行操作。使用Membrane API。

Making API Requests

发起API请求

All requests go to
${MEMBRANE_API_URL:-https://api.getmembrane.com}
with a Bearer token:
Authorization: Bearer $MEMBRANE_TOKEN
Content-Type: application/json
Get the API token from the Membrane dashboard.
所有请求都发往
${MEMBRANE_API_URL:-https://api.getmembrane.com}
,并携带Bearer令牌:
Authorization: Bearer $MEMBRANE_TOKEN
Content-Type: application/json
Membrane控制台获取API令牌。

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. Check for existing connections

1a. 检查现有连接

GET /connections
Look for a connection matching the target app. Key fields:
id
,
name
,
connectorId
,
disconnected
.
If a matching connection exists and
disconnected
is
false
, skip to Step 2.
GET /connections
查找与目标应用匹配的连接。关键字段:
id
name
connectorId
disconnected
如果存在匹配的连接且
disconnected
false
,直接跳至步骤2

1b. Find a connector

1b. 查找连接器

A connector is a pre-built adapter for an external app. Search by app name:
GET /search?q=slack
Look for results with
elementType: "connector"
. Use
element.id
as
connectorId
in step 1d.
If nothing is found, go to step 1c to build a connector.
连接器是针对外部应用的预构建适配器。按应用名称搜索:
GET /search?q=slack
查找
elementType: "connector"
的结果。将
element.id
作为步骤1d中的
connectorId
使用。
如果未找到结果,执行步骤1c构建连接器。

1c. Build a connector (if none exists)

1c. 构建连接器(如果不存在)

Create a Membrane Agent session to build a connector:
POST /agent/sessions
with body
{"prompt": "Build a connector for Slack (https://slack.com)"}
Adjust the prompt to describe the actual app you need. Poll
GET /agent/sessions/{sessionId}?wait=true&timeout=30
until
state
is
"idle"
or
status
is
"completed"
.
You can send follow-up instructions via
POST /agent/sessions/{sessionId}/message
or abort via
POST /agent/sessions/{sessionId}/interrupt
.
After the connector is built, search for it again (step 1b).
创建Membrane Agent会话来构建连接器:
POST /agent/sessions
,请求体为
{"prompt": "Build a connector for Slack (https://slack.com)"}
调整提示词以描述你实际需要的应用。轮询
GET /agent/sessions/{sessionId}?wait=true&timeout=30
,直到
state
变为
"idle"
status
变为
"completed"
你可以通过
POST /agent/sessions/{sessionId}/message
发送后续指令,或通过
POST /agent/sessions/{sessionId}/interrupt
终止会话。
连接器构建完成后,再次执行步骤1b进行搜索。

1d. Request a connection

1d. 请求连接

Create a connection request so the user can authenticate with the external app:
POST /connection-requests
with body
{"connectorId": "cnt_abc123"}
The response includes a
url
. Tell the user to open the
url
to complete authentication (OAuth, API key, etc.).
创建连接请求,以便用户对外部应用进行认证:
POST /connection-requests
,请求体为
{"connectorId": "cnt_abc123"}
响应中包含一个
url
。**请告知用户打开该
url
**以完成认证(OAuth、API密钥等)。

1e. Check connection result

1e. 检查连接结果

Poll until the user completes authentication:
GET /connection-requests/{requestId}
  • status: "pending"
    — user hasn't completed yet, poll again.
  • status: "success"
    — done. Use
    resultConnectionId
    as the connection ID going forward.
  • status: "error"
    — failed. Check
    resultError
    for details.
轮询直到用户完成认证:
GET /connection-requests/{requestId}
  • status: "pending"
    — 用户尚未完成,继续轮询。
  • status: "success"
    — 完成。后续使用
    resultConnectionId
    作为连接ID。
  • status: "error"
    — 失败。查看
    resultError
    获取详细信息。

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:
GET /actions?connectionId=con_abc123&intent=send+a+message&limit=10
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.
使用自然语言描述你想要执行的操作进行搜索:
GET /actions?connectionId=con_abc123&intent=send+a+message&limit=10
每个结果包含
id
name
description
inputSchema
(操作接受的参数)和
outputSchema
(操作返回的内容)。
如果没有找到合适的操作,执行步骤2b。

2b. Build an action (if none exists)

2b. 构建操作(如果不存在)

Use Membrane Agent. ALWAYS include the connection ID in the prompt:
POST /agent/sessions
with body
{"prompt": "Create a tool to send a message in a channel for connection con_abc123"}
Adjust the prompt to describe the actual action you need. Poll for completion the same way as step 1c. After the action is built, search for it again (step 2a).
使用Membrane Agent。请务必在提示词中包含连接ID:
POST /agent/sessions
,请求体为
{"prompt": "Create a tool to send a message in a channel for connection con_abc123"}
调整提示词以描述你实际需要的操作。按步骤1c中的方式轮询直到完成。操作构建完成后,再次执行步骤2a进行搜索。

Step 3: Run an Action

步骤3:执行操作

Execute the action using the action ID from step 2 and the connection ID from step 1:
POST /actions/{actionId}/run?connectionId=con_abc123
with body
{"input": {"channel": "#general", "text": "Hello!"}}
Provide
input
matching the action's
inputSchema
.
The result is in the
output
field of the response.
使用步骤2中的操作ID和步骤1中的连接ID执行操作:
POST /actions/{actionId}/run?connectionId=con_abc123
,请求体为
{"input": {"channel": "#general", "text": "Hello!"}}
提供与操作
inputSchema
匹配的
input
参数。
结果在响应的
output
字段中。

API Reference

API参考

Base URL:
${MEMBRANE_API_URL:-https://api.getmembrane.com}
Auth header:
Authorization: Bearer $MEMBRANE_TOKEN
基础URL:
${MEMBRANE_API_URL:-https://api.getmembrane.com}
认证头:
Authorization: Bearer $MEMBRANE_TOKEN

GET /connections

GET /connections

List all connections.
Response:
json
{
  "items": [
    {
      "id": "string",
      "name": "string",
      "connectorId": "string",
      "integrationId": "string (optional)",
      "disconnected": "boolean",
      "state": "NOT_CONFIGURED | SETUP_IN_PROGRESS | SETUP_FAILED | READY",
      "error": "object (optional)",
      "createdAt": "datetime",
      "updatedAt": "datetime"
    }
  ]
}
列出所有连接。
响应:
json
{
  "items": [
    {
      "id": "string",
      "name": "string",
      "connectorId": "string",
      "integrationId": "string (optional)",
      "disconnected": "boolean",
      "state": "NOT_CONFIGURED | SETUP_IN_PROGRESS | SETUP_FAILED | READY",
      "error": "object (optional)",
      "createdAt": "datetime",
      "updatedAt": "datetime"
    }
  ]
}

GET /search

GET /search

Search workspace elements by keyword.
Query parameters:
ParamTypeDescription
q
string (required)Search query (1-200 chars)
elementType
string (optional)Filter by type:
Connector
,
Integration
,
Action
, etc.
limit
number (optional)Max results (1-100)
Response:
json
{
  "items": [
    {
      "elementType": "Connector",
      "element": {
        "id": "string",
        "name": "string",
        "logoUri": "string (optional)"
      }
    }
  ]
}
按关键词搜索工作区元素。
查询参数:
参数类型描述
q
string(必填)搜索查询词(1-200字符)
elementType
string(可选)按类型筛选:
Connector
Integration
Action
limit
number(可选)最大结果数(1-100)
响应:
json
{
  "items": [
    {
      "elementType": "Connector",
      "element": {
        "id": "string",
        "name": "string",
        "logoUri": "string (optional)"
      }
    }
  ]
}

POST /connection-requests

POST /connection-requests

Create a connection request for user authentication.
Request body (at least one identifier required):
FieldTypeDescription
connectorId
stringConnector ID
integrationId
stringIntegration ID (alternative)
integrationKey
stringIntegration key (alternative)
connectionId
stringExisting connection ID (for reconnecting)
name
stringCustom connection name
connectorVersion
stringConnector version
connectorParameters
objectConnector-specific parameters
Response:
json
{
  "requestId": "string",
  "url": "string",
  "status": "pending | success | cancelled | error",
  "connectorId": "string (optional)",
  "integrationId": "string (optional)",
  "resultConnectionId": "string (optional, set on success)",
  "resultError": "object (optional, set on error)",
  "createdAt": "datetime"
}
创建用于用户认证的连接请求。
请求体(至少需要一个标识符):
字段类型描述
connectorId
string连接器ID
integrationId
string集成ID(替代选项)
integrationKey
string集成密钥(替代选项)
connectionId
string现有连接ID(用于重新连接)
name
string自定义连接名称
connectorVersion
string连接器版本
connectorParameters
object连接器专属参数
响应:
json
{
  "requestId": "string",
  "url": "string",
  "status": "pending | success | cancelled | error",
  "connectorId": "string (optional)",
  "integrationId": "string (optional)",
  "resultConnectionId": "string (optional, set on success)",
  "resultError": "object (optional, set on error)",
  "createdAt": "datetime"
}

GET /connection-requests/:requestId

GET /connection-requests/:requestId

Check connection request status. Same response schema as POST.
检查连接请求状态。响应结构与POST请求相同。

GET /actions

GET /actions

List or search actions.
Query parameters:
ParamTypeDescription
connectionId
stringFilter by connection
integrationId
stringFilter by integration
intent
stringNatural language search (max 200 chars)
limit
numberMax results (default 10)
Response:
json
{
  "items": [
    {
      "id": "string",
      "name": "string",
      "key": "string",
      "description": "string (optional)",
      "type": "string",
      "inputSchema": "JSON Schema (optional)",
      "outputSchema": "JSON Schema (optional)",
      "integrationId": "string (optional)",
      "connectionId": "string (optional)"
    }
  ]
}
列出或搜索操作。
查询参数:
参数类型描述
connectionId
string按连接筛选
integrationId
string按集成筛选
intent
string自然语言搜索(最多200字符)
limit
number最大结果数(默认10)
响应:
json
{
  "items": [
    {
      "id": "string",
      "name": "string",
      "key": "string",
      "description": "string (optional)",
      "type": "string",
      "inputSchema": "JSON Schema (optional)",
      "outputSchema": "JSON Schema (optional)",
      "integrationId": "string (optional)",
      "connectionId": "string (optional)"
    }
  ]
}

POST /actions/:actionId/run

POST /actions/:actionId/run

Run an action.
Query parameters:
ParamTypeDescription
connectionId
stringConnection to run the action on
Request body:
FieldTypeDescription
input
anyParameters matching the action's
inputSchema
Response:
json
{
  "output": "any"
}
执行操作。
查询参数:
参数类型描述
connectionId
string执行操作所使用的连接
请求体:
字段类型描述
input
any与操作
inputSchema
匹配的参数
响应:
json
{
  "output": "any"
}

POST /agent/sessions

POST /agent/sessions

Create an agent session to build connectors or actions.
Request body:
FieldTypeDescription
prompt
string (required)Task description
Response:
json
{
  "id": "string",
  "status": "queued | starting | running | completed | failed | cancelled",
  "state": "busy | idle",
  "prompt": "string",
  "createdAt": "datetime",
  "updatedAt": "datetime"
}
创建Agent会话以构建连接器或操作。
请求体:
字段类型描述
prompt
string(必填)任务描述
响应:
json
{
  "id": "string",
  "status": "queued | starting | running | completed | failed | cancelled",
  "state": "busy | idle",
  "prompt": "string",
  "createdAt": "datetime",
  "updatedAt": "datetime"
}

GET /agent/sessions/:id

GET /agent/sessions/:id

Get agent session status.
Query parameters:
ParamTypeDescription
wait
booleanIf true, long-poll until session is idle or timeout
timeout
numberMax wait in seconds (1-60, default 30)
Response: same schema as POST /agent/sessions.
获取Agent会话状态。
查询参数:
参数类型描述
wait
boolean如果为true,长轮询直到会话空闲或超时
timeout
number最长等待时间(1-60秒,默认30秒)
响应:与POST /agent/sessions的响应结构相同。

POST /agent/sessions/:id/message

POST /agent/sessions/:id/message

Send a follow-up message to an active agent session.
Request body:
FieldTypeDescription
input
string (required)Message to send
Response: same schema as POST /agent/sessions.
向活跃的Agent会话发送后续消息。
请求体:
字段类型描述
input
string(必填)发送的消息
响应:与POST /agent/sessions的响应结构相同。

POST /agent/sessions/:id/interrupt

POST /agent/sessions/:id/interrupt

Abort an agent session.
Response:
json
{
  "interrupted": "boolean"
}
终止Agent会话。
响应:
json
{
  "interrupted": "boolean"
}

External Endpoints

外部端点

All requests go to the Membrane API. No other external services are contacted directly by this skill.
EndpointData Sent
${MEMBRANE_API_URL:-https://api.getmembrane.com}/*
API token, connection parameters, action inputs, agent prompts
所有请求都发往Membrane API。本技能不会直接调用其他外部服务。
端点发送的数据
${MEMBRANE_API_URL:-https://api.getmembrane.com}/*
API令牌、连接参数、操作输入、Agent提示词

Security & Privacy

安全与隐私

  • All data is sent to the Membrane API over HTTPS.
  • MEMBRANE_TOKEN
    is a high-privilege credential that can create connections and run actions across external apps. Treat it as a secret.
  • 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。
  • MEMBRANE_TOKEN
    是高权限凭证,可跨外部应用创建连接并执行操作,请将其视为机密信息。
  • 连接认证(OAuth、API密钥)由Membrane处理——外部应用的凭证由Membrane服务存储,而非本地存储。
  • 操作的输入和输出会通过Membrane API传递至已连接的外部应用。
使用本技能即表示数据会被发送至Membrane。请仅在信任Membrane可访问你的已连接应用时安装本技能。