2017-06-09 2 views
1

次のように私は、適応カードをお持ちの場合:node.jsのAdaptive Cardからボタンアクションを読み取るにはどうすればよいですか?

ボットは提出のいずれかのボタンをクリックするユーザーのために待機するように私は、会話の中でそれを提示するにはどうすればよい
var msg = new builder.Message(session) 
.addAttachment({ 
    contentType: "application/vnd.microsoft.card.adaptive", 
    content: { 
     type: "AdaptiveCard", 
     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)" 
       }, 
       { 
        "type": "TextBlock", 
        "text": "12:30 PM - 1:30 PM" 
       }, 
       { 
        "type": "TextBlock", 
        "text": "Snooze for" 
       }, 
       { 
        "type": "Input.ChoiceSet", 
        "id": "snooze", 
        "style":"compact", 
        "choices": [ 
         { 
          "title": "5 minutes", 
          "value": "5", 
          "isSelected": true 
         }, 
         { 
          "title": "15 minutes", 
          "value": "15" 
         }, 
         { 
          "title": "30 minutes", 
          "value": "30" 
         } 
        ] 
       } 
      ], 
      "actions": [ 
       { 
        "type": "Action.Submit", 
        "title": "Snooze" 
       }, 
       { 
        "type": "Action.Submit", 
        "title": "I'll be late" 
       } 
      ] 
    } 
}); 

を?

どのように押されたボタンを読むのですか?

node.jsに例が見つかりませんでした。あなたはsession.message.valueが存在

if (session.message && session.message.value) { 
// process your card's submit action 
} 

であるかどうかを確認する必要があり

感謝

答えて

0

は、あなたが行動を提出処理する方法を参照するには、以下のAdaptive Card sampleを見てみましょう。

0

LUISレコグナイザを使用している場合は、同じように(Action.submitを処理する)どうすればよいですか?適応カードの

var recognizer = new builder.LuisRecognizer(config.LUIS_MODEL_URL); 
bot.recognizer(recognizer); 

bot.dialog('toolAccess', [ 
     function (session,args,next) { 

       const msg = new builder.Message(session) 
          .addAttachment({ 
       //adaptive card body here with Action.submit buttons... 
       }); 
       session.send(msg); 
     } 
]).triggerAction({ matches : 'toolAccess'}); 
//toolAccess is an intent in my LUIS app. 

私のアクションは次のとおりです。

"actions": [ 
        { 
         "type": "Action.Submit", 
         "data": { 
           "type": "okProfileSelection" 
         }, 
         "title": "OK" 
        }, 
        { 
         "type": "Action.Submit", 
         "data": { 
           "type": "cancelProfileSelection" 
         }, 
         "title": "Cancel" 
        } 
       ] 

そこで問題は、私はこれらのOKボタンとキャンセルボタンの取り扱いはどうすればよいのですか? 別のダイアログを追加する必要がありますか?もしそうなら、triggerActionはどのようにすべきですか?

関連する問題