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: you need to add WEBHOOK into .vscode/launch.json and set Python Interpreter

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: msteams_con-0.0.8.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.8.tar.gz
Algorithm Hash digest
SHA256 b53f72a7a78f8a684bc82a9faa48254e94d6ed0f0267288cee9daac2a1ba63d9
MD5 61f0e56041c7c2bf8b0b47bef2a3a56c
BLAKE2b-256 0a4fc6dcdd598ec4e8b5d806ee918551359a1f72f208528747b52ca5f982cd31

See more details on using hashes here.

File details

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

File metadata

  • Download URL: msteams_con-0.0.8-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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 12c4d930adcd8ea334ad69c7c1c543d17789bb2424ebbc9fc43cac81d9f4b8ff
MD5 3f4fbe6d137f62cf2f58bd18ebf64be8
BLAKE2b-256 4bc060e19df7d94deb5eb65bd55df63a576892b5c9019af0ee123583f9a7a74b

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