fix(feishu): parse interactive card post-format fallback content#1919
Open
BingqingLyu wants to merge 3 commits intomainfrom
Open
fix(feishu): parse interactive card post-format fallback content#1919BingqingLyu wants to merge 3 commits intomainfrom
BingqingLyu wants to merge 3 commits intomainfrom
Conversation
When reading card messages via GET /im/v1/messages/{message_id}, Feishu
returns body.content in a post-style fallback format (nested arrays with
tag:'text' elements) instead of the original card template JSON. The
existing parseInteractiveCardContent() only handled card template format
(div/markdown tags), causing all fallback content to return
'[Interactive Card]'.
Changes:
- Handle nested arrays in elements (post-format fallback)
- Extract tag:'text' and tag:'a' elements from fallback content
- Extract card title from header.title.content or top-level title
- Support tag:'plain_text' elements
- Return title even when elements array is missing
Fixes openclaw#60380
Related: openclaw#41609 openclaw#48281
Address review feedback from Greptile bot — trailing whitespace in
tag:'text' elements would cause join('\n') to produce interior
trailing spaces that the final .trim() cannot remove. Trim each
segment on push for cleaner extracted content.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
parseInteractiveCardContent()to handle Feishu API post-format fallback content for interactive card messages.Fixes openclaw#60380
Related: openclaw#41609 openclaw#48281
Problem
When reading card messages via
GET /im/v1/messages/{message_id}, Feishu returnsbody.contentin a post-style fallback format — nested arrays withtag:"text"elements — instead of the original card template JSON. The existing parser only handled card template format (div/markdowntags), causing all fallback content to silently return"[Interactive Card]".Before: Any
message(action=read)on a card →"[Interactive Card]"After: Extracts title + text content from both card template and post-format fallback
Example
API returns this for a card message:
{ "title": "🤖 clawdbot", "elements": [[ {"tag": "img", "image_key": "img_v3_02ad_..."}, {"tag": "text", "text": "Daily report summary"}, {"tag": "text", "text": "13 people missing reports"} ]] }"[Interactive Card]""🤖 clawdbot\nDaily report summary\n13 people missing reports"Changes
extensions/feishu/src/send.tselements(post-format fallback[[...]])tag:"text"andtag:"a"elements from fallback contentheader.title.content(template) or top-leveltitle(fallback)tag:"plain_text"elementsextensions/feishu/src/send.test.tsheader.title.contenttag:"a"elements with hrefTesting