Channels & Gateway
Drive hara from a chat app — eight platforms, with voice, files, images, and resumable per-chat sessions.
Run a gateway
hara gateway is an opt-in daemon that lets you drive your local hara from a chat app. Each
inbound message spawns a headless run on that chat's own resumable session; the reply comes back in
chat. The daemon connects out (long-poll or WebSocket), so it needs no public webhook — it runs
fine on your laptop behind NAT.
hara gateway --platform <name>Platforms at a glance
| Platform | Transport | Images | Notes |
|---|---|---|---|
| Telegram | long-poll | ✅ two-way | token from @BotFather |
| WeChat (微信) | iLink long-poll | ✅ two-way | QR login |
| Discord | WebSocket | ✅ two-way | needs Message Content Intent |
| Feishu / Lark | WS long-connection | ✅ two-way | p2p DMs (v1) |
| Slack | Socket Mode | ✅ two-way | App + Bot tokens |
| Mattermost | WebSocket + REST | ✅ two-way | self-host or cloud |
| Matrix | /sync long-poll | ✅ two-way | unencrypted rooms (v1) |
| DingTalk (钉钉) | Stream Mode | text only | reply window is per-message |
Common setup
HARA_GATEWAY_ALLOWED— comma-separated user ids allowed to drive the bot. Empty = nobody (safe default; the gateway is never wide-open).--cwd <dir>— point it at a real project. The default is a safe scratch workspace (~/.hara/workspace), so afull-autobot never lands on a real repo by accident.- Each
(chat × directory)is a stable, resumable session.
Credentials per platform
| Platform | Env |
|---|---|
| Telegram | HARA_TELEGRAM_TOKEN |
| WeChat | hara gateway --platform weixin --login (QR; the scanner is auto-allowed) |
| Discord | HARA_DISCORD_TOKEN |
| Feishu / Lark | HARA_FEISHU_APP_ID · HARA_FEISHU_APP_SECRET (+ HARA_FEISHU_DOMAIN=lark) |
| Slack | HARA_SLACK_APP_TOKEN (xapp-…) · HARA_SLACK_BOT_TOKEN (xoxb-…) |
| Mattermost | HARA_MATTERMOST_URL · HARA_MATTERMOST_TOKEN |
| Matrix | HARA_MATRIX_HOMESERVER · HARA_MATRIX_TOKEN · HARA_MATRIX_USER_ID |
| DingTalk | HARA_DINGTALK_CLIENT_ID · HARA_DINGTALK_CLIENT_SECRET |
# Telegram
HARA_TELEGRAM_TOKEN=… HARA_GATEWAY_ALLOWED=<your id> hara gateway --platform telegram
# Slack (Socket Mode — connects out, no Request URL)
HARA_SLACK_APP_TOKEN=xapp-… HARA_SLACK_BOT_TOKEN=xoxb-… HARA_GATEWAY_ALLOWED=U0123 \
hara gateway --platform slackIn-chat commands
| Command | Does |
|---|---|
| /pwd · /cd <dir> | show / switch the project the chat operates in |
| /sessions · /new · /resume <id> | list / fork / jump between threads in the current dir |
| /voice · /say <text> | toggle spoken replies · speak one message |
| /send <path> | send a file (image inline, anything else as an attachment) |
Anything else is a task — hara runs it on that chat's session and replies.
Voice & media
- Voice in — a voice note is transcribed and handed to hara as text, tagged so it knows it came from voice.
- Voice out — replies can be spoken via pluggable TTS (below).
- Images & files — send a photo and hara sees it (inline for a vision model, else described via
your
visionModel); ask it to send a file back and it uses thesend_filetool. Both work in plain conversation on every platform marked two-way above.
Text-to-speech
| Env var | For |
|---|---|
| HARA_TTS_PROVIDER | say (macOS, default) · openai · cmd |
| HARA_TTS_VOICE | voice name (e.g. Tingting for Mandarin on macOS) |
| HARA_TTS_MODEL · HARA_TTS_BASE_URL · HARA_TTS_API_KEY | an OpenAI-compatible /audio/speech endpoint |
| HARA_TTS_CMD | local command — text on stdin, {out} → output path |
Keep it running
hara gateway runs in the foreground; supervise it with launchd / systemd / pm2, or:
nohup hara gateway --platform <name> > ~/.hara/<name>-gw.log 2>&1 &