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
PyPi: https://pypi.tw.martin98.com/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.
Project details
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.5.tar.gz
(6.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file msteamsapi-0.9.5.tar.gz.
File metadata
- Download URL: msteamsapi-0.9.5.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.13.2 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36c488f3ca5f55ed8ea0ccba2e1aae4de22bc03a68f9c58b3d5f37c9940620af
|
|
| MD5 |
5988fb28954567de666ec60ea39179c1
|
|
| BLAKE2b-256 |
098a57a6b37b8d5889a6387e402d7990fb8071514ca17cc5bbe83ad9732223cf
|
File details
Details for the file msteamsapi-0.9.5-py2.py3-none-any.whl.
File metadata
- Download URL: msteamsapi-0.9.5-py2.py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.13.2 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04aab5251b0c047d77c3c192c9b8c15e52d48de040f70d3c40cfdbeec0aca841
|
|
| MD5 |
75e3d6604884f2b32e046411b90f6149
|
|
| BLAKE2b-256 |
b32649ef6eda467ca2ea5089975befd88e3f710e28aed9b8511604ed6a59bd58
|