Back to Registry
View Author Profile
Official Verified
wolai
通过 wolai Open API 操作 wolai 笔记,支持读取页面/块内容、创建各类块(文本、标题、代码、待办、列表、媒体等)、获取数据库、向数据库插入数据、获取/刷新 Token、分页遍历。当用户需要读取 wolai 页面、向 wolai 写入内容、操作 wolai 数据库、或与 wolai 进行任何数据交互时使用此 skill。触发场景:「读取 wolai 页面」、「在 wolai 里写入」、「查询 wolai 数据库」、「往 wolai 插入数据」、「获取 wolai token」、「遍历 wolai 所有内容」等。
skill-install — Terminal
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/cizixiu/wolai-api-skillOr
wolai API Skill
通过 wolai Open API(RESTful)操作 wolai 的块、页面、数据库。
Base URL:https://openapi.wolai.com/v1
Setup
1. 创建应用并获取 Token
- 前往 https://www.wolai.com/dev 创建应用(需空间管理员权限)
- 选择所需应用能力(最小权限原则):
- 读取页面内容
- 插入页面内容
- 更新页面内容
- 创建后得到
App ID和App Secret - 调用
POST /token换取app_token(Token 永久有效,expire_time: -1) - 将 Token 存入环境变量:
# 临时设置(当前 session)
$env:WOLAI_TOKEN = "your_app_token"
# 永久配置(WorkBuddy)
openclaw config set env.WOLAI_TOKEN "your_app_token"
2. 工作空间权限说明
| 空间类型 | 权限规则 |
|---|---|
| 个人空间 | 默认拥有全部页面权限,无需额外操作 |
| 团队空间 | 每个页面需单独添加应用:页面右上角 → 页面协作 → 应用权限 → 添加应用 |
凭证预检
每次调用前先检查 Token:
if (-not $env:WOLAI_TOKEN) {
Write-Error "缺少 WOLAI_TOKEN,请按 Setup 步骤配置"
exit 1
}
API 调用封装
所有请求统一使用 PowerShell(Windows 环境),Token 放在 Authorization Header:
function Invoke-WolaiApi {
param(
[string]$Method = "GET",
[string]$Path,
[hashtable]$Body = $null,
[hashtable]$Query = $null,
[switch]$RawJson # 新增:返回原始 JSON 字符串而非对象(避免中文乱码)
)
# ⚠️ 必须强制 UTF-8,否则中文内容会变成问号
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$OutputEncoding = [System.Text.Encoding]::UTF8
$headers = @{
"Authorization" = $env:WOLAI_TOKEN
"Content-Type" = "application/json; charset=utf-8"
}
$uri = "https://openapi.wolai.com/v1$Path"
# 拼接 Query 参数(用于分页等)
if ($Query) {
$qs = ($Query.GetEnumerator() | ForEach-Object {
# URL 编码值(防止特殊字符问题)
"$($_.Key)=$([System.Web.HttpUtility]::UrlEncode("$($_.Value)"))"
}) -join "&"
$uri = "$uri?$qs"
}
try {
if ($RawJson) {
# 返回原始 JSON 字符串(适合中文内容)
$resp = Invoke-WebRequest -Method $Method -Uri $uri -Headers $headers
if ($Body) {
$bodyBytes = [System.Text.Encoding]::UTF8.GetBytes(($Body | ConvertTo-Json -Depth 10))
$resp = Invoke-WebRequest -Method $Method -Uri $uri -Headers $headers -Body $bodyBytes
}
return $resp.Content
} else {
# 返回解析后的对象
if ($Body) {
$bodyBytes = [System.Text.Encoding]::UTF8.GetBytes(($Body | ConvertTo-Json -Depth 10))
$response = Invoke-RestMethod -Method $Method -Uri $uri -Headers $headers -Body $bodyBytes
} else {
$response = Invoke-RestMethod -Method $Method -Uri $uri -Headers $headers
}
return $response
}
} catch {
# 解析 wolai API 错误响应
$errBody = $_.ErrorDetails.Message | ConvertFrom-Json
if ($errBody.error_code) {
Write-Error "wolai API 错误 [$($errBody.error_code)]: $($errBody.message)"
} else {
Write-Error "请求失败: $($_.Exception.Message)"
}
return $null
}
}
解决中文乱码的两种方式:
Metadata
AI Skill Finder
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skill Add to Configuration
Paste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-cizixiu-wolai-api-skill": {
"enabled": true,
"auto_update": true
}
}
}Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.