Skip to content

Instantly share code, notes, and snippets.

@zyouyowa
Created February 27, 2017 13:36
Show Gist options
  • Save zyouyowa/ddf3c912d7b4f153618b54aaf92edf2f to your computer and use it in GitHub Desktop.
Save zyouyowa/ddf3c912d7b4f153618b54aaf92edf2f to your computer and use it in GitHub Desktop.
Slack APIのchat.postMessageでBotに任意の発言をさせる
import requests
url = 'https://slack.com/api/'
token = 'Slack Bot API Token'
def postMessage(msg, channel):
arguments = {
'token': token,
'channel': channel,
'text': msg
}
res = requests.post(url + 'chat.postMessage', arguments)
print(res.json())
if __name__ == '__main__':
postMessage('test', 'test')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment