Teams adapter: support native feedback buttons + textual feedback on outgoing messages

Aperta
#1,163 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@domoniccassidy ci sta già lavorando.

Dal 14/11/2026.

  • #1164 di @domoniccassidy — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
40/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
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

Lingua principale
TypeScript
Stelle
2.5k
Fork
355
Merge medio
2g 15h
PR unite (30g)
42

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel/chat

Tutte le issue di vercel/chat

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.