Skip to content

Instantly share code, notes, and snippets.

@SibeeshVenu
Created October 1, 2022 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SibeeshVenu/f7262bb8a22c7e84041e16b3f71df7f7 to your computer and use it in GitHub Desktop.
Save SibeeshVenu/f7262bb8a22c7e84041e16b3f71df7f7 to your computer and use it in GitHub Desktop.
Send message to Microsoft Teams channel
import asyncio
import pymsteams
loop = asyncio.get_event_loop()
def notify_to_teams(message: str, web_hook_url: str, web_hook_name: str):
'''This function will notify the message in the Teams channel'''
my_teams_message = pymsteams.async_connectorcard(web_hook_url)
my_teams_message.title(web_hook_name)
my_teams_message.text(message)
# to send the message, pass to the event loop
loop.run_until_complete(my_teams_message.send())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment