Microsoft Teams AdaptiveCards API Wrapper for Python 2 and 3
Project description
Microsoft Teams AdaptiveCards API Wrapper for Python 2 and 3
Repository: https://github.com/ALERTua/msteamsapi
Usage
pip install msteamsapi
- Get a Workflow Webhook URL for your MSTeams non-private(!) channel using the standard template.
- Use the Webhook URL to instantiate
TeamsWebhook
class. - Fill the
TeamsWebhook
withAdaptiveCard
. - Fill the
AdaptiveCard
withContainer
. - Fill the
Container
withFactSet
,TextBlock
, etc. send()
theTeamsWebhook
instance.
Example from tests/test_suite.py:
from msteamsapi import TeamsWebhook, AdaptiveCard, Container, FactSet, ContainerStyle, TextWeight, TextSize
webhook = TeamsWebhook('your_webhook_url')
card = AdaptiveCard(title='card title', title_style=ContainerStyle.DEFAULT)
container = Container(style=ContainerStyle.DEFAULT)
card.mention('EMAIL', 'NAME', add_text_block=True)
mention_tag = card.mention('EMAIL', 'mention text')
container.add_text_block(
'multiline\n\ntext\n\nmention 1: %s' % mention_tag,
size=TextSize.DEFAULT, weight=TextWeight.DEFAULT, color="default")
factset = FactSet(('fact 1', 'fact 1 value'))
factset.add_facts(('fact 2', 'fact 2 value'), ('fact 3', 'fact 3 value'))
container.add_fact_set(factset)
card.add_container(container)
for i, url in enumerate(['https://google.com/', 'https://goo.gle']):
card.add_url_button('url %s' % i, url)
webhook.add_cards(card)
webhook.send()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
msteamsapi-0.9.2.tar.gz
(4.9 kB
view hashes)
Built Distribution
Close
Hashes for msteamsapi-0.9.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bfa969682aabab817ef2a6892c5025fc0b5a3f556ea94cbfc2a4555e32ab65a |
|
MD5 | 19f1999e9544c6b646e3386382fc32ab |
|
BLAKE2b-256 | 289e3a1377fb61eb64efb6c0c8dc171d9583b9c1258c7b46b016d92176ec8a50 |