We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e60a473 commit d0f3fcdCopy full SHA for d0f3fcd
slack_message.py
@@ -0,0 +1,15 @@
1
+# Created by sarathkaul on 11/11/19
2
+
3
+import json
4
+import requests
5
6
+# Set the webhook_url to the one provided by Slack when you create the webhook at https://my.slack.com/services/new/incoming-webhook/
7
+webhook_url = 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'
8
+slack_data = {'text': "Hi Sarath Kaul"}
9
10
+response = requests.post(webhook_url, data=json.dumps(slack_data),headers={'Content-Type': 'application/json'})
11
+if response.status_code != 200:
12
+ raise ValueError(
13
+ 'Request to slack returned an error %s, the response is:\n%s'
14
+ % (response.status_code, response.text)
15
+ )
0 commit comments