Share via

Using Teams workflows to automatically post an Adaptive Card in a channel

Anonymous
2024-07-21T09:58:36+00:00

Hi team!

My situation is as follows: I set up a python application which will dynamically generate a JSON file upon some trigger, the JSON template looks like the following:

{
  "type": "AdaptiveCard",
  "attachments": [
      {
        "$$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "type": "AdaptiveCard",
        "contentType": "AdaptiveCard",
        "content": {

        },
        "version": "1.5",
        "body": [
          {
            "type": "TextBlock",
            "text": "${releaseTitle}",
            "weight": "bolder",
            "size": "large"
          },
          {
            "type": "TextBlock",
            "text": "${description}",
            "wrap": true
          }
        ] 
      }
    ]
}

The JSON then gets templated correctly (I have triple checked the output, the double $ sign is to escape the $ sign itself in python templating). This is then sent as the body of a POST request to a Teams webhook, which has the following flow:

When I activate the request, it is successfully received and triggered, only that the card, when posted, is empty, without the text block specified in the request. Is there a different way of achieving the posting of a dynamically generated adaptive card?

Microsoft Teams | Microsoft Teams for business | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
  1. Anonymous
    2024-07-23T08:04:39+00:00

    Hello Vanija,

    * I am a Microsoft user like you, providing solutions to community members; I am NOT a Microsoft employee.

    It's highly unlikely that you'll find the answers to your question on this platform. Microsoft Answers is for user-based applications, the better place to ask your coding-related questions is on Microsoft Learn (https://learn.microsoft.com/en-us/answers/support/ask-question).

    I hope you find your answers there.

    • Stephen N.
    1 person found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2024-07-24T07:59:27+00:00

    Hi @Stephen!

    Thanks for the redirect, I will close the question and repost it there!

    Br,

    Vanja S.

    0 comments No comments
  2. Anonymous
    2024-07-22T07:07:24+00:00

    Hi @Jackson and thanks for the reply!

    Sadly the linked documentation does not cover my use case. Do you maybe have a working example of how to insert dynamic data into the adaptive card? Like in my JSON, I want to have {releaseTitle} and {description} dynamically defined in the POST request.

    Br,

    Vanja S.

    0 comments No comments
  3. Anonymous
    2024-07-21T10:53:20+00:00

    Hello Vanja ,

    My name is Jackson and thank you for your question.

    I sincerely apologize for the issue you experience with your Teams , I am a user myself and do not work for Microsoft so I understand how frustrating this is.

    See if the steps to create adaptive card and possible troubleshooting tips helps;

    https://learn.microsoft.com/power-automate/create-adaptive-cards

    Warm regards,

    Jackson E.

    0 comments No comments