msteams-connector is a Python-based tool to simplify the process of sending messages, adaptive card to Microsoft Teams channels via incoming webhooks. Whether you’re automating release notifications, error alerts, or general messages, this connector provides a seamless interface for working with Microsoft Teams.
Project description
msteams-connector
Microsoft Teams connector for sending messages to Teams channels via webhooks.
Overview
msteams-connector is a Python-based tool to simplify the process of sending messages, adaptive card to Microsoft Teams channels via incoming webhooks. Whether you’re automating release notifications, error alerts, or general messages, this connector provides a seamless interface for working with Microsoft Teams.
Prerequisites
Get MSTeams Webhook
Before using this package, you will need to obtain an MS Teams webhook URL. Follow the instructions in the Microsoft Teams Documentation to create a new incoming webhook in your MS Teams channel.
Installation
pip install msteams-con
Usage
Example Code
from msteams_con import *
import os
hook_url = os.environ["MSTEAMS_WEBHOOK"]
msteams = MSTeamsConnector(hook_url)
payload = msteams.generate_text_payload("Hello, World!")
msteams.send_payload(payload)
CLI
Send with our release card template
msteams-connector send_release_card --version <software-release-version> --hook_url <your_webhook_url>
Send with single text
msteams-connector send_text --text "hello world" --hook_url <your_webhook_url>
Developer Setup
If you want to contribute or modify the code, follow these steps to set up the project locally:
git clone https://github.com/cloud-bees/msteams-connector.git
cd msteams-connector
export PYTHONPATH=$(pwd)/src
export MSTEAMS_WEBHOOK=<your_webhook_url>
pip install -e ".[dev]"
Running Tests
Pytest
pytest tests/msteams_con -v -s --log-cli-level=DEBUG
You also can run pytest in Vscode Debug, Note need to add WEBHOOK into .vscode/launch.json
ruff
ruff check --fix
ruff format
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
Built Distribution
File details
Details for the file msteams_con-0.0.6.tar.gz
.
File metadata
- Download URL: msteams_con-0.0.6.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9734094272a2bacb53bef3e660a8ee79672c85c3d34767717114354b3d59e63e |
|
MD5 | 481d6d96f397291521cb159eea1a16e2 |
|
BLAKE2b-256 | bf4d0b9c6dd4e801cf9daf27da46ec603970ed2c4656059392d84e806a3ec3b4 |
File details
Details for the file msteams_con-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: msteams_con-0.0.6-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd7bed40f5f588f70931693e8fa308beab4847ed69bcf065a39e4efc26112b10 |
|
MD5 | dd8717bdae278459293a4f07b2666044 |
|
BLAKE2b-256 | 5faeba5a0b9b19f534a764e1183eeb2f63a696731b9af361b039de1a1bd26f0f |