hermes-bale-messenger
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBale Platform Adapter for Hermes
适用于Hermes的Bale平台适配器
Adds Bale (بله) messenger support to Hermes Gateway as a platform plugin.
Your AI agent can send/receive messages, voice notes, images, and documents
through Bale via the Bot API.
作为平台插件为Hermes Gateway添加Bale(بله)即时通讯工具支持。你的AI agent可通过Bot API在Bale上发送/接收消息、语音笔记、图片和文档。
Quick Install
快速安装
bash
cd ~/.hermes/plugins/platforms/
git clone https://github.com/mah92/hermes-bale-messenger-plugin.git bale
hermes plugins enable hermes-bale-messengerThen add your bot token to :
~/.hermes/.envenv
BALE_BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
BALE_ALLOWED_CHATS=123456789,987654321Restart the gateway and you're done.
bash
cd ~/.hermes/plugins/platforms/
git clone https://github.com/mah92/hermes-bale-messenger-plugin.git bale
hermes plugins enable hermes-bale-messenger然后将你的机器人令牌添加至文件:
~/.hermes/.envenv
BALE_BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
BALE_ALLOWED_CHATS=123456789,987654321重启网关即可完成配置。
Files
文件说明
| File | Purpose |
|---|---|
| Platform manifest — env vars, metadata |
| Package entry — re-exports |
| Full |
| 文件 | 用途 |
|---|---|
| 平台清单——环境变量、元数据 |
| 包入口——重新导出 |
| |
Features
功能特性
- Text messages (send & receive)
- Voice messages — send via TTS, receive voice/audio as downloadable files
- Images — send by URL (with download fallback) or local file upload
- Documents — upload and send
- Typing indicators ()
sendChatAction - Group chat support with optional @mention gate
- User/chat allowlisting
- Cron delivery support
- 文本消息(发送与接收)
- 语音消息——通过TTS发送,接收的语音/音频可作为可下载文件获取
- 图片——通过URL发送(支持下载回退)或本地文件上传
- 文档——上传并发送
- 输入状态提示()
sendChatAction - 群聊支持,可选@提及限制
- 用户/聊天白名单
- 定时发送支持
Configuration
配置说明
All via :
~/.hermes/.env| Variable | Required | Default | Description |
|---|---|---|---|
| ✅ | — | Bot token from @BotFather |
| — | all | Comma-separated chat IDs |
| — | all | Comma-separated user IDs |
| — | false | Set "true" for open access |
| — | — | Default chat for cron delivery |
| — | false | Require @mention in groups |
| — | 30000 | Max voice/audio duration (milliseconds) for STT. 0 = no limit |
所有配置均通过文件设置:
~/.hermes/.env| 变量名 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|
| ✅ | — | 从@BotFather获取的机器人令牌 |
| — | 全部 | 逗号分隔的聊天ID列表 |
| — | 全部 | 逗号分隔的用户ID列表 |
| — | false | 设置为"true"则开放所有访问权限 |
| — | — | 定时发送的默认聊天渠道 |
| — | false | 群聊中要求@提及机器人 |
| — | 30000 | 用于语音转文本(STT)的最大语音/音频时长(毫秒)。0表示无限制 |
How It Works
工作原理
The adapter uses Bale's Bot API (Telegram-compatible) with long-polling.
No gRPC, no user account — just HTTP calls to .
tapi.bale.aiBale Server ←→ HTTP Long Poll ←→ Hermes Gateway ←→ AI Agent该适配器使用Bale的Bot API(兼容Telegram)和长轮询机制。无需gRPC,无需用户账户——仅需向发起HTTP请求。
tapi.bale.aiBale Server ←→ HTTP Long Poll ←→ Hermes Gateway ←→ AI AgentCommon Pitfalls
常见问题
- Bot blocked by user: User must the bot before it can DM them.
/start - Bot-to-bot blocked: Bale (like Telegram) blocks bots from seeing each other's messages, even in groups. Use a user account bridge for bot-to-bot.
- Group privacy: The bot must be an admin to see all group messages, otherwise it only sees and replies.
/command - Voice messages arrive empty? Transcription needs an STT provider. The skill in this repo provides Persian STT, or set
hermes-persian-sttinstt.provider.~/.hermes/config.yaml - TTS voice not delivered? Set on your TTS provider in config.yaml. The adapter now overrides
voice_compatible: trueto upload directly via Bale'ssend_voiceAPI (retries 3×). Without this, Hermes emitssendVoicetags which Bale cannot render.MEDIA: - Cache after edits: Always after editing adapter files.
find ~/.hermes/plugins/platforms/bale -name __pycache__ -exec rm -rf {} + - Webhook blocks polling: If you previously used webhook mode, call before switching to polling —
deleteWebhook. Otherwisecurl -s "https://tapi.bale.ai/bot$BALE_BOT_TOKEN/deleteWebhook"returns nothing.getUpdates - 401 Unauthorized: Token expired or regenerated from @BotFather. Get a new token and update in
BALE_BOT_TOKEN.~/.hermes/.env
- 机器人被用户屏蔽: 用户必须先向机器人发送指令,机器人才可向其发送私信。
/start - 机器人之间无法交互: Bale(类似Telegram)禁止机器人查看其他机器人的消息,即使在群聊中也是如此。如需机器人之间交互,请使用用户账户桥接。
- 群聊隐私设置: 机器人必须是群管理员才能查看所有群消息,否则仅能查看指令和回复消息。
/command - 语音消息为空? 语音转文本需要STT服务提供商。本仓库中的skill提供波斯语STT服务,或在
hermes-persian-stt中设置~/.hermes/config.yaml。stt.provider - TTS语音未送达? 在config.yaml中为你的TTS服务提供商设置。适配器现在会重写
voice_compatible: true方法,直接通过Bale的send_voiceAPI上传(重试3次)。如果不设置此项,Hermes会生成Bale无法识别的sendVoice标签。MEDIA: - 编辑后的缓存问题: 编辑适配器文件后,请务必执行清除缓存。
find ~/.hermes/plugins/platforms/bale -name __pycache__ -exec rm -rf {} + - Webhook阻塞轮询: 如果之前使用过Webhook模式,请在切换到轮询模式前调用——执行
deleteWebhook。否则curl -s "https://tapi.bale.ai/bot$BALE_BOT_TOKEN/deleteWebhook"将返回空结果。getUpdates - 401未授权: 令牌过期或已在@BotFather处重新生成。获取新令牌并更新中的
~/.hermes/.env。BALE_BOT_TOKEN