Created
February 27, 2017 13:36
-
-
Save zyouyowa/ddf3c912d7b4f153618b54aaf92edf2f to your computer and use it in GitHub Desktop.
Slack APIのchat.postMessageでBotに任意の発言をさせる
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
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