I am feeding this JSON in to an adaptive card for posting to a Teams channel:
{
"poster": "Flow bot",
"location": "Channel",
"body/recipient/groupId": "01411471-a43d-4441-aec1-xxxxx",
"body/recipient/channelId": "19:xxxxxxxcOXBgvEevo0U5z7SzeBzf7qbg03Va0sUQ1@thread.tacv2",
"body/messageBody": "{\n \"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",\n \"type\": \"AdaptiveCard\",\n \"version\": \"1.3\",\n \"body\": [\n {\n \"type\": \"TextBlock\",\n \"text\": \"**<at>600e29e3-81f5-4da6-8379-xxxxxxx</at>** und **<at>xxxxx@xxxxx.xxxx</at>**, Ihr Ticket **Connecting Email to Lexoffice fails** ist aktualisiert worden.\",\n \"wrap\": true\n },\n {\n \"type\": \"TextBlock\",\n \"text\": \"Beschreibung: **Connecting Exchange to Lexoffice fails with error \"Temporary server error\".**\",\n \"wrap\": true,\n \"color\": \"default\"\n },\n {\n \"type\": \"TextBlock\",\n \"text\": \"Priorität: **NORMAL**\",\n \"wrap\": true,\n \"color\": \"default\"\n },\n {\n \"type\": \"TextBlock\",\n \"text\": \"Status: **Externally blocked / waiting**\",\n \"wrap\": true,\n \"color\": \"default\"\n },\n {\n \"type\": \"ActionSet\",\n \"actions\": [\n {\n \"type\": \"Action.OpenUrl\",\n \"title\": \"Klicken Sie HIER um Ihr Ticket zu öffnen und zu bearbeiten\",\n \"url\": \"https://xxxxx.sharepoint.com/sites/xxxxx/_layouts/15/listform.aspx?PageType=4&ListId=XXXXX2D0cd5%2D40c9%2D88bd%2Db4b88c9b8c6e&ID=4&ContentTypeID=0x0100A1AE156A0D310C4996C7130593A975BE\",\n \"tooltip\": \"öffnet das Ticket im Browser\"\n }\n ]\n }\n ]\n}"
}
Please especially note this part:
\"text\": \"Beschreibung: **Connecting Exchange to Lexoffice fails with error \"Temporary server error\".**\",\n
The original text gets provided by users and they frequently enclose verbose errors in " .... " for clarity.
When I extract that from SharePoint and parse it, it seems \ is added as an escape character (?).
However, that escape character throws this error in my adaptive card:
"Microsoft.Azure.ProcessSimple.Data.Entities.Exceptions.ProcessSimpleDataException: The specified Teams flowbot adaptive card request is missing or invalid. The tracking Id is '{0}'. ---> Newtonsoft.Json.JsonReaderException: After parsing a value an unexpected character was encountered: T. Path 'body[1].text', line 13, position 88.\r\n
Removing the " from the original text or replacing it with ' fixes the issue.
QUESTION 1:
Is the adaptive card action not accepting the \ escape character a BUG? Or is that actually undefined?
IF it is a bug, where/how do I report this?
QUESTION 2:
Telling users to NOT use " is utterly impractical. But this limitation currently breaks a lot of our support processes.
Can anyone suggest a work-around? I can see:
1. Strip " from the body. Is there an EASY way to do that within my flow?
2. replace it with '. Same: Is there an EASY way to do that within my flow?
That text body lives in a string variable throughout the flow, so I can modify/manipulate it before feeding it in to the adaptive card.
THANKS!
OK, I think I found the work around:
I use
replace(first(variables('Descriptions')), '"', '''')
To get the fist/latest string from my array, WHILE replacing " with '
Still - doesn't seem right to me that the escape character causes a failure. Is that supposed to be that way?