← 返回
数据分析 Key

WHOOP (Official API)

Connect to the WHOOP Developer Platform via official OAuth (authorization code flow), store and refresh tokens, and fetch WHOOP v2 data (recovery, sleep, cyc...
通过官方OAuth(授权码模式)连接WHOOP开发者平台,存储并刷新令牌,获取v2数据(恢复、睡眠、运动周期等)。
gavinchengcool
数据分析 clawhub v0.1.2 1 版本 100000 Key: 需要
★ 0
Stars
📥 582
下载
💾 6
安装
1
版本
#latest

概述

WHOOP (Official API)

Use this skill to connect WHOOP → fetch metrics → produce a message.

Scope: WHOOP is the data source only. Keep delivery channel-agnostic: generate text/markdown and either reply in the current chat or send via OpenClaw’s message tool.

Quick start (minimal)

1) Set env vars:

  • WHOOP_CLIENT_ID
  • WHOOP_CLIENT_SECRET
  • WHOOP_REDIRECT_URI

2) Connect once (choose one):

Phone/remote mode (recommended): run, then copy/paste the redirect URL or code back into chat.

python3 scripts/whoop_oauth_login.py

Desktop fast path (optional): if you are authorizing in a browser on the same machine that runs OpenClaw, set WHOOP_REDIRECT_URI to a loopback URL (e.g. http://127.0.0.1:58539/callback) and run:

python3 scripts/whoop_oauth_login.py --loopback

3) Fetch + render today:

python3 scripts/whoop_fetch.py --date today --out /tmp/whoop_raw_today.json
python3 scripts/whoop_normalize.py /tmp/whoop_raw_today.json --out /tmp/whoop_today.json
python3 scripts/whoop_render.py /tmp/whoop_today.json --format markdown --channel generic

Configuration (required)

Provide these via environment variables (preferred) or direct CLI args to scripts:

  • WHOOP_CLIENT_ID
  • WHOOP_CLIENT_SECRET
  • WHOOP_REDIRECT_URI (must exactly match the value in the WHOOP developer dashboard)

Optional:

  • WHOOP_TOKEN_PATH (default: ~/.config/openclaw/whoop/token.json)
  • WHOOP_TZ (default: Asia/Shanghai)

Workflow 1 — Connect WHOOP (OAuth login)

1) Run one of these modes:

  • Phone/remote mode (recommended):
python3 scripts/whoop_oauth_login.py

Then open the printed URL on any device, approve access, and paste the redirect URL (or code) back into the prompt.

  • Desktop loopback mode (optional):
python3 scripts/whoop_oauth_login.py --loopback

Use this only if your browser authorization happens on the same machine that runs OpenClaw, and WHOOP_REDIRECT_URI is a loopback URL like http://127.0.0.1:/callback.

2) The script stores tokens at WHOOP_TOKEN_PATH.

If you need to revoke later, use delete /v2/user/access (see references/whoop_api.md).

Workflow 2 — Fetch metrics (today / yesterday)

Fetch raw WHOOP API objects:

python3 scripts/whoop_fetch.py --date today --out /tmp/whoop_raw_today.json
python3 scripts/whoop_fetch.py --date yesterday --out /tmp/whoop_raw_yday.json

Tip: `whoop_fetch.py` uses WHOOP’s `start`/`end` query params + `nextToken` pagination. Use `--tz` to control which local day is fetched (default from `WHOOP_TZ`).

Normalize into a stable schema:

python3 scripts/whoop_normalize.py /tmp/whoop_raw_today.json --out /tmp/whoop_today.json

Render a message for humans:

python3 scripts/whoop_render.py /tmp/whoop_today.json --format markdown --channel generic

Channel formatting presets:
- `--channel discord` (uses **bold**)
- `--channel slack` / `--channel whatsapp` (uses *bold*, avoids fancy markup)
- `--channel telegram` (plain text)

Then either:

  • reply with the rendered text in the current chat, or
  • send it to another channel via OpenClaw message(action=send, ...).

Workflow 3 — Daily/weekly push (cron)

If the user wants scheduled push messages, create an OpenClaw cron job that runs an isolated agent turn which:

  • calls scripts/whoop_fetch.py + scripts/whoop_normalize.py + scripts/whoop_render.py
  • sends the rendered message to the desired destination

Keep the cron job channel-agnostic: the destination should be a parameter in the cron payload text.

Notes on API details

  • For scopes, endpoints, and pagination/rate-limits, read: references/whoop_api.md.
  • For the normalized JSON schema contract, read: references/output_schemas.md.
  • If OAuth fails (redirect mismatch, invalid_scope, 401/429), read: references/troubleshooting.md.

版本历史

共 1 个版本

  • v0.1.2 当前
    2026-03-19 13:39 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

productivity

Wellness Hub

gavinchengcool
OpenClaw个人健康中心。当用户希望一站式连接健康应用与设备(可穿戴设备、运动、睡眠、营养等)时使用。
★ 0 📥 697
data-analysis

A股量化 AkShare

mbpz
A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
★ 164 📥 59,919
data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 368 📥 140,344