繁体   English   中英

在 MS Team Adaptive Card 中,我如何指定它发布到的服务器?

[英]In MS Team Adaptive Card, how do I specify the server it post to?

我正在尝试在我的自适应卡中使用 Action.Submit 来访问我的 Google Cloud Function。 我在哪里指定将提交的内容发送到哪里? 我这样做的原因是由于时间限制,我想跳过构建完整的聊天服务器。

自适应卡示例,没有属性可指定后 URL:

{
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "1.0",
  "body": [
    {
      "type": "TextBlock",
      "text": "Present a form and submit it back to the originator"
    },
    {
      "type": "Input.Text",
      "id": "firstName",
      "placeholder": "What is your first name?"
    },
    {
      "type": "Input.Text",
      "id": "lastName",
      "placeholder": "What is your last name?"
    }
  ],
  "actions": [
    {
      "type": "Action.Submit",
      "title": "Action.Submit",
      "data": {
        "x": 13
      }
    }
  ]
}

自适应卡不是专门为机器人服务开发的。 因此,与他们合作需要一些技巧,在您的情况下,如果您尝试发送包含您需要知道的自适应卡输入的请求:

  • when the user click the submit button the adaptive card will send a message to bot activity handler on behalf of the user , this message contains a JSON object (you can view this object by adding this line in the bot onMessage function .

控制台.log(上下文.活动)

  • 您可以使用以下方法从此消息中获取数据:

context.activity.value.firstName(获取自适应卡发送的名字)

  • 现在您可以使用Axios将您的请求发送到我更喜欢的服务器。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM