Apple Health Setup
Connect your iPhone via iOS Shortcuts to stream data automatically.
iOS Shortcut steps
- Open the Shortcuts app on your iPhone and tap '+' → 'Add Action'.
- Add 'Find Health Samples' actions for Body Mass, Active Energy, Resting Heart Rate, and Heart Rate Variability (last 24h, sorted newest first).
- Add 'Find Workouts' for last 24h.
- Add 'Find Sleep Analysis' for last 24h.
- Use 'Get Dictionary from Input' to assemble the JSON shape on the right.
- Add 'Get Contents of URL' → method POST → URL = the webhook below.
- Set the Authorization header to: Bearer <YOUR_TOKEN>
- Save as 'Push Apple Health'. Then add a Personal Automation that runs this shortcut at 22:00 daily ('Run Without Asking').
Sample JSON payload
{
"samples": [
{
"type": "body_mass",
"value": 78.4,
"unit": "kg",
"recorded_at": "2026-05-11T07:15:00Z",
"uuid": "<healthkit-sample-uuid>",
"source_app": "Renpho"
}
],
"workouts": [
{
"type": "running",
"started_at": "2026-05-11T17:00:00Z",
"ended_at": "2026-05-11T17:30:00Z",
"duration_seconds": 1800,
"active_kcal": 280,
"avg_heart_rate": 138,
"uuid": "<healthkit-workout-uuid>"
}
],
"sleep": [
{
"started_at": "2026-05-10T23:30:00Z",
"ended_at": "2026-05-11T07:00:00Z",
"rem_minutes": 95,
"deep_minutes": 70,
"core_minutes": 290,
"awake_minutes": 15,
"in_bed_minutes": 470,
"sleep_score": 82,
"uuid": "<healthkit-sleep-uuid>"
}
],
"device": "iphone",
"sent_at": "2026-05-11T22:00:00Z"
}Unknown fields are silently ignored (Postel's law) — the iOS Shortcut can add new sample types without breaking ingestion. Each sample needs a stable uuidfor idempotency. Future-dated samples (clock skew > 5 min) are rejected.
Webhook configuration
POST https://<your-tunnel>.ts.net/health/integrations/apple-health/webhook?site_origin=defaultAuthorization: Bearer <YOUR_TOKEN>
Content-Type: application/jsonBearer token Generated once via INSERT INTO integrations with platform=apple_health + config.encrypted_bearer_token. Token is Fernet-encrypted at rest (gotcha #226).
Tailscale Funnel Free, auto-TLS public URL pointing at 127.0.0.1:8308. Run tailscale funnel 8308 once after enabling MagicDNS + Funnel in the Tailscale admin console.
Privacy Apple has no HealthKit cloud API — data must originate from your iPhone. Your iPhone is the only source; the webhook only receives what your Shortcut explicitly sends.
After the first successful POST, refresh /health/metrics to confirm rows are flowing. The daily 06:00 cron will pick up the latest weight + HR the next morning and generate your cheatsheet.