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
export PYTHONPATH=$(pwd)
export MSTEAMS_WEBHOOK=<your_webhook_url>
pip install -e ".[dev]"

Running Tests

Pytest

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

Uploaded Source

Built Distribution

msteams_con-0.0.7-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: msteams_con-0.0.7.tar.gz
  • Upload date:
  • Size: 20.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.7.tar.gz
Algorithm Hash digest
SHA256 4938298f8a1102eb1e7e6b1041b2571385e1b74f7f4ea64114be1f82115063d5
MD5 76311b02d610aa8305987e421cfa5694
BLAKE2b-256 79a26972e12d543af98afdde1a4fabede24de11b29cb238afcd54804fbd18e89

See more details on using hashes here.

File details

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

File metadata

  • Download URL: msteams_con-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 20.0 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ba6089b3e4cb9ccba1613dd6200141bfcc88a02ad93dc8b4395bffc270e826b7
MD5 33901a4d714d7a9d6d2a8ff07d90c95c
BLAKE2b-256 6d3608183c9833031e759a63643b7f55a2bd877da5e71d550057d988f9a7e7c5

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