Last active
August 29, 2015 14:23
-
-
Save satoshi03/9e1148db4477eabb9733 to your computer and use it in GitHub Desktop.
Slackにincoming webhook経由でpythonからメッセージをPOSTする ref: http://qiita.com/satoshi03/items/14495bf431b1932cb90b
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 slackweb | |
> slack = slackweb.Slack(url="<コピーしたURL>") | |
> slack.notify(text="This is a test.") |
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
> slack.notify(text="This is a *test*.", channel="#coffee", username="coffee-bot", icon_emoji=":coffee", mrkdwn=True) |
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
> attachments = [] | |
> attachment = {"title": "Sushi", | |
"pretext": "Sushi _includes_ gunkanmaki", | |
"text": "Eating *right now!*", | |
"mrkdwn_in": ["text", "pretext"]} | |
> attachments.append(attachment) | |
> slack.notify(attachments=attachments) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment