360 Secure SkillHub
360 安全技能中心

WHOOP Health Data Sync

通过 OAuth 授权访问 WHOOP API,用 Python 脚本把恢复分数、HRV、睡眠、日间疲劳和训练数据同步为 health/whoop-YYYY-MM-DD.md 文件,支持指定日期、最近 7 天与周报模式,并给出 openclaw cron 每日自动同步示例;脚本无第三方 Python 依赖。

aikong-cmd
aikong-cmd
热度 54.98
最近更新 2026-05-18 12:28:23
分类:生活依赖:代码执行 / 第三方 API / 读写文件应用场景:健康 / 数据处理 / 报告撰写 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add whoop-health-sync
Metadata
name
whoop
description
Sync WHOOP health data (recovery, sleep, strain, workouts) to markdown files for AI-powered health insights. Use when user asks about WHOOP data, health metrics, recovery scores, sleep analysis, HRV, strain tracking, or wants daily health reports. Triggers on "WHOOP", "recovery score", "HRV", "sleep debt", "strain", "health sync", "健康数据", "恢复分数", "睡眠", "心率变异性".

WHOOP Health Data Sync

Sync WHOOP wearable data to health/whoop-YYYY-MM-DD.md files. Pure Python, zero dependencies.

Data Coverage

Recovery (score/HRV/RHR/SpO2/skin temp), Sleep (performance/efficiency/stages/respiratory rate/sleep need/balance), Day Strain (strain/calories/HR), Workouts (sport/duration/strain/HR/zones/distance), Weekly summaries.

Setup

1. Create WHOOP Developer App

  1. Go to https://developer-dashboard.whoop.com/
  2. Create Application → Redirect URI: http://localhost:9527/callback → select all read:* + offline scopes
  3. Note Client ID and Client Secret

2. Store Credentials

Env vars:

export WHOOP_CLIENT_ID="your-id"
export WHOOP_CLIENT_SECRET="your-secret"

Or 1Password: Create Login item named whoop (username=Client ID, password=Client Secret).

3. Authorize (one-time)

Local (browser on same machine):

python3 scripts/auth.py

Remote server (headless):

python3 scripts/auth.py --print-url
# User opens URL in browser, authorizes, copies callback URL back
python3 scripts/auth.py --callback-url "http://localhost:9527/callback?code=xxx&state=yyy"

Tokens auto-refresh via offline scope. Authorize once, runs forever.

Usage

python3 scripts/sync.py              # Sync today
python3 scripts/sync.py --days 7     # Last 7 days
python3 scripts/sync.py --weekly     # Weekly summary
python3 scripts/sync.py --date 2026-03-07  # Specific date

Output: ~/.openclaw/workspace/health/whoop-YYYY-MM-DD.md

Cron (daily auto-sync)

openclaw cron add \
  --name whoop-daily \
  --schedule "0 10 * * *" \
  --timezone Asia/Shanghai \
  --task "Run: python3 ~/.openclaw/workspace/skills/whoop/scripts/sync.py --days 2. Then read the generated markdown files and send me the latest day's report."

Troubleshooting

Problem Fix
No tokens found Run auth.py first
Token refresh failed (403) Re-run auth.py to re-authorize
error code: 1010 Cloudflare block — uses curl to avoid. Check network
No data for date WHOOP finalizes sleep after waking; try later

Agent Notes

  • When user asks to re-authorize: run auth.py --print-url, send URL, wait for callback URL
  • After authorization: verify with sync.py --days 1
  • Token exchange uses curl to bypass Cloudflare blocking Python urllib