Skip to content

feat(feishu): Parse interactive card content in merge_forward sub-messages #34571

@Daily-AC

Description

@Daily-AC

Problem

When receiving a merge_forward (合并转发) message containing interactive cards, the card content is displayed as [interactive] instead of being parsed.

Current behavior:

[Merged and Forwarded Messages]
- 希,你会写小说不?
- [interactive]
- 希,想让你写一个关于......我们的故事,老样子,飞书文档
- [interactive]
- [interactive]

Expected behavior:
Interactive cards should be parsed to extract readable content (title, text elements, etc.)

Root Cause

In extensions/feishu/src/bot.ts, the renderSubMessageContent() function handles various message types but falls through to the default case for interactive:

default:
  return `[${contentType}]`;  // line ~434

Proposed Solution

Add a case for interactive message type to extract:

  1. Card title (if present)
  2. Text elements from the card structure
  3. Button labels or other actionable elements

Example implementation:

case "interactive":
  try {
    const card = JSON.parse(parsed);
    const title = card.header?.title?.content || "";
    const elements = card.elements || [];
    const texts = elements
      .filter((e: any) => e.tag === "div" || e.tag === "markdown")
      .map((e: any) => e.text?.content || e.content || "")
      .filter(Boolean);
    return title ? `[Card: ${title}] ${texts.join(" ")}` : `[Card] ${texts.join(" ")}`;
  } catch {
    return "[Interactive Card]";
  }

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions