Build an Automated Water‑Drinking Reminder Bot with OpenClaw in Minutes
This guide shows how to create a smart water‑drinking tracker that sends hourly reminders via a WeChat bot, stores daily intake, generates reports, and can be customized or deployed to GitHub, using OpenClaw’s cron and scripting features.
Background
The author needed a free alternative to a paid water‑reminder app and decided to build a custom solution using an OpenClaw server, which provides a programmable 24‑hour‑online WeChat bot.
Prerequisites
OpenClaw installed on a server
WeChat channel (openclaw‑weixin) configured
At least 4 GB free disk space
Quick Start
The repository for the tool is https://github.com/Jackson0714/openclaw-water-reminder. The core script is water_reminder.py.
Step 1 – Upload the Script
Copy water_reminder.py to the OpenClaw workspace:
# Connect to your server and create the scripts directory
mkdir -p ~/.openclaw/workspace/scripts
# Upload the script to that directory (e.g., using scp)Step 2 – Initialise the Data File
Run the script once to create water_tracker.json:
python3 ~/.openclaw/workspace/scripts/water_reminder.py resetExpected output: 已重置 ("Reset").
Step 3 – Create the Hourly Cron Job
Find your WeChat account ID with: openclaw channels list Then add a cron task (replace YOUR_ACCOUNT_ID with the actual ID):
openclaw cron add \
--name "water-reminder" \
--description "Every hour reminder from 8:30 to 16:30" \
--cron "30 8-16 * * *" \
--tz "Asia/Shanghai" \
--session isolated \
--tools exec,read \
--message 'You are a water‑reminder assistant. Read /root/.openclaw/workspace/water_tracker.json to check today\'s progress.
If the goal (>=2000ml) is reached or a reminder has already been sent today, reply "SKIP".
Otherwise, send a WeChat message with the current amount and the remaining volume. After sending, execute:
python3 -c "import json, sys; d=json.load(open(\'/root/.openclaw/workspace/water_tracker.json\')); d[\'reminded_today\']=True; json.dump(d, open(\'/root/.openclaw/workspace/water_tracker.json\',\'w\'), ensure_ascii=False, indent=2)"' \
2>&1Step 4 – Verify the Setup
# Manually trigger the reminder
openclaw cron run $(openclaw cron list --json | grep -o '"id":"[^"]*"' | head -1 | cut -d '"' -f4)
# Check current water intake
python3 ~/.openclaw/workspace/scripts/water_reminder.py status
# Generate a full daily report
python3 ~/.openclaw/workspace/scripts/water_reminder.py reportUsage
Interact with the bot in WeChat (or any configured channel) by sending the following messages: 喝了300ml → Bot replies "✅ Recorded! Today: 300ml, 1700ml left" 喝了500ml → Bot replies "✅ Recorded! Today: 800ml, 1200ml left" 今天喝了多少 → Bot replies "📊 Today: 800ml / 2000ml, 1200ml remaining" 喝水报表 → Bot replies with a detailed daily report including a progress bar.
Customization
Change Daily Goal
Edit water_tracker.json and modify the goal_ml field, e.g.:
{
"goal_ml": 2500
}Adjust Reminder Time Window
Edit the cron job:
# Example: 9:00‑20:00 every 30 minutes
openclaw cron edit YOUR_JOB_ID --cron "0,30 9-20 * * *"Change Reminder Frequency
# Hourly (default)
--cron "30 8-16 * * *"
# Every 30 minutes
--cron "0,30 8-16 * * *"
# Every 2 hours
--cron "30 8-16/2 * * *"Delete the Reminder Task
# List task IDs
openclaw cron list
# Remove a task
openclaw cron rm YOUR_JOB_IDFile Overview
water_reminder.py– Core tracking script ~/.openclaw/workspace/water_tracker.json – Auto‑created data store
Data File Format
{
"date": "2026-04-18",
"total_ml": 142,
"goal_ml": 2000,
"reminded_today": false,
"log": [
{"time": "07:46:42", "ml": 82},
{"time": "07:55:20", "ml": 60}
]
}Command‑Line Reference
# Check status
python3 water_reminder.py status
# Add water amount (debug)
python3 water_reminder.py add 300
# Generate report
python3 water_reminder.py report
# Reset today’s data
python3 water_reminder.py reset
# List cron jobs
openclaw cron list
# Manually trigger a reminder
openclaw cron run YOUR_JOB_ID
# View cron run history
openclaw cron runs --id YOUR_JOB_IDFAQ
Q: No reminder received? Verify the cron job is enabled with openclaw cron list and ensure enabled: true.
Q: Should reminders run on weekends? The default schedule includes weekends. To limit to weekdays, change the cron expression to --cron "30 8-16 * * 1-5".
Q: Can I change the daily water goal? Yes, edit the goal_ml field in water_tracker.json.
Project Structure
water-reminder/
├── README.md # This document
└── water_reminder.py # Core scriptSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Wukong Talks Architecture
Explaining distributed systems and architecture through stories. Author of the "JVM Performance Tuning in Practice" column, open-source author of "Spring Cloud in Practice PassJava", and independently developed a PMP practice quiz mini-program.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
