Search code examples
jsonescapingbotframeworkmicrosoft-teamsadaptive-cards

Adaptive Card - actionSet JSON escape URL parameters


I'm trying to add a button in an Adaptive Card JSON file that will open a url with parameters. For a single button with an url it works fine. Now, I have a case where the url receive parameters but when providing the url in the .json file the button doesn't work. I think it is related with escaping special characters in adaptive card, tried some options without success. Would you please know the correct way to use the url with parameters in adaptive cards ?

Case sample:

In .json file:

"actions": [ {

  "type": "Action.OpenUrl",

  "title": "Accept",

  "url": "https://domainsample.com/api/MovieService/StartWorkBySubscriptionId(subscriptionId='00000000-0000-0000-0000-000000000000’,itemId='1112')",

  "style": "positive"

}

Any help is really appreciated.


Solution

  • Ok, based on some tests, I found the way to escape the URL is to use the single quote, then in my case it is required to send two single quotes for each parameter:

    "url": "https://domainsample.com/api/MovieService/StartWorkBySubscriptionId(subscriptionId=''00000000-0000-0000-0000-000000000000'',itemId=''1112'')"
    

    With this single quote the button in card worked correctly.