Skip to content

fix: detect receive_id_type dynamically in Feishu adapter - #10123

Closed
nightq wants to merge 1 commit into
NousResearch:mainfrom
nightq:fix/issue-9980-feishu-receive-id-type
Closed

fix: detect receive_id_type dynamically in Feishu adapter#10123
nightq wants to merge 1 commit into
NousResearch:mainfrom
nightq:fix/issue-9980-feishu-receive-id-type

Conversation

@nightq

@nightq nightq commented Apr 15, 2026

Copy link
Copy Markdown

Summary

Fixes [230001] invalid receive_id errors when sending messages to Feishu users via open_id.

Root Cause

_send_raw_message() in gateway/platforms/feishu.py hardcodes receive_id_type='chat_id' when calling the im.message.create API. Feishu requires different receive_id_type values based on ID format:

  • User open_id (prefix ou_) → open_id
  • Group chat_id (prefix oc_) → chat_id
  • Union ID (prefix on_) → union_id

Fix

Added _detect_receive_id_type() static helper that inspects the ID prefix and returns the correct type. Called dynamically in _send_raw_message() instead of hardcoding.

Test Plan

  • 5 new unit tests pass (TestDetectReceiveIdType)
  • Manual verification: cron job with deliver=feishu:ou_xxxx delivers successfully

Closes #9980

Fixes NousResearch#9980

Root cause: _send_raw_message hardcodes receive_id_type='chat_id' when calling
im.message.create API, causing [230001] invalid receive_id errors for user
open_ids (ou_*) and union_ids (on_*)
Fix: Add _detect_receive_id_type() helper that checks ID prefix (ou_→open_id,
on_→union_id, default→chat_id) and use it dynamically
@nightq

nightq commented Apr 17, 2026

Copy link
Copy Markdown
Author

Closing stale PR from previous run. Will recreate if the fix is still needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feishu: send to user open_id fails with [230001] invalid receive_id

1 participant