my Actionable Message card is not refereshing. Here's what I have already checked
- the refesher card has valid syntax according to the actionable card designer
- the refresher card has the
originatorproperty
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0",
"type": "AdaptiveCard",
"originator": "<guid>",
"body": [
{
"type": "TextBlock",
"text": "The action has been recorded."
}
]
}
The response is returned as following from the API (Azure Functions)
string card = "<card-json>";
req.HttpContext.Response.Headers.Add("CARD-ACTION-STATUS", "Action accepted, thank you.");
req.HttpContext.Response.Headers.Add("CARD-UPDATE-IN-BODY", "true");
return new OkObjectResult(card);
Also I have tried this, without success
string card = "<card-json>";
req.HttpContext.Response.ContentType = "application/json; charset=utf-8";
req.HttpContext.Response.Headers.Add("CARD-ACTION-STATUS", "Action accepted, thank you.");
req.HttpContext.Response.Headers.Add("CARD-UPDATE-IN-BODY", "true");
req.HttpContext.Response.Body = new MemoryStream(Encoding.UTF8.GetBytes(card));
return new OkResult();
When submitting the inital card's POST action, see banner displaying Action accepted, thank you. is displayed, however the card itself is not refreshed.
Here's the sample API response data

Do you spot any obvious mistakes? Researching this behaviour, I've found that the most common error is not supplying the relevant headers, but I was sure to add them.
Any help is greatly appreciated!
I just solved the problem myself. I was a data serialization issue.
For creating the adaptive card json I am using these two packages
Specifically the code is
and
card.Expand()returns an escaped json-string, i.e. something like this"{\"key\": \"value\"}"Apparently
return new OkObjectResult(card)in my question above tries to serialize that string again, resulting in just a string. Which is notapplication/json.My workaround was to just pass an object rather than a string to the
return new OkObjectResult()method (as the name suggests :D). However, since I do not have types of any card-template I use, I could not use System.Text.Json for deserialization, because this is not supported for anonymous types. Therefore I used Newtonsoft.Json. The following works and updates actionable message as expected.