简体   繁体   中英

Adaptive card is not rendered on Teams mobile app

We have an external bot configured to use MS Teams channel using message end point web hook. The following is the message posted to the Ms Teams channel by the external bot. This response gets rendered as expected when MS Teams is accessed via web browser or MS Teams application on desktop computer. However, the card is not rendered (seeing an empty line/block without any content) when used with Teams application on an android mobile phone. Would like to know what is going wrong here?Is this feature not supported on mobile? or are we missing something?

   "channelData":{ 
      "tenant":{ 
         "id":"xxxxxxxxxxxxxx"
      }
   },
   "attachments":[ 
      { 
         "contentType":"application/vnd.microsoft.card.adaptive",
         "content":{ 
            "fallbackText":"Adaptive card version not supported",
            "type":"AdaptiveCards",
            "body":[ 
               { 
                  "text":"Here is an adaptive card with a link to a task module",
                  "type":"TextBlock"
               },
               { 
                  "type":"Image",
                  "url":"http://adaptivecards.io/content/cats/1.png"
               }
            ],
            "version":"1.0",
            "actions":[ 
               { 
                  "type":"Action.OpenUrl",
                  "title":"Open Link",
                  "url":"https://teams.microsoft.com/l/task/xxxxx?url=https%3A%2F%2Fwww.wikipedia.com%0A&height=large&width=large&title=Wikipedia-Embed"
               }
            ]
         }
      }
   ],
   "replyToId":"xxxxxx",
   "serviceUrl":"https://smba.trafficmanager.net/amer/",
   "recipient":{ 
      "name":"xxxx xxxx",
      "aadObjectId":"xxxxx",
      "id":"xx:xxxxxxxx"
   },
   "localTimestamp":"2020-02-14T15:21:41.1360000-08:00",
   "channelType":"msteams",
   "from":{ 
      "name":"xxxxxx",
      "id":"xx:xxxxx"
   },
   "type":"message",
   "conversation":{ 
      "conversationType":"personal",
      "tenantId":"xxxxxx",
      "id":"x:xxxxxx"
   }
}```

You need to make sure the card's "type" is "AdaptiveCard" and not "AdaptiveCards" .

 { 
    "fallbackText":"Adaptive card version not supported",
    "type":"AdaptiveCard",
    "body":[ 
       { 
          "text":"Here is an adaptive card with a link to a task module",
          "type":"TextBlock"
       },
       { 
          "type":"Image",
          "url":"http://adaptivecards.io/content/cats/1.png"
       }
    ],
    "version":"1.0",
    "actions":[ 
       { 
          "type":"Action.OpenUrl",
          "title":"Open Link",
          "url":"https://teams.microsoft.com/l/task/xxxxx?url=https%3A%2F%2Fwww.wikipedia.com%0A&height=large&width=large&title=Wikipedia-Embed"
       }
    ]
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM