Bug Description
When sending messages to Feishu users (using open_id format, e.g. ou_245ad75b...) via cron job delivery or manual send, the API returns:
[230001] invalid receive_id
This happens because _send_raw_message in gateway/platforms/feishu.py always uses receive_id_type='chat_id' when creating messages (line 3292):
request = self._build_create_message_request("chat_id", body)
Feishu's im.message.create API requires different receive_id_type values depending on the ID format:
- User ID (prefix
ou_) → receive_id_type should be "open_id"
- Group ID (prefix
oc_) → receive_id_type should be "chat_id"
- Union ID (prefix
on_) → receive_id_type should be "union_id"
Steps to Reproduce
- Configure Feishu platform in Hermes
- Create a cron job with
deliver=feishu:<user_open_id>
- Job runs and attempts to deliver result to the user
- API returns
[230001] invalid receive_id error
Expected Behavior
Messages should be sent successfully to both user open_ids and group chat_ids.
Suggested Fix
Auto-detect receive_id type from the ID prefix in _send_raw_message:
if chat_id.startswith("oc_"):
receive_id_type = "chat_id"
elif chat_id.startswith("ou_"):
receive_id_type = "open_id"
elif chat_id.startswith("on_"):
receive_id_type = "union_id"
else:
receive_id_type = "open_id" # default for user IDs
Environment
- Hermes Agent version: latest
- Platform: Feishu (websocket mode)
Bug Description
When sending messages to Feishu users (using open_id format, e.g.
ou_245ad75b...) via cron job delivery or manual send, the API returns:This happens because
_send_raw_messageingateway/platforms/feishu.pyalways usesreceive_id_type='chat_id'when creating messages (line 3292):Feishu's
im.message.createAPI requires differentreceive_id_typevalues depending on the ID format:ou_) →receive_id_typeshould be"open_id"oc_) →receive_id_typeshould be"chat_id"on_) →receive_id_typeshould be"union_id"Steps to Reproduce
deliver=feishu:<user_open_id>[230001] invalid receive_iderrorExpected Behavior
Messages should be sent successfully to both user open_ids and group chat_ids.
Suggested Fix
Auto-detect receive_id type from the ID prefix in
_send_raw_message:Environment