Teams adapter: support native feedback buttons + textual feedback on outgoing messages
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 40/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend
Research direction
Start with the aiGenerated handling added in #1028 and follow it through postMessage, postChannelMessage, editMessage, postEphemeral and stream in packages/adapter-teams/src/index.ts, then look at registerEventHandlers for the event subscriptions. Add a feedbackButtons option that calls addFeedback() on those send paths, and register the message.submit.feedback route to dispatch message_feedback through chat.processAction. Done means a flagged message shows thumbs buttons in Teams and a click reaches bot.onAction, which needs confirming against Teams SDK behaviour.
Written by the indexing model from the issue text.
Description
Problem Statement
Microsoft Teams shows thumbs up and thumbs down buttons on a bot message when the activity's channelData includes feedbackLoop: { type: "default" }. The Teams SDK sets this with addFeedback() on MessageActivity and MessageActivityInput. After a click, Teams asks the user for an optional comment, then sends the bot an invoke activity named message/submitAction, with value.actionValue.reaction set to "like" or "dislike" and the comment in value.actionValue.feedback as a JSON string ({"feedbackText":"..."}).
The Teams adapter supports neither half. Outgoing activities are built in postMessage, postChannelMessage, editMessage, postEphemeral, and stream in packages/adapter-teams/src/index.ts, and no postable field reaches channelData. For incoming activities, registerEventHandlers subscribes to message, messageUpdate, messageReaction, card.action, dialog.open, dialog.submit, conversationUpdate, and installationUpdate, so a feedback click never reaches chat.
The Slack adapter already has native feedback buttons through its feedbackButtons option, with clicks dispatched through bot.onAction("message_feedback"). Teams bots have no equivalent, so we can't collect ratings on model-written replies in Teams the way we do in Slack.
Proposed Solution
Follow the aiGenerated field added in #1028. Add an optional feedbackButtons field to PostableRaw, PostableMarkdown, PostableAst, PostableCard, StreamingPlanOptions, and StreamOptions, documented as shown by adapters that support feedback buttons per message (currently Teams):
export interface PostableMarkdown {
/** Mark the message as AI-generated. Adapters with a native AI label (currently Teams) show it; others ignore it. */
aiGenerated?: boolean;
/** File/image attachments */
attachments?: Attachment[];
/** Show native thumbs up/down feedback buttons. Adapters that support them per message (currently Teams) show them; others ignore it. */
feedbackButtons?: boolean;
/** Files to upload */
files?: FileUpload[];
/** Markdown text, converted to platform format */
markdown: string;
}
When feedbackButtons is true, the Teams adapter calls addFeedback() on every send path that already applies the AI label, including raw Adaptive Cards, the buffered stream, and each chunk emitted to the native streamer. The streamer merges every chunk's channelData into the final message, so the buttons appear once the stream finishes. As with aiGenerated, an edit replaces the whole activity, so it has to set the flag again.
For clicks, register the Teams SDK's message.submit.feedback route and dispatch through chat.processAction with the same defaults as the Slack adapter: the action ID "message_feedback" and the value "positive" or "negative". Put the comment in ActionEvent.values.feedback when the user typed one, and the rated message's ID in messageId (from replyToId). Returning nothing from the route makes the SDK answer the invoke with the empty 200 that Teams expects. Because the route is registered on the SDK App, Bot Framework token verification still runs before the handler.
Sharing Slack's action ID and values means one handler serves both platforms.
Alternatives Considered
No response
Use Case
// A model-written answer with feedback buttons
await thread.post({ markdown: answer, aiGenerated: true, feedbackButtons: true });
// A streamed answer
await thread.post(
new StreamingPlan(result.fullStream, { aiGenerated: true, feedbackButtons: true })
);
// One handler for Teams and Slack feedback
bot.onAction("message_feedback", async (event) => {
await recordFeedback(event.messageId, event.value, event.values?.feedback);
});
// Static messages such as help or errors get no buttons
await thread.post("Sorry, something went wrong. Please try again.");
Priority
Nice to have
Contribution
- I am willing to help implement this feature
Additional Context
No response
- Dominant language
- TypeScript
- Stars
- 2.5k
- Forks
- 355
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 42
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vercel/chat
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
X and Twitch: paragraphs inside a block quote are joined with no spacePossibly taken @abhiramshaji-cyber claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 87/100
Maintainers usually reply within 1 day
-
🛠️ dette technique
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
betagouv/mon-entreprise#4752 · 1 comment ·
Maintainers usually reply within 5 days
-
type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
franciscoBSalgueiro/en-croissant#1111 ·
Maintainers usually reply within 2 days
-
area/providers type/feature version/v2
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
anomalyco/opencode#64845 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day