Yet another slack command line interface.
Project description
shlack
shlack is a command line tool which sends slack messages. It is a lot like jarjar but with a few (important?) differences.
Quickstart
First, set up a slack app for shlack and have the oauth API token handy.
Then install shlack to your python 2.7, 3.5, 3.6, or 3.7 environment:
pip install shlack
Or
pip install git+https://github.com/nolanbconaway/shlack.git
Export your slack oauth token:
$ export SLACK_OAUTH_API_TOKEN='...'
Now send yourself a message! shlack will read your token from the variable you exported.
$ shlack message 'Hello!' --channel '@nolan'
In your slack workspace:
Add an attachment:
$ shlack message 'Hello!' -c '@nolan' --attach 'Date' "$(date)"
shlack can also send you a notification after a long-running task has completed.
$ shlack task 'sleep 10 && echo done' --channel '@nolan'
Running that will spin up a process detached from your terminal session, so you can grab some lunch :-).
Need help? Just ask:
$ shlack task --help
Setting up a Slack App
Start by heading over to the apps page and hit the "create new app" button.
Name your app whatever you want (I called mine, shlack
) and assign it to your workspace of choice if you have multiple workspaces. Then hit "create app".
Slack should take you to an app management page. Hit the "Permissions" button (or the "OAuth & Permissions" tab on the sidebar).
Scroll down to the "Scopes" section. Add the following two scopes:
chat:write:bot
. Shlack needs this to post messages.files:write:user
. Shlack needs this to upload files when e.g., your task output is very long.
Hit the "Save Changes" button once those two scopes are selected. Then scroll to the top of the page and hit the "Install App to Workspace" button. Slack will ask you to allow the app to access the scopes you set up.
The page will refresh and at the top you'll find a new OAuth Access Token. Copy that and put it somewhere for later.
Now you can style the app as you see fit :). Hit the "Basic Information" tab at the top of the sidebar and scroll down to the "Display Information" section. Style to your liking. I use this photo which I found by searching "dog with cowboy hat" on the internet.
Then you're done! Enjoy your shlack app.
Todo
- Write some tooling to help users through errors when their display names are not the same as their usernames. Maybe a command to search users. Maybe just some documentation.
- Surface child PID to user in
shlack task
. - get URLs in attachments to unfurl.
- migrate to blocks https://api.slack.com/messaging/attachments-to-blocks
- pypi
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file shlack-0.1.1.tar.gz
.
File metadata
- Download URL: shlack-0.1.1.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d9220f142616d5393e78d01aae04a7d0a50f4de65c8063a5818c5535276efeb |
|
MD5 | dbd8a0431234612f1a525042b80a30fe |
|
BLAKE2b-256 | 48f877513064c4c4274dec5132fd517e8d522c62615f6c7b203c86c9eeda598e |
File details
Details for the file shlack-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: shlack-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8648fdeebf552fab864001f0cd6b5c3c05e6a30ce0b44dc4d43ceea3c548f402 |
|
MD5 | 7341eda0ada7694943ad0772720e2fcc |
|
BLAKE2b-256 | e980add2e6fa7b27a7a4878506a531799b7c648dd515e9451f53c77c4ec0b29f |