Set of utility functions for sending files and plots from python directly to slack.
- You need to install requirements. From the
send-to-slack
directory run:python -m pip install -r requirements.txt
- You need to create a slack app at https://api.slack.com/apps, add it to your workspace, set the app's permissions so it can send files and add it to the channels you want to use it in.
- You need to set the environemental variable
SLACK_BOT_TOKEN
to the token you obtain from https://api.slack.com/apps > Your App > OAuth & Permissions. The token should look like something likexoxb-1234567891011-1213141516171-AbCDEFGhijklmnOPQRSTuVWx
- Then you can import the library in your project and use it like
from send_to_slack.send import send_file file_path = "C:/Temp/test_file.txt" channel = "#general" send_file(file_path=file_path, channel=channel)