From 4f40790d11521833f7c207bfac2983f241fa92f7 Mon Sep 17 00:00:00 2001 From: "wangjingjing.6508" Date: Thu, 2 Apr 2026 18:06:37 +0800 Subject: [PATCH] docs(im): recommend user identity for message fetch, add bot-not-in-group fallback guidance Change-Id: Ibf1b0afa8f3bfe73cc58715e479ae156dcc7c5f7 --- skills/lark-im/SKILL.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/skills/lark-im/SKILL.md b/skills/lark-im/SKILL.md index 72596c48..42c5d6e6 100644 --- a/skills/lark-im/SKILL.md +++ b/skills/lark-im/SKILL.md @@ -46,6 +46,18 @@ When using bot identity (`--as bot`) to fetch messages (e.g. `+chat-messages-lis **Solution**: Check the app's visibility settings in the Lark Developer Console — ensure the app's visible range covers the users whose names need to be resolved. Alternatively, use `--as user` to fetch messages with user identity, which typically has broader contact access. +### Fetching Messages: Prefer User Identity + +When reading/listing messages (`+chat-messages-list`, `+threads-messages-list`, `+messages-mget`), **prefer `--as user`** over bot identity. Bot identity requires the bot to be a member of the target chat; if it is not, the API will return a "not in group" or permission error. + +Note: `+messages-search` is **user-only** and does not support `--as bot`. + +**Recommended strategy (reason-based, no circular retries):** + +1. **Start with `--as user`** — broader chat access, correct sender name resolution. +2. **If `--as user` fails due to missing scope** → try `--as bot` instead. Do not retry user until the scope is granted. +3. **If `--as bot` fails due to "bot not in group"** → retry with `--as user` **only if** user scope is confirmed available; otherwise surface an actionable error: _"Bot is not in the chat and user scope is missing — grant `im:message:readonly` or add the bot to the chat."_ + ### Card Messages (Interactive) Card messages (`interactive` type) are not yet supported for compact conversion in event subscriptions. The raw event data will be returned instead, with a hint printed to stderr.