Skip to main content

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.

Python MSTeams PyPI PyPI - Downloads

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
pip install -e ".[dev]"

Running Tests

Pytest

export PYTHONPATH=$(pwd)/src
export MSTEAMS_WEBHOOK=<your_webhook_url>
pytest tests -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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

msteams_con-0.0.4.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

msteams_con-0.0.4-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file msteams_con-0.0.4.tar.gz.

File metadata

  • Download URL: msteams_con-0.0.4.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for msteams_con-0.0.4.tar.gz
Algorithm Hash digest
SHA256 2f075ed101262af39be620e69fa4a2644aab31078d19d78f2cb48503bbffbd34
MD5 fabf90ce6d0d840e6e88d260ceee079d
BLAKE2b-256 db238c89b40536917017f5180134fd149fcbca26f31db766ce66a9298bd95dc2

See more details on using hashes here.

File details

Details for the file msteams_con-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: msteams_con-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for msteams_con-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 51e547420d5d7b3f0ce6c58cca02abb55b488da99c6ed636b2d12b33b77832dd
MD5 cfd7d9fe44fe5a13f2880ef850a7b1f5
BLAKE2b-256 6781d268f6fca91cd0473e42a724316389295485f1b79d66d62e47b99dd4f481

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page