[MlMt] Microsoft's AdaptiveCards
Kee Hinckley
kee at hinckley.com
Thu Jun 17 15:12:49 EDT 2021
Microsoft has this script description language called AdaptiveCards.
Cortana uses it to send you potential todos based on analysis of your
email conversations. It's actually remarkably useful. It will catch
things where you told someone you'd look at something, or where someone
promised to get something to you. And then it presents a form in your
email to add them to your todos, or mark them completed. (Separately, I
have a convoluted path to get Office365 todos into OmniFocus).
But of course it only works in Outlook. But it's actually useful enough
that I pop over to my phone to read the Cortana messages there.
However, someone has done a loadable interpreter. You can load the card,
render it, and then update the HTML with the results.
the process looks something like:
```
<script
src="https://unpkg.com/adaptivecards/dist/adaptivecards.min.js"></script>
<script type="text/javascript">
card = {JSON ADAPTIVECARD GOES HERE};
var adaptiveCard = new AdaptiveCards.AdaptiveCard();
adaptiveCard.parse(card);
var renderedCard = adaptiveCard.render();
document.body.appendChild(renderedCard);
</script>
```
See https://www.npmjs.com/package/adaptivecards for details.
But in the incoming email for Outlook, of course it doesn't use that
script, because it assumes builtin support. Instead it has a script
block in the HTML head with the JSON in it.
<script type="application/adaptivecard+json">
JSON BLOCK
</script>
So what I'm wondering is whether it would be possible to write a generic
bit of Javascript that finds that script, interprets the body, and then
replaces the HTML section with the rendered results. Or, maybe safer in
the face of parsing errors, inserts it at the top and leaves the old
HTML at the bottom.
And then we could take that and insert it into MailMate's HTML template.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freron.com/pipermail/mailmate/attachments/20210617/29cca5ab/attachment.htm>
More information about the mailmate
mailing list