Edit Workflow to Post Adaptive Card 

You need to edit the workflow to add an Adaptive Card and post to the channel when a webhook request is received.

To edit the Workflow for using Adaptive Card, perform the following steps:

  1. In the Workflows window, go to the Home tab and click the Flow name to see details.

  2. Click Edit to add actions to the workflow.
    Picture 7

  3. Click  (additional options) to see the options for the step 'Send each adaptive card'. 

  4. Click Delete to delete the step. 
    When creating a workflow for a webhook request, the Send Each Adaptive step is automatically added. To correct the workflow, you need to delete this step.

  5. Click OK in the confirmation pop-up.

  6. Click New step to add further steps in the workflow. 

  7. Click in the search bar and type Parse JSON. Choose Parse JSON from Actions.

  8. From the Dynamic content search, select Content type to body.

  9. In the Apply to each window, click Parse JSON.
     

  10. In Parse JSON, copy the schema into the Schema field.

    You can paste the customized schema, but ensure that it has been tested before pasting here.

    Attachment.

    Schema 

    {
        "type": "array",
        "items": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string"
                },
                "text": {
                    "type": "string"
                },
                "wrap": {
                    "type": "boolean"
                }
            },
            "required": [
                "type",
                "text",
                "wrap"
            ]
        }
    } 
        
    
  11. Once the Parse JSON is pasted, click Add an action. The Choose an Operation window is displayed.
    Picture 11

  12. In the Choose an operation window, search and select Post a card in chat or channel.

  13. If the version is changed to greater than 1.3, the card is not displayed on the channel.

    The selected Target Version (1.6) is greater than the version supported by Bot Framework WebChat (1.3).
    You can create custom adaptive cards Designer | Adaptive Cards.
    RichTextBlock can recognize the '\n' as a newline character, and TextBlock recognizes '\n\n' as a newline character.

    In the Post card in a chat or channel step, perform the following steps:

    1. From the Post in drop-down list, click Channel.
      select post in type.
    2. Select Team ID and Channel ID.
      add channel details.
      Paste the below Adaptive Card in the Adaptive Card section.

      Adaptive Card 

      {
          "type": "AdaptiveCard",
          "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
          "version": "1.3",
          "body": [
              {
                  "type": "RichTextBlock",
                  "inlines": [
                      {
                          "type": "TextRun",
                          "text":"@{items('Apply_to_each_2')['text']}"
                      }
                  ]
              }
          ]
      }      
          
      
  14. Click the  beside the text to ensure it is selected from the dynamic tab.

    To parse the card text content, ensure to replace "@{items('Apply_to_each_2')['text']}" with the 'text' from the Dynamic content in the Teams Workflow.

  15. Click Save.

Your Workflow is ready to use.