Skip to content

feat(feishu): support interactive card action (button) callbacks - #7

Open
Strivin0311 wants to merge 1 commit into
mainfrom
feat/feishu-card-action-callback
Open

feat(feishu): support interactive card action (button) callbacks#7
Strivin0311 wants to merge 1 commit into
mainfrom
feat/feishu-card-action-callback

Conversation

@Strivin0311

Copy link
Copy Markdown

What

Add support for Feishu interactive card action (button) callbacks over the long-connection (WSClient) mode.

Previously the Feishu EventDispatcher only registered im.message.receive_v1, so clicking a card button produced no effect (the platform reported error 200672 — no responder). This PR registers a card.action.trigger handler so button clicks route back to the agent.

How

  • New helper mapFeishuCardActionToMessage converts a card action payload into a synthetic text FeishuMessageItem, reusing the existing processFeishuMessage pipeline.
  • Supported button value shapes:
    • { text: "up514" } → uses the text directly
    • { action: "up", pr: 514 } → assembled into "up514"
    • any other object → JSON-stringified fallback
  • Sender/chat are derived from open_id / open_chat_id (with context.* fallback); the handler returns {} to acknowledge without updating the card.
  • Duplicate suppression via the existing markFeishuEventSeen mechanism.

Why

Enables button-driven workflows (e.g. one-click PR description updates) without requiring a public callback URL — it works purely through the already-configured long-connection callback subscription.

Testing

  • tsc --noEmit -p tsconfig.node.json passes cleanly.
  • feishuWsHeartbeat unit tests pass.
  • Note: feishuTransport / feishuWebhookTransport suites fail locally due to a pre-existing Electron binary install issue in the dev env (fail identically on clean main), unrelated to this change.

Register a card.action.trigger handler on the Feishu WSClient EventDispatcher
so that clicking an interactive card button routes back to the agent.

The button's action value is mapped into a synthetic text message and fed
through the existing processFeishuMessage pipeline, supporting shapes:
- { text: "up514" }
- { action: "up", pr: 514 }  -> "up514"

This enables button-driven workflows (e.g. PR desc updates) over the
long-connection mode without needing a public callback URL.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

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.

1 participant