SOLVED

Microsoft Teams Adaptive Card Not Opening URL

Copper Contributor

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.MST Adaptive Card URL Bug.PNG

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
          }
        }
      };
}

 

 

4 Replies
best response confirmed by marcusyoung (Copper Contributor)
Solution

@marcusyoung , Can you try using "https://kloud.com/" instead of "kloud.com/" for  action: url property. It expect a valid URI.

@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?

@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. 

Where can I find more info on rendering the HTML page? I have more than 6 links so the buttons won't work
1 best response

Accepted Solutions
best response confirmed by marcusyoung (Copper Contributor)
Solution

@marcusyoung , Can you try using "https://kloud.com/" instead of "kloud.com/" for  action: url property. It expect a valid URI.

View solution in original post