Skip to content

Instantly share code, notes, and snippets.

@voidabhi
Created February 14, 2016 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voidabhi/d799d2cce39dcc580ad3 to your computer and use it in GitHub Desktop.
Save voidabhi/d799d2cce39dcc580ad3 to your computer and use it in GitHub Desktop.
Slack snippets in python
def post_message(token, channel, text, username):
'''
Sending a message(text) as username to channel
'''
params = {
"token": token,
"channel": channel,
"text": text,
"username": username,
}
return requests.post("{}/{}".format('https://slack.com/api', 'chat.postMessage'), data=params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment