将 OpenClaw 生成的自驾行程同步到 TripClaw 应用。
用户需要先配置 TripClaw API Key:
# 设置环境变量(推荐)
export TRIPCLAW_API_KEY="your-api-key-here"
# 或在 OpenClaw 配置中添加
⚠️ 安全提醒:API Key 是敏感信息,请勿分享、勿提交到公开仓库、勿在截图或录屏中暴露。
用户说以下任一指令时触发:
TripClaw 接受以下 JSON 格式的行程数据:
{
"name": "行程名称",
"description": "行程描述(可选)",
"startDate": "2024-01-15",
"endDate": "2024-01-22",
"travelers": 2,
"waypoints": [
{
"order": 1,
"name": "地点名称",
"type": "start|waypoint|destination",
"location": {
"address": "详细地址",
"coordinates": {
"lat": 25.0389,
"lng": 102.7183
}
},
"arrivalDate": "2024-01-15",
"stay": {
"accommodation": "住宿名称",
"nights": 1,
"bookingUrl": "预订链接(可选)"
}
}
],
"activities": [
{
"date": "2024-01-16",
"name": "活动名称",
"description": "活动描述",
"location": {
"address": "活动地点",
"coordinates": { "lat": 0, "lng": 0 }
},
"duration": "2小时",
"cost": 100
}
],
"budget": {
"total": 15000,
"currency": "CNY"
}
}
| 字段 | 必填 | 说明 |
|---|---|---|
| ------ | ------ | ------ |
| name | ✅ | 行程名称 |
| description | ❌ | 行程描述 |
| startDate | ✅ | 开始日期 (YYYY-MM-DD) |
| endDate | ✅ | 结束日期 (YYYY-MM-DD) |
| travelers | ❌ | 出行人数,默认 1 |
| waypoints | ✅ | 途经点数组,至少 1 个 |
| activities | ❌ | 活动安排数组 |
| budget | ❌ | 预算信息 |
start - 出发点waypoint - 中途经停点destination - 最终目的地scripts/import_trip.py 发送到 TripClaw使用脚本执行实际导入:
python3 scripts/import_trip.py --api-key "$TRIPCLAW_API_KEY" --data '<trip-json-data>'
或传入文件:
python3 scripts/import_trip.py --api-key "$TRIPCLAW_API_KEY" --file trip.json
详细的 API 文档请参阅 references/api.md。
| 错误码 | 说明 | 处理建议 |
|---|---|---|
| -------- | ------ | ---------- |
| 401 | API Key 无效或过期 | 检查 TRIPCLAW_API_KEY 配置 |
| 400 | 数据格式错误 | 检查 JSON 结构是否符合规范 |
| 404 | 用户不存在 | 确认 API Key 对应的账户状态 |
| 429 | 请求过于频繁 | 稍后重试 |
| 500 | 服务器错误 | 联系 TripClaw 支持 |
共 1 个版本