4 · Telegram butler
Goal: control Bajie from your phone in plain language: "put the toys away", "bring me the water bottle", "/photo", "/stop".
Step 1: Create a bot
- In Telegram, open @BotFather and send
/newbot. - Give it a name, for example "My Bajie", and a username ending in
bot. - BotFather replies with a token like
123456:ABC…. Keep it secret: anyone with it can control your bot.
Step 2: Start the butler on the robot
export TELEGRAM_ROBOT_TOKEN='123456:ABC...'
hnbot --robot bajie telegram
Step 3: Make yourself the owner
- Send
/idto your bot. It replies with your chat ID. - Stop the butler with Ctrl-C, then restart it with the owner set:
export TELEGRAM_OWNER_IDS=123456789 # comma-separate several people
hnbot --robot bajie telegram
Only owners can command the robot. Everyone else gets a polite refusal.
Step 4: Talk to it
| Send | Robot does |
|---|---|
| put the toys away · 把玩具收起来 | find toys → pick → put them on the tray |
| bring me the water bottle · 帮我拿水 | find → pick → come to you |
| go to the kitchen · come here | moves |
| go charge | returns to the dock |
| say: dinner is ready | speaks (see the note below) |
| /photo · /status | camera snapshot · battery and state |
| /stop | stops whatever it's doing, immediately |
The robot answers with progress messages and sends a photo when it's done.
Free-form requests (optional)
Set GEMINI_API_KEY to let an AI model understand sentences the built-in rules don't, like "my kid left stuff everywhere in the lounge". The model can only choose from the actions above, and its answer is validated before the robot moves.
Keep it running
To start the butler automatically when the robot boots, use a user systemd service:
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/hnbot-telegram.service <<'UNIT'
[Unit]
Description=hnbot Telegram butler
[Service]
Environment=TELEGRAM_ROBOT_TOKEN=123456:ABC...
Environment=TELEGRAM_OWNER_IDS=123456789
Environment=RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
Environment=CYCLONEDDS_URI=file:///factory/default.xml
ExecStart=/bin/bash -lc 'source /opt/ros/humble/setup.bash && source ~/bajie_ws/install/setup.bash && ~/.local/bin/hnbot --robot bajie telegram'
Restart=on-failure
[Install]
WantedBy=default.target
UNIT
systemctl --user daemon-reload
systemctl --user enable --now hnbot-telegram
loginctl enable-linger $USER # keep it running after you log out
Notes
- Speech. Bajie's public interfaces have no text-to-speech. Set
HN_TTS_CMDto any command that speaks its last argument on the robot, andsaywill use it. - "Come here". There is no person tracking in the public interfaces. Set
HN_USER_ROOM=living roomand "come here" will drive to that room. - Two bots. Use a different bot from any bot that already uses a webhook. Telegram allows either a webhook or polling per bot, not both.
✅ Done. Next: Write your own skill →