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.5.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

msteams_con-0.0.5-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: msteams_con-0.0.5.tar.gz
  • Upload date:
  • Size: 14.5 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.5.tar.gz
Algorithm Hash digest
SHA256 4d3e46e65c401b507c681f041516457119490e89d406879e195756e0e014bfcf
MD5 b996dc34b09dd45def9f126d2a0f9e7e
BLAKE2b-256 7d121276562ce1cc90cd1055ced10fadf042ca381bd6703a67ed5e3bbcaaf080

See more details on using hashes here.

File details

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

File metadata

  • Download URL: msteams_con-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 20.5 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a8f3384520606098f77ed79a5aace9ecc71a210fb317c027c36c6ecd19cdc0c1
MD5 348c17d3a34f9ef040a96a54de0110b5
BLAKE2b-256 d26962246cc997b7c72762385fe743067f35ee7c65b00b1d8ea70c1510ab18ba

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