WHOOP Health Skill
Integrates with the WHOOP Developer API v2 to retrieve and analyze health/fitness data from a WHOOP band.
Setup
1. Create a Developer App
- 1. Go to developer.whoop.com and sign in with your WHOOP account
- Create a new application; set Redirect URI to INLINECODE0
- Save Client ID and Client Secret
2. Authenticate
Run the OAuth helper script to get an access token:
CODEBLOCK0
This opens a browser for authorization and saves tokens to ~/.whoop_tokens.json.
3. Fetch Data
CODEBLOCK1
Available Data Types
| Type | Key Metrics |
|---|
| INLINECODE2 | Recovery score (0–100%), HRV (ms), resting heart rate |
| INLINECODE3 |
Sleep performance %, duration, REM/SWS/light/awake stages |
|
workout | Activity Strain (0–21), avg/max heart rate, calories, sport type |
|
cycle | Day Strain (0–21), avg heart rate, kilojoules |
|
profile | Name, email |
|
body_measurement | Height, weight, max heart rate |
Analysis Workflows
Trend Analysis
CODEBLOCK2
Then ask: "Analyze my HRV trend and sleep performance over the last 30 days. Identify patterns."
Recovery vs. Strain Correlation
Fetch recovery + cycle for 30+ days, then ask for correlation analysis between day Strain and next-day Recovery score.
Sleep Stage Breakdown
Fetch sleep data, request a breakdown of avg time in each stage (REM, SWS, Light, Awake) and flag nights below recommended thresholds.
Token Management
Tokens are stored at ~/.whoop_tokens.json. The fetch script auto-refreshes using the refresh token when the access token expires (24h lifetime).
To revoke access: INLINECODE12
API Reference
See references/api_endpoints.md for full endpoint list, parameters, and response schemas.
Environment Variables (alternative to flags)
CODEBLOCK3
WHOOP 健康技能
与 WHOOP 开发者 API v2 集成,用于检索和分析来自 WHOOP 手环的健康/健身数据。
设置
1. 创建开发者应用
- 1. 访问 developer.whoop.com 并使用您的 WHOOP 账户登录
- 创建一个新应用;将重定向 URI 设置为 http://localhost:8080/callback
- 保存 客户端 ID 和 客户端密钥
2. 身份验证
运行 OAuth 辅助脚本以获取访问令牌:
bash
python3 scripts/whoop_auth.py --client-id 您的客户端ID --client-secret 您的客户端密钥
此操作将打开浏览器进行授权,并将令牌保存到 ~/.whoop_tokens.json。
3. 获取数据
bash
获取所有数据类型(最近7天)
python3 scripts/whoop_fetch.py --days 7
获取特定数据类型
python3 scripts/whoop_fetch.py --days 30 --types recovery,sleep,workout,cycle
输出为 JSON 格式
python3 scripts/whoop
fetch.py --days 7 --format json --output whoopdata.json
输出为 CSV 格式(每种数据类型一个文件)
python3 scripts/whoop
fetch.py --days 7 --format csv --output ./whoopexport/
可用数据类型
| 类型 | 关键指标 |
|---|
| recovery | 恢复评分(0–100%)、HRV(毫秒)、静息心率 |
| sleep |
睡眠表现百分比、持续时间、REM/深睡/浅睡/清醒阶段 |
| workout | 活动负荷(0–21)、平均/最大心率、卡路里、运动类型 |
| cycle | 日负荷(0–21)、平均心率、千焦耳 |
| profile | 姓名、邮箱 |
| body_measurement | 身高、体重、最大心率 |
分析工作流
趋势分析
bash
python3 scripts/whoop_fetch.py --days 30 --types recovery,sleep --format json --output data.json
然后询问:分析我过去30天的HRV趋势和睡眠表现。识别模式。
恢复与负荷相关性
获取 recovery + cycle 数据(30天以上),然后请求分析日负荷与次日恢复评分之间的相关性。
睡眠阶段分解
获取 sleep 数据,请求分解每个阶段的平均时间(REM、深睡、浅睡、清醒),并标记低于推荐阈值的夜晚。
令牌管理
令牌存储在 ~/.whoop_tokens.json。当访问令牌过期时(24小时有效期),获取脚本会自动使用刷新令牌进行刷新。
要撤销访问权限:python3 scripts/whoop_auth.py --revoke
API 参考
请参阅 references/api_endpoints.md 获取完整的端点列表、参数和响应模式。
环境变量(替代命令行参数)
bash
export WHOOPCLIENTID=您的客户端ID
export WHOOPCLIENTSECRET=您的客户端密钥