Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptive card not working on Emulator #244

Closed
jazzedge opened this issue Jul 12, 2017 · 6 comments
Closed

Adaptive card not working on Emulator #244

jazzedge opened this issue Jul 12, 2017 · 6 comments

Comments

@jazzedge
Copy link

Hi, despite guidance to the contrary, it looks like the adaptive card isn't working on the latest version of the Emulator. I get the following error: [File of type 'application/vnd.microsoft.card.adaptive'] when trying to display the card from this repo: https://github.com/Microsoft/BotBuilder-Samples/blob/master/Node/cards-AdaptiveCards/app.js#L138-L153. Any suggestions?

The code is as follows:

var bot = new builder.UniversalBot(connector, function (session) {
var card = {
'contentType': 'application/vnd.microsoft.card.adaptive',
'content': {
'$schema': 'http://adaptivecards.io/schemas/adaptive-card.json',
'type': 'AdaptiveCard',
'version': '1.0',
'body': [
{
'type': 'Container',
'speak': 'Hello!Are you looking for a flight or a hotel?',
'items': [
{
'type': 'ColumnSet',
'columns': [
{
'type': 'Column',
'size': 'auto',
'items': [
{
'type': 'Image',
'url': 'https://placeholdit.imgix.net/~text?txtsize=65&txt=Adaptive+Cards&w=300&h=300',
'size': 'medium',
'style': 'person'
}
]
},
{
'type': 'Column',
'size': 'stretch',
'items': [
{
'type': 'TextBlock',
'text': 'Hello!',
'weight': 'bolder',
'isSubtle': true
},
{
'type': 'TextBlock',
'text': 'Are you looking for a flight or a hotel?',
'wrap': true
}
]
}
]
}
]
}
],
'actions': [
// Hotels Search form
{
'type': 'Action.ShowCard',
'title': 'Hotels',
'speak': 'Hotels',
'card': {
'type': 'AdaptiveCard',
'body': [
{
'type': 'TextBlock',
'text': 'Welcome to the Hotels finder!',
'speak': 'Welcome to the Hotels finder!',
'weight': 'bolder',
'size': 'large'
},
{
'type': 'TextBlock',
'text': 'Please enter your destination:'
},
{
'type': 'Input.Text',
'id': 'destination',
'speak': 'Please enter your destination',
'placeholder': 'Miami, Florida',
'style': 'text'
},
{
'type': 'TextBlock',
'text': 'When do you want to check in?'
},
{
'type': 'Input.Date',
'id': 'checkin',
'speak': 'When do you want to check in?'
},
{
'type': 'TextBlock',
'text': 'How many nights do you want to stay?'
},
{
'type': 'Input.Number',
'id': 'nights',
'min': 1,
'max': 60,
'speak': 'How many nights do you want to stay?'
}
],
'actions': [
{
'type': 'Action.Submit',
'title': 'Search',
'speak': 'Search',
'data': {
'type': 'hotelSearch'
}
}
]
}
},
{
'type': 'Action.ShowCard',
'title': 'Flights',
'speak': 'Flights',
'card': {
'type': 'AdaptiveCard',
'body': [
{
'type': 'TextBlock',
'text': 'Flights is not implemented =(',
'speak': 'Flights is not implemented',
'weight': 'bolder'
}
]
}
}
]
}
};

var msg = new builder.Message(session)
.addAttachment(card);
session.send(msg);
});

@Jeffders
Copy link
Member

Hi jazzedge,

I tried your repo code and was able to get the card to render with the emulator version v3.5.29:

image

Can you double check the version you are running...when the emulator is open, click on the vertical three dots to bring up the context menu and choose "About".

Jeff

@jazzedge
Copy link
Author

I'm on 3.5.29

@jazzedge
Copy link
Author

Interestingly, it works on my Mac, not on my Windows laptop. I'll try deleting and installing the Emulator and trying again.

@Jeffders
Copy link
Member

Did this work once you reinstalled things on Windows?

@jazzedge
Copy link
Author

Move from 3.5.27 to 3.5.29, now working, thanks!

@vishal4388
Copy link

Thank you jazzedge. your code worked for me...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants