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

能否在Action.Submit的msteams.value中绑定Adaptive Card表单输入值?如何实现?

如何在Teams Adaptive Card的Action.Submit中绑定表单输入值到msteams.value?

可以直接通过Adaptive Cards的数据绑定语法实现,用{{输入组件ID}}的形式引用表单字段值,替换msteams.value中的硬编码内容即可。

修改后的Adaptive Card JSON如下:

{
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "1.5",
  "body": [
    {
      "type": "Input.Text",
      "id": "question",
      "label": "Question",
      "isRequired": true
    },
    {
      "type": "Input.Text",
      "id": "answer",
      "label": "Answer",
      "isMultiline": true,
      "isRequired": true
    },
    {
      "type": "Input.ChoiceSet",
      "id": "selectcity",
      "label": "Select your city",
      "isRequired": true,
      "choices": [
        {
          "title": "City 1",
          "value": "1"
        }
      ]
    }
  ],
  "actions": [
      {
      "type": "Action.Submit",
      "title": "Create",
      "style": "positive",
      "data": {
        "msteams": {
          "type": "imBack",
          "value": "问题:{{question}}\n回答:{{answer}}\n选择的城市ID:{{selectcity}}"
        }
      }
    }
  ]
}

关键说明:

  • 用{{question}}、{{answer}}、{{selectcity}}分别对应表单中输入组件的id,提交时Adaptive Card引擎会自动将这些占位符替换为用户实际填写/选择的值
  • 可以根据需求自定义消息格式,比如添加换行符\n、分隔符来优化消息展示效果
  • 注意占位符的名称必须和输入组件的id完全一致,大小写敏感

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.12 06:42:03