简体   繁体   English

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

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

I am trying to use Action.Submit in my adaptive card to hit my Google Cloud Function.我正在尝试在我的自适应卡中使用 Action.Submit 来访问我的 Google Cloud Function。 Where do I specify where to send the submission to?我在哪里指定将提交的内容发送到哪里? The reason I am doing this is I want to skip building a full chat server due to time constraint.我这样做的原因是由于时间限制,我想跳过构建完整的聊天服务器。

Example of Adaptive Card, no property to specify post URL:自适应卡示例,没有属性可指定后 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
      }
    }
  ]
}

Adaptive cards aren't developed specifically for bot service.自适应卡不是专门为机器人服务开发的。 so working with them needs some tricks, in your case if you are trying to send a request that contain adaptive card inputs you need to know:因此,与他们合作需要一些技巧,在您的情况下,如果您尝试发送包含您需要知道的自适应卡输入的请求:

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

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

  • you can get the data from this meesage by using:您可以使用以下方法从此消息中获取数据:

context.activity.value.firstName (to get the firstName sent by the adaptive card) context.activity.value.firstName(获取自适应卡发送的名字)

  • Now you can send your request to the server i prefer using Axios .现在您可以使用Axios将您的请求发送到我更喜欢的服务器。

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

相关问题 如何在 JSON 自适应卡中使用 If 语句让团队在提交的选择响应中@提及用户? - How do I Use an If statement within JSON Adaptive card for Teams to @mention user on Submitted Choice Response? 如何在网络聊天的自适应卡片 1.2 版中将输入文本设为必填字段 - How do I make Input text a required field in adaptive card version 1.2 for webchat 在自适应卡片中,用户提交时如何切换可见性? - In Adaptive Card, how can I ToggleVisibility when user submit? MS Chat Bot-如何从我的C#代码访问自定义自适应卡属性 - MS Chat Bot --How to access custom adaptive card properties from my C# code 如何从自适应卡中取回消息 - How to get message back from Adaptive card 如何从自适应卡检索输入数据? - How to retrieve input data from an adaptive card? 如何在 Adaptive Card 中链接 QnA Maker 答案= - How to link QnA Maker answer in Adaptive Card= 在选择集中进行选择后,如何在渲染器端填充自适应卡输入值? - How do you populate Adaptive Card input values on the renderer side after a selection is made in a choice set? 我想知道如何使用 Bot 框架 SDK 为 python 设置自适应卡的主机配置 - I would like to know how to set the host config of the adaptive card using Bot framework SDK for python 自适应卡内的自适应卡,用于常见问题解答 - Adaptive Card inside Adaptive Card for FAQ's
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM