Skip to main content

msteams-connector is a Python-based tool to simplify the

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

Uploaded Source

Built Distribution

msteams_con-0.0.3-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: msteams_con-0.0.3.tar.gz
  • Upload date:
  • Size: 13.8 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.3.tar.gz
Algorithm Hash digest
SHA256 16b9e96ba95a8faaadc9e79425561bb41ca2c76207c12a5d6a057e76cad7091a
MD5 ae2b98e9c7314c79c19eb8c54ac1e0b0
BLAKE2b-256 c90928ae7438a71521c65f0c13afc596376bdf7af94cc55816e3bebab391d35c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: msteams_con-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 18.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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 84d446433502fc25fe01ec227d9e5674137188b6e1c99d76425adbc9fcc4df52
MD5 cb615d0cbc3157cf4c2c88b5ff95361c
BLAKE2b-256 720ae2c5951fd2bf1e13bc131702d8fe5a70da42bd570a9f04a6f879c60e9cfa

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