首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >从Botframework中的适配卡`Action.Submit`获取变量

从Botframework中的适配卡`Action.Submit`获取变量
EN

Stack Overflow用户
提问于 2018-03-03 01:06:08
回答 1查看 1K关注 0票数 2

当用户单击按钮时,如何获取该值?我有一张样例卡片。

代码语言:javascript
复制
{
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "1.0",
  "speak": "<s>Your  meeting about \"Adaptive Card design session\"<break strength='weak'/> is starting at 12:30pm</s><s>Do you want to snooze <break strength='weak'/> or do you want to send a late notification to the attendees?</s>",
  "body": [
    {
      "type": "TextBlock",
      "text": "Adaptive Card design session",
      "size": "large",
      "weight": "bolder"
    },
    {
      "type": "TextBlock",
      "text": "Conf Room 112/3377 (10)",
      "isSubtle":true
    },
    {
      "type": "TextBlock",
      "text": "12:30 PM - 1:30 PM",
      "isSubtle":true,
      "spacing":"none"
    },
    {
      "type": "TextBlock",
      "text": "Snooze for"
    },
    {
      "type": "Input.ChoiceSet",
      "id": "snooze",
      "style":"compact",
      "value": "5",
      "choices": [
        {
          "title": "5 minutes",
          "value": "5",
          "isSelected": true
        },
        {
          "title": "15 minutes",
          "value": "15"
        },
        {
          "title": "30 minutes",
          "value": "30"
        }
      ]
    }
  ],
  "actions": [
    {
      "type": "Action.Submit",
      "title": "Snooze",
      "data": { "x": "snooze" }
    },
    {
      "type": "Action.Submit",
      "title": "I'll be late",
      "data": { "x": "late" }
    }
  ]
}

示例如下:http://adaptivecards.io/samples/CalendarReminder.html

如何在session.message对象中访问它?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-03-03 01:12:44

我想通了。在本例中,它是x,所以要回复它,它应该是:

代码语言:javascript
复制
if (session.message && session.message.value) {
    // A Card's Submit Action obj was received
    session.send(session.message.value.x)
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49073982

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档