FDE Times dataFDE jobs open 928▲21 Change in open roles over 7 days, like-for-like: roles from companies we started tracking this week are left outNew in 7 days 85Companies hiring 200Remote-friendly 24%Median US pay $200kTop hirer Databricks 107
中文VI

The newspaper of the Forward Deployed Engineer

Guides

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.

ShareLinkedInFacebookX

In brief

  • Universal Actions require schema 1.5. Every Action.Submit must become Action.Execute with an Action.Submit fallback, and the bot must handle both.
  • Proactive messages cannot be sent by email or UPN. You need the Entra object ID, a stored conversation id and the correct tenantId.
  • A 403 with MessageWritesBlocked means the user has blocked or removed the bot, so record it instead of retrying forever.
Approval flow diagram: the Agent calls request_approval, which goes to the Bot; the Bot sends a card to Teams (highlighted orange arrow), then on to the Approver. The decision returns to the Agent. Four numbered checks: 1, the bot handles both Action.Execute and Action.Submit; 2, send using the Entra object ID plus tenantId, not email; 3, cards use schema 1.5 with a fallback; 4, on a 403 error, switch to a backup approver.
The most fragile step is the bot proactively sending the card to Teams. It needs the Entra object ID and tenantId; sending by email fails. Source: Microsoft's Universal Actions, "Up to date views" and Teams platform documentation, as cited in the article.

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.

{
  "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.

// 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.

// 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.

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.

Was this article useful?

Use with your AI assistantAsk Claude ↗Ask ChatGPT ↗
9 sources
Read next on the roadmap · Stage 3: Applied AIThe best eval set is already in your client's logs, once anonymizedSix steps turn raw production logs into a golden set, with a clear point at which to stop reading traces.