self-integration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSelf-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 with a Bearer token:
${MEMBRANE_API_URL:-https://api.getmembrane.com}Authorization: Bearer $MEMBRANE_TOKEN
Content-Type: application/jsonGet the API token from the Membrane dashboard.
所有请求都发往,并携带Bearer令牌:
${MEMBRANE_API_URL:-https://api.getmembrane.com}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 /connectionsLook for a connection matching the target app. Key fields: , , , .
idnameconnectorIddisconnectedIf a matching connection exists and is , skip to Step 2.
disconnectedfalseGET /connections查找与目标应用匹配的连接。关键字段:、、、。
idnameconnectorIddisconnected如果存在匹配的连接且为,直接跳至步骤2。
disconnectedfalse1b. Find a connector
1b. 查找连接器
A connector is a pre-built adapter for an external app. Search by app name:
GET /search?q=slackLook for results with . Use as in step 1d.
elementType: "connector"element.idconnectorIdIf nothing is found, go to step 1c to build a connector.
连接器是针对外部应用的预构建适配器。按应用名称搜索:
GET /search?q=slack查找的结果。将作为步骤1d中的使用。
elementType: "connector"element.idconnectorId如果未找到结果,执行步骤1c构建连接器。
1c. Build a connector (if none exists)
1c. 构建连接器(如果不存在)
Create a Membrane Agent session to build a connector:
POST /agent/sessions{"prompt": "Build a connector for Slack (https://slack.com)"}Adjust the prompt to describe the actual app you need. Poll until is or is .
GET /agent/sessions/{sessionId}?wait=true&timeout=30state"idle"status"completed"You can send follow-up instructions via or abort via .
POST /agent/sessions/{sessionId}/messagePOST /agent/sessions/{sessionId}/interruptAfter 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=30state"idle"status"completed"你可以通过发送后续指令,或通过终止会话。
POST /agent/sessions/{sessionId}/messagePOST /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{"connectorId": "cnt_abc123"}The response includes a . Tell the user to open the to complete authentication (OAuth, API key, etc.).
urlurl创建连接请求,以便用户对外部应用进行认证:
POST /connection-requests{"connectorId": "cnt_abc123"}响应中包含一个。**请告知用户打开该**以完成认证(OAuth、API密钥等)。
urlurl1e. Check connection result
1e. 检查连接结果
Poll until the user completes authentication:
GET /connection-requests/{requestId}- — user hasn't completed yet, poll again.
status: "pending" - — done. Use
status: "success"as the connection ID going forward.resultConnectionId - — failed. Check
status: "error"for details.resultError
轮询直到用户完成认证:
GET /connection-requests/{requestId}- — 用户尚未完成,继续轮询。
status: "pending" - — 完成。后续使用
status: "success"作为连接ID。resultConnectionId - — 失败。查看
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=10Each result includes , , , (what parameters the action accepts), and (what it returns).
idnamedescriptioninputSchemaoutputSchemaIf no suitable action exists, go to step 2b.
使用自然语言描述你想要执行的操作进行搜索:
GET /actions?connectionId=con_abc123&intent=send+a+message&limit=10每个结果包含、、、(操作接受的参数)和(操作返回的内容)。
idnamedescriptioninputSchemaoutputSchema如果没有找到合适的操作,执行步骤2b。
2b. Build an action (if none exists)
2b. 构建操作(如果不存在)
Use Membrane Agent. ALWAYS include the connection ID in the prompt:
POST /agent/sessions{"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{"input": {"channel": "#general", "text": "Hello!"}}Provide matching the action's .
inputinputSchemaThe result is in the field of the response.
output使用步骤2中的操作ID和步骤1中的连接ID执行操作:
POST /actions/{actionId}/run?connectionId=con_abc123{"input": {"channel": "#general", "text": "Hello!"}}提供与操作匹配的参数。
inputSchemainput结果在响应的字段中。
outputAPI Reference
API参考
Base URL:
Auth header:
${MEMBRANE_API_URL:-https://api.getmembrane.com}Authorization: Bearer $MEMBRANE_TOKEN基础URL:
认证头:
${MEMBRANE_API_URL:-https://api.getmembrane.com}Authorization: Bearer $MEMBRANE_TOKENGET /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:
| Param | Type | Description |
|---|---|---|
| string (required) | Search query (1-200 chars) |
| string (optional) | Filter by type: |
| number (optional) | Max results (1-100) |
Response:
json
{
"items": [
{
"elementType": "Connector",
"element": {
"id": "string",
"name": "string",
"logoUri": "string (optional)"
}
}
]
}按关键词搜索工作区元素。
查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| string(必填) | 搜索查询词(1-200字符) |
| string(可选) | 按类型筛选: |
| 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):
| Field | Type | Description |
|---|---|---|
| string | Connector ID |
| string | Integration ID (alternative) |
| string | Integration key (alternative) |
| string | Existing connection ID (for reconnecting) |
| string | Custom connection name |
| string | Connector version |
| object | Connector-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"
}创建用于用户认证的连接请求。
请求体(至少需要一个标识符):
| 字段 | 类型 | 描述 |
|---|---|---|
| string | 连接器ID |
| string | 集成ID(替代选项) |
| string | 集成密钥(替代选项) |
| string | 现有连接ID(用于重新连接) |
| string | 自定义连接名称 |
| string | 连接器版本 |
| 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:
| Param | Type | Description |
|---|---|---|
| string | Filter by connection |
| string | Filter by integration |
| string | Natural language search (max 200 chars) |
| number | Max 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)"
}
]
}列出或搜索操作。
查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| string | 按连接筛选 |
| string | 按集成筛选 |
| string | 自然语言搜索(最多200字符) |
| 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:
| Param | Type | Description |
|---|---|---|
| string | Connection to run the action on |
Request body:
| Field | Type | Description |
|---|---|---|
| any | Parameters matching the action's |
Response:
json
{
"output": "any"
}执行操作。
查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| string | 执行操作所使用的连接 |
请求体:
| 字段 | 类型 | 描述 |
|---|---|---|
| any | 与操作 |
响应:
json
{
"output": "any"
}POST /agent/sessions
POST /agent/sessions
Create an agent session to build connectors or actions.
Request body:
| Field | Type | Description |
|---|---|---|
| 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会话以构建连接器或操作。
请求体:
| 字段 | 类型 | 描述 |
|---|---|---|
| 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:
| Param | Type | Description |
|---|---|---|
| boolean | If true, long-poll until session is idle or timeout |
| number | Max wait in seconds (1-60, default 30) |
Response: same schema as POST /agent/sessions.
获取Agent会话状态。
查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
| boolean | 如果为true,长轮询直到会话空闲或超时 |
| 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:
| Field | Type | Description |
|---|---|---|
| string (required) | Message to send |
Response: same schema as POST /agent/sessions.
向活跃的Agent会话发送后续消息。
请求体:
| 字段 | 类型 | 描述 |
|---|---|---|
| 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.
| Endpoint | Data Sent |
|---|---|
| API token, connection parameters, action inputs, agent prompts |
所有请求都发往Membrane API。本技能不会直接调用其他外部服务。
| 端点 | 发送的数据 |
|---|---|
| API令牌、连接参数、操作输入、Agent提示词 |
Security & Privacy
安全与隐私
- All data is sent to the Membrane API over HTTPS.
- is a high-privilege credential that can create connections and run actions across external apps. Treat it as a secret.
MEMBRANE_TOKEN - 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可访问你的已连接应用时安装本技能。