Jul 22 2020 05:40 PM
I created a messaging extension that creates an pop up adaptive card that gives three options and opens a link based on the option chosen. Currently I just want the Open Sync Room button to open up to an external website, but the button doesn't do anything.
This is my code for the adaptive card.
function syncRoom(context, action){
const syncRoomList = [
{ name: 'Room 1' },
{ name: 'Room 2' },
{ name: 'Room 3' },
]
const choices = [];
syncRoomList.forEach(el => choices.push({ title: el.name, value: el.name }))
const adaptiveCard = CardFactory.adaptiveCard({
actions: [{
title: 'Open Sync Room',
type: "Action.OpenUrl",
url: 'kloud.com'
}],
body: [
{ text: 'Sync Rooms', type: 'TextBlock', weight: 'bolder'},
{ choices, id: 'MultiSelect', style: 'expanded', type: 'Input.ChoiceSet' },
],
type: 'AdaptiveCard',
version: '1.0'
});
return {
task: {
type: 'continue',
value: {
card: adaptiveCard,
height: 450,
title: 'Sync Room List',
url: null,
width: 500
}
}
};
}
Jul 23 2020 03:15 AM
Solution@marcusyoung , Can you try using "https://kloud.com/" instead of "kloud.com/" for action: url property. It expect a valid URI.
Jul 23 2020 11:16 AM
@subhasish-MSFT, Thanks for your help, It worked! Another question, how do I access the option that I have chosen in the card? Ideally I'd like the open sync room button to go to a different website depending on what option is chosen. Is there a way to do this?
Jul 23 2020 11:54 PM
@marcusyoung ,
Adaptive card "OpenURL" action can not be modified with selected value. You could keep three different buttons with different URLs.
Or you could render a HTML page inside the task module and modify the button URL based on user selection of choice.
Jul 31 2020 02:27 PM
Jul 23 2020 03:15 AM
Solution@marcusyoung , Can you try using "https://kloud.com/" instead of "kloud.com/" for action: url property. It expect a valid URI.