Skip to content

Instantly share code, notes, and snippets.

@TakesxiSximada
Created July 3, 2015 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TakesxiSximada/6b27627f9dc524b32646 to your computer and use it in GitHub Desktop.
Save TakesxiSximada/6b27627f9dc524b32646 to your computer and use it in GitHub Desktop.
post to slack
#! /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