M365 Agent icon

M365 Agent

Send messages, cards, thread replies, and invoke responses through Microsoft 365 Agents (Teams / Copilot / WebChat).

Actions28

Card State Machine → Select

AI-generated

Summary

Selects an Adaptive Card variant matching the given state key and constructs an activity message.

Inputs

  • stateKey (required) — The state key used to pick a variant. Matched against variants[].key.
  • variants (required) — Collection of card variants; each variant defines a key, Adaptive Card JSON, and optional binding data bound via adaptivecards-templating.
  • authKind — Authentication method: classicBot (Azure Bot Service + Entra App Registration) or agent365 (Entra Agent Identity). Default: classicBot.
  • conversationSource — Where conversation routing info comes from: From Envelope (current item, auto for replies/updates/deletes) or Specify Manually (fill fields for proactive sends). Default: envelope.
  • serviceUrl — Bot Connector service URL for the target channel. Required when conversationSource is Specify Manually.
  • conversationId — Conversation ID. Required when conversationSource is Specify Manually. For Teams channels formatted as 19:xxx@thread.tacv2.
  • channelId — Azure Bot Service channel the conversation belongs to. Default: msteams.
  • activityId — Required only for Reply / Update / Delete operations against a specific activity. Leave empty for proactive sends.
  • options — Optional collection: fallbackText shown by clients that cannot render Adaptive Cards, and rawActivityOverride to replace the constructed Activity body with raw JSON.
  • identityMode — Authentication mode. autonomous (agent acts as Blueprint app identity) or agentUser (agent acts as its own M365 user, requires sidecar transport and separate license). Default: autonomous.
  • userSelectorMode — Mode to select the agentic user: byUpn (UPN) or byObjectId (Object ID). Required when identityMode is agentUser.
  • agentUsername — UPN of the agentic user. Defaults to credential's Default Agent Username.
  • agentUserId — Object ID of the agentic user.

Output shape

Constructs an Adaptive Card activity using the variant whose key matches stateKey; applies binding data if provided, and outputs the activity. If rawActivityOverride is supplied, it replaces the constructed activity body.

Conversation routing (serviceUrl, conversationId, channelId) is handled automatically when conversationSource is From Envelope; manual mode requires explicit values.

Examples

Example 1: Select a card variant for a proactive message

Set authKind to classicBot or agent365, conversationSource to From Envelope (or manually provide serviceUrl and conversationId), stateKey to the desired variant key, and variants array with matching keys and card JSON.

Links

Discussion