From a260c318af9655f71f3fbf1917b195f51b634308 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Thu, 19 Dec 2024 13:58:39 +0100 Subject: [PATCH] Feed chat webhook prototype --- feed_chat_webhook/__main__.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 feed_chat_webhook/__main__.py diff --git a/feed_chat_webhook/__main__.py b/feed_chat_webhook/__main__.py new file mode 100644 index 0000000..6b58081 --- /dev/null +++ b/feed_chat_webhook/__main__.py @@ -0,0 +1,21 @@ +from json import dumps +import requests +import secrets_loader + +secrets = secrets_loader.SecretsLoader() + +WEBHOOK_URL = secrets.load_or_fail('WEBHOOK_URL') + +def main(): + """Google Chat incoming webhook quickstart.""" + app_message = {"text": "Hello from a Python script!"} + message_headers = {"Content-Type": "application/json; charset=UTF-8"} + response = requests.post( + WEBHOOK_URL, + headers=message_headers, + json=app_message, + ) + print(response) + +if __name__ == '__main__': + main()