A health report from an iPhone Shortcut#
Every evening an iPhone Shortcut reads the day's numbers from Health — steps, sleep, resting heart rate — and posts them to the workflow's address. Your assistant reads them with what it remembers of you, says in three lines how the day went with one suggestion for tomorrow, and the answer arrives on your phone and in Telegram.
This is the Health report recipe of the console.
flowchart LR
S([iPhone Shortcut<br/>Get Contents of URL]) --> T([phone<br/>HTTP call])
T --> R[read<br/>your assistant]
R --> N[tell<br/>notify]
Before you begin#
- An assistant of the workspace, on a
deployment that is up. An assistant, not a bare deployment: it reads
your memory, so it can compare today
with what it knows of you. Below,
<assistant>stands for its name. - An iPhone with the Shortcuts app, and Health holding the numbers you want to send.
- The app's notifications on that iPhone, and your Telegram connected to an assistant if you want the answer there too.
1. Make the workflow#
Iris → Workflows → Start from a recipe → Health report → Use it. Click read: under Who answers, choose your assistant. Press Create the workflow.
apiVersion: anemoi.astralyx/v1
kind: Flow
metadata:
name: health-report
spec:
description: The day's health numbers, read by my assistant, with a suggestion.
triggers:
- {id: phone, kind: http}
steps:
- id: read
kind: model
assistant: <assistant>
prompt: "Here are today's health numbers from my phone. Compare them with what you know of me, say in three short lines how the day went, and suggest one thing for tomorrow.\n\n${{ event }}"
- id: tell
kind: notify
needs: [read]
title: Today's health
message: "${{ steps.read.outputs.text }}"
${{ event }} is the whole body the Shortcut sends, as JSON text: the
model reads every number, whatever you name them. tell has no to: it
tells whoever made the address — you.
2. Make its address#
Iris → Workflows → health-report → Triggers → Make the address, and copy the URL: its last part is the secret, shown once. Anyone with it starts the workflow as you, so keep it in the Shortcut only.
Try it from a computer, with <address> standing for the URL:
$ curl -sS -X POST '<address>' -H 'Content-Type: application/json' \
-d '{"steps": 8432, "sleep_hours": 6.5, "resting_heart_rate": 58}'
{"execution":"health-report-a41c07","state":"Pending","deduplicated":false}
A few seconds later your phone shows Today's health with the assistant's three lines.
3. Build the Shortcut#
In the Shortcuts app, make a new shortcut:
- For each number, a Find Health Samples action (for example Steps, from the start of today), and a Calculate Statistics action (Sum for steps, Average for heart rate) where the samples are many.
- A Get Contents of URL action:
- URL: the address.
- Method:
POST. - Request Body:
JSON, one field per number —steps,sleep_hours,resting_heart_rate— each set to the result of its action.
- Run it once: the notice arrives.
Then, under Automation, add a Time of Day automation (21:00, daily) that runs the shortcut without asking.
What to expect#
- Each run is an execution of
health-report: Iris → Workflows → health-report → Executions lists the days, each with its event and the assistant's answer (read'stext). - The assistant reads and may add to your memory, as in a chat with it: the workflow runs as you.
- If the deployment was asleep, the first run waits for it (up to 5 minutes) before answering.
Make it yours#
- Only on Telegram, or only in the app: set
channels: [telegram](or[app]) ontell. The inbox always has it. - Not every day: a condition after
readon a number (event.sleep_hours < 6) andtellonly on that way. - Keep a log: a Function box that appends the numbers where you keep them.