# Teams approval bots for agents break before the agent logic does

> A wrong card schema, a recipient addressed by email or a mismatched tenant can stop a Teams approval card from working before the agent is ever involved.

Original: https://fdetimes.net/en/guides/teams-approval-bot-for-ai-agents/

Microsoft's "Up to date views" page, updated on 2026-09-16, still sets version 1.4 in its approval card example. Yet the Universal Actions documentation itself states that the feature is available only from Adaptive Cards schema 1.5. Copy the official example into your code as it stands and you can have a bug before you have written anything else.

For an FDE this is no small matter. When a client's agent reaches a real action, such as issuing a refund, changing a configuration or sending a contract, the client almost always wants a human to approve it. In a company that runs on Microsoft 365, that human is sitting in Teams.

The Teams guidance on agents that run as MCP servers is explicit too: a card with clear **Approve** / **Reject** buttons works better than free text.

This guide builds that bot step by step. The agent calls `request_approval`, the bot sends a card to the approver, the approver clicks a button, the bot receives the decision and `wait_for_approval` returns the result to the agent. The code snippets are trimmed sketches. Exact function names depend on the SDK you choose, so check them against the official documentation before going to production.

## Start from the official sample

Settle the SDK question first. Microsoft describes the Microsoft 365 Agents SDK as the next step after the Azure Bot Framework SDK. For a new bot, read the official migration guide before inheriting any old Bot Framework code the client already has.

**Step 1.** Get the Node.js/TypeScript version of the `bot-proactive-message` sample from the OfficeDev/Microsoft-Teams-Samples repository on GitHub. It shows how to send proactive messages to Teams users and runs locally on port 3978.

Check: the bot runs at `localhost:3978` and you receive a proactive message in your test account. Do not write a card until this works. Every later error becomes much harder to isolate.

## The approval card must be 1.5, with a way back

**Step 2.** Write the card. The Universal Actions documentation sets three requirements: replace every `Action.Submit` with `Action.Execute`, set the schema to 1.5, and add a `fallback` of type `Action.Submit` so older Teams clients still work.

```json
{
  "type": "AdaptiveCard",
  "version": "1.5",
  "body": [
    { "type": "TextBlock", "text": "Agent requests approval: <action description>" }
  ],
  "refresh": {
    "action": { "type": "Action.Execute", "verb": "refresh" },
    "userIds": ["<approver-id-1>", "<approver-id-2>"]
  },
  "actions": [
    {
      "type": "Action.Execute",
      "title": "Approve",
      "verb": "approve",
      "data": { "approvalId": "<approvalId>" },
      "fallback": {
        "type": "Action.Submit",
        "title": "Approve",
        "data": { "verb": "approve", "approvalId": "<approvalId>" }
      }
    }
  ]
}
```

The Reject button is identical apart from the `verb`. This is a trimmed sketch, so check every field against the official 1.5 schema. The `approvalId` must go in `data`: it is the key that matches the approver's decision to the agent's request.

Check: send the card and open it in both Teams desktop and Teams on the web. If the buttons do not appear or do nothing when clicked, look at `version` first.

## Decisions arrive as invoke activities

**Step 3.** When a user clicks an `Action.Execute` button, Teams sends the bot an invoke activity of type `adaptiveCard/action`. The Agents SDK walkthrough on Tech Community says this event is handled in `OnInvokeAsync`, with the data read from `Activity.Value`.

```text
// Pseudocode — real function names depend on your SDK
OnInvokeAsync(context):
  if invoke is "adaptiveCard/action":
    data = context.Activity.Value      // verb, approvalId
    record_decision(data.approvalId, data.verb, clicked_by)
    update_original_message(new_status)

OnMessage(context):
  if context.Activity.Value has verb:   // Action.Submit from an older client
    handle exactly as in the branch above
```

The second branch is not optional. The documentation requires bot code to handle both `Action.Execute` and `Action.Submit`. Without it, a user on an older client clicks Approve and nothing happens.

Check: log the whole `Activity.Value` on the first click. You need to see the actual data structure with your own eyes.

## With several approvers, the card must update itself

**Step 4.** Say a refund needs approval from two team leads, and the card goes to a group chat that includes other staff. Under the "Up to date views" model, the Approve/Reject buttons appear only for people listed in `refresh.userIds`. After each approval, the bot updates the message so the card changes for everyone.

In this example, when the first team lead clicks, the bot updates the card to "1/2 approved". The second lead still sees the buttons. Everyone else sees only the status. After the second approval, the bot updates the card one last time and returns the decision to `wait_for_approval`.

The Microsoft 365 Developer blog introduced Universal Actions with the bot as a shared backend that handles actions, so the same action works in both Teams and Outlook.

Because the approval logic lives in the bot rather than the card, the decision-handling code could stay the same if the client also wants approvals by email. Even so, check the official documentation before promising that to a client.

## Proactive sends: email will not work

**Step 5.** A client's agent usually knows only an employee's email address. This is where many people stumble. The Teams platform defines a proactive message as one the agent sends that is not a reply to a user request. Such messages cannot be sent by email or UPN in any scope, and in personal scope you must use the user's Entra object ID.

```text
// Pseudocode, following the _get_or_create_conversation pattern in the MCP server guide
object_id = lookup_graph(email)                 // email -> Entra object ID
conv = cache.get(object_id)
if no conv:
    conv = app.api.conversations.create(...)  // open a 1:1 chat even if the user has never messaged the bot
    cache.set(object_id, conv, tenantId)
send_card(conv, approval_card)
```

Storing the `tenantId` alongside the conversation id is mandatory. On a Teams forum, one developer believed a stored conversation reference had "expired"; the real cause turned out to be multiple tenant IDs. If the client has several tenants, or you test on your own tenant and then move to the client's, you can easily hit the same error.

**Step 6.** Handle send failures. When the recipient has blocked or removed the bot, Teams returns `403` with `subCode: MessageWritesBlocked`. When you see it, flag the user, tell the agent so it can switch to a backup approver, and do not resend.

**Key point:** A reliable approval flow knows what to do when the approver is no longer listening.

## Errors to check before the demo

The list of common errors is short. The card is set to version 1.4 because it was copied from the example. The bot handles `Action.Execute` but forgets the `Action.Submit` branch. The recipient is identified by email instead of object ID. The conversation id is cached without the tenant.

You can catch the first three on your own test tenant, as long as you test on several clients and send to someone who has never messaged the bot. The last depends on how the client organizes its environment, so check it again when you move to the client's systems.

So in the first week on site, start by asking three questions: how many tenants the organization has, which Teams clients are in use, and how the agent identifies approvers. Those three answers tell you how much care steps 2, 3 and 5 need.

To show this skill in a job application, a small repo that runs the full `request_approval` → card → decision flow, with 403 handling and multiple approvers, is more concrete evidence than any "familiar with Teams" line on a CV. Spell out in the README which edge cases you handled.

The more authority an agent is given, the more the Approve button matters. Whoever understands how that button breaks is the person a client calls when it wants its agent to do real work.

**Try this week:**

- Run OfficeDev's bot-proactive-message sample (Node.js/TypeScript) on port 3978 and send a proactive message to your own test account
- Write a version 1.5 approval card with Action.Execute and an Action.Submit fallback, then click it and log the full Activity.Value you receive
- Write a function that takes an email, looks up the Entra object ID through Graph and caches the (object ID, tenantId, conversation id) set

## Sources

- [Use Universal Actions for Adaptive Card - Teams | Microsoft Learn](https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/universal-actions-for-adaptive-cards/work-with-universal-actions-for-adaptive-cards)

- [Up to date views - Teams | Microsoft Learn](https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/universal-actions-for-adaptive-cards/up-to-date-views)

- [Send proactive messages - Teams | Microsoft Learn](https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/send-proactive-messages)

- [Host an MCP Server from a Teams Agent - Teams | Microsoft Learn](https://learn.microsoft.com/en-us/microsoftteams/platform/teams-sdk/in-depth-guides/ai/mcp/mcp-server)

- [Azure Bot Framework SDK to Microsoft 365 Agents SDK migration guidance | Microsoft Learn](https://learn.microsoft.com/en-us/microsoft-365/agents-sdk/bf-migration-guidance)

- [Universal Actions in Adaptive Cards on Microsoft Teams](https://devblogs.microsoft.com/microsoft365dev/universal-actions-in-adaptive-cards-on-microsoft-teams/)

- [How to Add an Adaptive Card in Microsoft 365 Agent SDK](https://techcommunity.microsoft.com/blog/iis-support-blog/how-to-add-an-adaptive-card-in-microsoft-365-agent-sdk/4472022)

- [Teams Bot - user conversation objects are becoming stale, breaking the ability to send proactive msg](https://techcommunity.microsoft.com/discussions/teamsdeveloper/teams-bot---user-conversation-objects-are-becoming-stale-breaking-the-ability-to/3887850)

- [Bot Proactive Message - Node.js (TypeScript)](https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/TeamsSDK/bot-proactive-message/nodejs/bot-proactive-message)
