Microsoft Teams AdaptiveCards API Wrapper for Python 2 and 3
Repository: https://github.com/ALERTua/msteamsapi
PyPi: https://pypi.org/project/msteamsapi/
Usage
pip install msteamsapi- Get a Workflow Webhook URL for your MSTeams non-private(!) channel using the standard template
Post to a channel when a webhook request is received. - Use the Webhook URL to instantiate
TeamsWebhookclass. - Fill the
TeamsWebhookwithAdaptiveCard. - Fill the
AdaptiveCardwithContainer. - Fill the
ContainerwithFactSet,TextBlock, etc. send()theTeamsWebhookinstance.
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)
card.add_background(url="https://github.com/ALERTua/msteamsapi/raw/main/tests/background.png")
container = Container(style=ContainerStyle.DEFAULT)
card.mention('EMAIL', 'NAME', add_text_block=True)
mention_tag = card.mention('EMAIL', 'mention text')
container.add_image("image url", "image alt text")
container.add_text_block(
'multiline\n\ntext\n\nmention 1: %s' % mention_tag,
size=TextSize.DEFAULT, weight=TextWeight.DEFAULT, color="default", wrap=True
)
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()
Your contribution is appreciated.
Metadata
Release files for msteamsapi 0.9.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| msteamsapi-0.9.5.tar.gz | 6.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| msteamsapi-0.9.5-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 14.0 kB
Release files / msteamsapi-0.9.5.tar.gz
| Download URL | msteamsapi-0.9.5.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36c488f3ca5f55ed8ea0ccba2e1aae4de22bc03a68f9c58b3d5f37c9940620af
|
|
BLAKE2b-256 checksum How to use checksums |
098a57a6b37b8d5889a6387e402d7990fb8071514ca17cc5bbe83ad9732223cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.13.2 Windows/11
|
Release files / msteamsapi-0.9.5-py2.py3-none-any.whl
| Download URL | msteamsapi-0.9.5-py2.py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
04aab5251b0c047d77c3c192c9b8c15e52d48de040f70d3c40cfdbeec0aca841
|
|
BLAKE2b-256 checksum How to use checksums |
b32649ef6eda467ca2ea5089975befd88e3f710e28aed9b8511604ed6a59bd58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.13.2 Windows/11
|