Skip to content

Instantly share code, notes, and snippets.

@vvksh
Created December 30, 2020 01:02
Show Gist options
  • Save vvksh/fbdad20413f9b871de5c84a2a04d76a3 to your computer and use it in GitHub Desktop.
Save vvksh/fbdad20413f9b871de5c84a2a04d76a3 to your computer and use it in GitHub Desktop.
def send_slack(something:str, channel:str) -> int:
"""
Sends message to slack channel
:param something: message
:param channel: channel to post
:return: response code
"""
data = {
'text': something,
'icon_emoji': ':robot_face:',
'channel': channel
}
response: Response = requests.post(os.getenv("WEBHOOK_URL"),
data=json.dumps(data),
headers={'Content-Type': 'application/json'})
print('Response: ' + str(response.text))
return response.status_code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment