Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created November 27, 2017 00:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miguelmota/8b8c9ec4a03634f0f02363959f2c83eb to your computer and use it in GitHub Desktop.
Save miguelmota/8b8c9ec4a03634f0f02363959f2c83eb to your computer and use it in GitHub Desktop.
Slack post message in Python
import requests
token = 'xoxp-abc'
channel = 'some-channel'
text = 'hello'
bot_name = 'Bot'
payload = data = {'token': token, 'channel': channel, 'text': text, 'username': bot_name}
r = requests.post('https://slack.com/api/chat.postMessage', payload)
print(r.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment