0

I am trying to implement AdaptiveCard into one of my dialogs using node.js. However once I run the emulator I get the following message instead of rendered AdaptiveCard: [File of type 'application/vnd.microsoft.card.adaptive'].

Can anyone tell me what can be the problem?

I am running on Ubuntu 16.04, MBF Emulator v.3.5.31-alpha, microsoft-adaptivecards v.0.6.1.

Here is code from inside of one of my dialogs:

var msg = new builder.Message(session)
.addAttachment({
  contentType: "application/vnd.microsoft.card.adaptive",
  content: {
    type: "AdaptiveCard",
            body: [
                {
                "type": "TextBlock",
                "text": msg_text,
            },
            {
                "type": "Input.ChoiceSet",
                "id": "myColor4",
                "isMultiSelect": true,
                "value": "1",
                "style": "expanded",
                "choices": [
                  {
                    "title": "Red",
                    "value": "1",
                    "isSelected": true
                  },
                  {
                    "title": "Green",
                    "value": "2"
                  },
                  {
                    "title": "Blue",
                    "value": "3",
                    "isSelected": true
                  }
                ]
            }
            ],
            "actions": [
              {
                "type": "Action.Submit",
                "title": "Sent",
                "data": {
                  "myProperty": 12
                }
              }
            ],    
  }
});
session.send(msg);

This is detailed response, it contains all elements of the AdaptiveCard that I declared(but still it does not render):

{
  "type": "message",
  "attachments": [
    {
      "contentType": "application/vnd.microsoft.card.adaptive",
      "content": {
        "type": "AdaptiveCard",
        "body": [
          {
            "type": "TextBlock",
            "text": "What color do you want?"
          },
          {
            "type": "Input.ChoiceSet",
            "id": "myColor4",
            "isMultiSelect": true,
            "value": "1",
            "style": "expanded",
            "choices": [
              {
                "title": "Red",
                "value": "1",
                "isSelected": true
              },
              {
                "title": "Green",
                "value": "2"
              },
              {
                "title": "Blue",
                "value": "3",
                "isSelected": true
              }
            ]
          }
        ],
        "actions": [
          {
            "type": "Action.Submit",
            "title": "Sent",
            "data": {
              "myProperty": 12
            }
          }
        ]
      }
    }
  ],
  "locale": "en-US",
  "localTimestamp": "2017-09-17T19:21:17+02:00",
  "from": {
    "id": "default-bot",
    "name": "Bot"
  },
  "recipient": {
    "id": "default-user"
  },
  "inputHint": "acceptingInput",
  "id": "heam84b9dn5b",
  "replyToId": "71j1d6mbmk3l",
  "channelId": "emulator",
  "timestamp": "2017-09-17T17:21:17.379Z",
  "conversation": {
    "id": "fdikc23llm5"
  }
}
4

0 回答 0