Last active
September 16, 2021 10:09
-
-
Save ParthTrambadiya/c91b17b7297c451c6b0845ce5239935c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib3 | |
import json | |
import logging | |
http = urllib3.PoolManager() | |
logger = logging.getLogger() | |
logger.setLevel(logging.INFO) | |
def lambda_handler(event, context): | |
url = "" #add your MS teams webhook URL here | |
message = { | |
"text": event['Records'][0]['Sns']['Message'] | |
} | |
encoded_msg = json.dumps(message).encode('utf-8') | |
response = http.request('POST', url, body=encoded_msg) | |
logger.info('Status Code: {}'.format(response.status)) | |
logger.info('Response: {}'.format(response.data)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment