Python lib to move from ConnectorCards to AdaptiveCards in MS Teams As O365 Connectors will be deprecated, new usage is via Workflows/Power Automate
Documentation and Examples are available at GitHub
This lib is available in PyPi, you can install it via pip:
pip install PyMsTeamsAdaptiveCard
python import pyadaptivecard
To get your connector url, you must create a flow in Workflows/Power Automate.
Trigger to choose is When a Teams webhook request is received
If you used O365 connectors without authentication, you must set Anyone
as Who can trigger the flow?
Usage with this library is to create an action Apply to each
, select attachments
(dynamic content) as input.
Link with the action Post card in a chat or channel
As opposed to previous Connectors that only existed in Teams Channels, you can publish your cards in Group Chats as well.
You must fill the following fields:
Adaptive Card: items('Apply_to_each_2')?['content']
(replace with the name of your action)
Summary: items('Apply_to_each_2')?['summary']
(replace with the name of your action)
After saving, Workflows/Power Automate will give you your HTTP POST URL
:
You can refer to the examples for usage of AdaptiveCard, CardSection and ActivitySection All outputs are displayed as images Example of a Multi Section Card:
instead of printing the contents of the cards, just do card.send()
and check the result of your workflow!
You can add your proxy by setting it to the card
card.proxy("https://my.proxy:8080")