I will summarize the procedure from python to posting to slack. This is useful for notifying the completion of time-consuming processing and information during execution (errors, etc.).
--Set up Incoming Webhook in slack --Post from python to the URL of the Incoming Webhook
Go to the Incoming Webhook Settings page (https://my.slack.com/services/new/incoming-webhook/) Select the channel you want to post to and click "Add Incoming WebHooks Integration"
Copy the webhook URL
Click "Save Settings"
Install slackweb to easily implement POST
#Install if pip is not installed
$ sudo easy_install pip
#Install slack web
$ sudo pip install slackweb
postToSlack.py
#coding: UTF-8
import slackweb
slack = slackweb.Slack(url="URL of the copied webhook")
slack.notify(text="From python to slack")
Run python script
$ python postToSlack.py
Check the posted results
Recommended Posts