You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Bot Framework V3中ServiceNow推送的Message Card在Teams按钮不显示问题

Troubleshooting Unrendered Buttons in Teams Message Cards (Bot Framework V3)

Let’s dive into why your Message Card buttons aren’t showing up when pushing from ServiceNow to Teams via Bot Framework V3 (with your specific SDK versions) and fix this step by step.

Key Issues & Fixes

1. Outdated Bot.Connector.Teams SDK Version

The biggest red flag here is your use of Bot.Connector.Teams v0.9.0—this is an extremely old version of the Teams connector for Bot Framework V3. Early versions of this SDK had limited support for O365 Connector Card actions like potentialAction, often failing to render buttons even if the payload was technically correct.

Fix:
Upgrade your Microsoft.Bot.Connector.Teams NuGet package to a version compatible with your Bot Builder v3.12.2.4. The recommended version is v3.12.0 (the latest stable release for Bot Framework V3 Teams support). You can do this via the NuGet Package Manager in Visual Studio or run this command in the Package Manager Console:

Install-Package Microsoft.Bot.Connector.Teams -Version 3.12.0

2. Payload Structure & Compatibility with V3

Even if the payload looks correct, older SDKs can be picky about certain details. Let’s adjust your payload to match what Bot Framework V3 expects for Teams:

  • Simplify the targets array in potentialAction (older SDKs sometimes struggle with multiple OS-specific targets)
  • Ensure @context uses HTTPS (Teams has tightened schema requirements over time)
  • Remove empty section fields (they shouldn’t break things, but clean payloads avoid edge cases)

Here’s the revised payload to test:

{
  "contentType": "application/vnd.microsoft.teams.card.o365connector",
  "content": {
    "@type": "MessageCard",
    "@context": "https://schema.org/extensions",
    "title": "Incident Updated - INC0010010",
    "summary": "Incident Updated - INC0010010",
    "themeColor": "D1222B",
    "sections": [
      {
        "facts": [
          {"name": "Category", "value": "Software"},
          {"name": "State", "value": "New"},
          {"name": "Priority", "value": "5 - Planning"},
          {"name": "Assignment group", "value": "Software"}
        ]
      },
      {"text": "Please check the details"}
    ],
    "potentialAction": [
      {
        "@type": "OpenUri",
        "name": "View Incident in ServiceNow",
        "targets": [{"os": "default", "uri": "https://dev62584.service-now.com/incident.do?sys_id=XXXXXXX&sysparm_stack=incident_list.do?sysparm_query=active=true"}]
      }
    ]
  }
}

3. Verify Bot Framework V3 Attachment Sending Code

Double-check that you’re attaching the card correctly in your .NET code. A common mistake is missing proper attachment formatting. Here’s a sample snippet to confirm:

using Microsoft.Bot.Connector;
using Newtonsoft.Json;

// Create the attachment from your payload
var cardPayload = JsonConvert.DeserializeObject<object>(/* your revised JSON string */);
var teamsCard = new Attachment
{
    ContentType = "application/vnd.microsoft.teams.card.o365connector",
    Content = cardPayload
};

// Send the reply with the attachment
var reply = activity.CreateReply();
reply.Attachments.Add(teamsCard);
await connector.Conversations.ReplyToActivityAsync(reply);

Final Recommendation

Start with upgrading the Bot.Connector.Teams SDK—this is the most likely fix, as the v0.9.0 version predates many critical updates to Teams card support in Bot Framework V3. If upgrading alone doesn’t work, test the simplified payload above to rule out formatting edge cases.

内容的提问来源于stack exchange,提问作者rrc2k4

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 12:37:31