Created
July 3, 2015 09:45
-
-
Save TakesxiSximada/6b27627f9dc524b32646 to your computer and use it in GitHub Desktop.
post to slack
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
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import json | |
import requests | |
url = 'INCOMING WEB HOOK URL' | |
data = { | |
'channel': '#channel', | |
'icon_emoji': ':baby_chick:', | |
'username': u'username', | |
'attachments': [{ | |
"title": "titletitletitle", | |
"title_link": "http://", | |
"fallback": "fallback - text (smartphone, irc client etc)", | |
"pretext": "head text", | |
"color": "#AAAAAA", | |
}], | |
} | |
payload = json.dumps(data) | |
res = requests.post(url, payload) | |
print(res.status_code) | |
print(res.reason) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment