Sending Universal Action Adaptive Card to Outlook via Bot Framework v4

James Bruford 1 Reputation point
2021-10-06T15:51:33.147+00:00

Hi,
I want to send a v1.4 adaptive card to both Teams and Outlook. I have it working in Teams, but cant work out how I can also have the card delivered to Outlook. I've scoured the web looking for an example, but cant seem to find one. Could anyone provide me with a pointer in the right direction on how to send an adaptive card to outlook via a bot please?

thanks

Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
804 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,056 questions
{count} votes

5 answers

Sort by: Most helpful
  1. YutongTie-MSFT 48,506 Reputation points
    2021-10-07T04:10:45.397+00:00

    Hello,

    Is this document you are looking for? https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/universal-actions-for-adaptive-cards/overview?tabs=mobile#universal-actions

    Before the Universal Actions for Adaptive Cards, different hosts provided different action models as follows:
    Teams or bots used Action.Submit, an approach which defers the actual communication model to the underlying channel.
    Outlook used Action.Http to communicate with the backend service explicitly specified in the Adaptive Card payload.

    138383-image.png
    138329-image.png

    More information please refer to the document.

    Regards,
    Yutong


  2. James Bruford 1 Reputation point
    2021-10-07T14:57:23.577+00:00

    Hi Yutong - thanks for the quick reply. This is exactly what I need to achieve, but I'm struggling to find out how to send the card as part of an email. How do I send the adaptive card to Outlook? I can achieve this by building an Email message object and sending via Graph, but when I open the email a warning label is shown - "The action could not be completed".

    Looking at the HTTP traffic, i receive an HTTP500 with the following message:
    {"innerErrorCode":"Unknown","innerErrorMessage":"Object reference not set to an instance of an object.","authenticationUrl":null,"displayMessage":"The action could not be completed."}

    thanks
    James


  3. James Bruford 1 Reputation point
    2021-10-11T14:09:09.187+00:00

    Hi Chetan
    My understanding is that the universal model means that Action.Execute can be used in both Teams and Outlook - this is to unify the action mechanism so the same card payload can be used in both Teams and Outlook channels.

    {
    "type": "AdaptiveCard",
    "version": "1.4",
    "originator": "",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "refresh": {
    "action": {
    "type": "Action.Execute",
    "title": "Refresh",
    "verb": "refreshCard",
    "id": "refreshCard"
    },
    "userIds": "${userIds}"
    },
    "actions": [
    {
    "type": "Action.Execute",
    "title": "Approve",
    "verb": "approveClicked"
    }
    ],
    "body": [
    {
    "type": "TextBlock",
    "wrap": true,
    "weight": "Bolder",
    "text": "Approval request view"
    },
    {
    "type": "TextBlock",
    "wrap": true,
    "text": "Please approve this asset"
    }
    ]
    }


  4. James Bruford 1 Reputation point
    2021-11-02T10:18:31.763+00:00

    Hi - from what I've read, the new Execute method should work in Outlook and Teams. This is a recent update to unify the action model between the two channels.


  5. James Bruford 1 Reputation point
    2021-12-06T09:38:22.853+00:00

    Hi @Evan Abramson - afraid not.

    I'm still working on it. I was doing the same as you sending it via graph insuring the originator ID was passed as part of the payload. For the time being I've had to implement v1.0 with a separate backend that can process the POST. I found this blog post by Vardhaman: https://www.vrdmn.com/2021/07/working-with-adaptive-card-universal.html
    where he mentions that he is going to write a blog post on how to do this.

    If I make any progress, I'll update this thread. If you get there before me, I'd appreciate any pointers in the right direction.

    thanks
    James