Last active
December 5, 2018 10:37
-
-
Save mooose/aae0e7d8929f2dd529910e69005ffba7 to your computer and use it in GitHub Desktop.
Sending a simple message from python to Hangout Chat Group
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
WEBHOOK_URL = <URL of Hangout Chat Group to push a message to> | |
from google.appengine.api import urlfetch | |
import urllib | |
def hangoutAlert(message): | |
"""hangoutAlert | |
send a message to hangoutAlert via Hangout Chat Alerts Group | |
""" | |
bot_message = urllib.urlencode({'text' : message }) | |
message_headers = { 'Content-Type': 'application/json; charset=UTF-8'} | |
urlfetch.fetch(url=WEBHOOK_URL, method=2, payload=bot_message, headers=message_headers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment