feat(msteams): implement sendPayload for interactive approval cards#2480
Open
BingqingLyu wants to merge 4 commits into
Open
feat(msteams): implement sendPayload for interactive approval cards#2480BingqingLyu wants to merge 4 commits into
BingqingLyu wants to merge 4 commits into
Conversation
Add sendPayload to the MS Teams outbound adapter so approval prompts render as Adaptive Cards with clickable buttons instead of plain text. Implementation: - Map interactive button blocks to Adaptive Card Action.Submit buttons using messageBack (hidden value + friendly displayText), matching the existing poll card pattern - Honor pre-built channelData.msteams.card if supplied - Send media first via sendPayloadMediaSequenceAndFinalize, then finalize with the Adaptive Card - Fall back to sendText when no interactive buttons are present - Resolve text via resolveInteractiveTextFallback for text-only blocks - Wire sendPayload in channel.ts alongside createRuntimeOutboundDelegates Closes openclaw#64690 Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Owner
Author
|
| Function | File | Also modified by |
|---|---|---|
describeMSTeamsMessageTool |
extensions/msteams/src/channel.ts |
#2465 |
Recommendation: Coordinate with #2465 before merging.
Auto-detected by codegraph — a code graph analysis tool built on neug.
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
Implements
sendPayloadfor the MS Teams channel extension so approval prompts render as Adaptive Cards with clickable buttons instead of plain text with raw/approvecommands.Closes openclaw#64690
Problem
The Teams outbound adapter only implemented
sendText,sendMedia, andsendPoll. The delivery pipeline checkshandler.sendPayload && hasReplyPayloadContent(...)before dispatching interactive payloads — since Teams had nosendPayload, all approval prompts fell through tosendText, rendering as:Solution
Added
sendPayloadto the Teams outbound adapter following the patterns established by Slack, Discord, and Telegram:extensions/msteams/src/outbound.ts:buildApprovalAdaptiveCard()helper that maps interactive button blocks to Adaptive CardAction.SubmitbuttonsmessageBack(notimBack) to avoid echoing raw approval tokens — matches the existing poll card pattern inpolls.tschannelData.msteams.cardif suppliedresolveInteractiveTextFallback()to derive card body text from text blockssendPayloadMediaSequenceAndFinalize, then finalizes with the cardsendTextMediaPayloadwhen no interactive buttons are presentextensions/msteams/src/channel.ts:sendPayloaddirectly on the outbound config (sincecreateRuntimeOutboundDelegatesonly supports sendText/sendMedia/sendPoll), following the Slack channel patternResult: Approval prompts render as Adaptive Cards with "Approve" / "Deny" buttons. Clicking a button sends the
/approvecommand via messageBack.Testing
outbound.test.ts:pnpm test:extension msteamsAI Disclosure
pnpm test:extension msteamspasses (860/860 tests)