Skip to content

Instantly share code, notes, and snippets.

@Teebor-Choka
Created December 29, 2022 13:22
Show Gist options
  • Save Teebor-Choka/1d99d438d57af0680266cb33117b5c44 to your computer and use it in GitHub Desktop.
Save Teebor-Choka/1d99d438d57af0680266cb33117b5c44 to your computer and use it in GitHub Desktop.
Publish to Google Chat
#!/usr/bin/env python3
from json import dumps
import os
from httplib2 import Http
def main():
url = os.environ["GOOGLE_CHAT_URL"]
bot_message = {
'text': 'REPLACE WITH YOUR TEXT.'
}
message_headers = {'Content-Type': 'application/json; charset=UTF-8'}
http_obj = Http()
response = http_obj.request(
uri=url,
method='POST',
headers=message_headers,
body=dumps(bot_message),
)
print(response)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment