slack.cr
Simple CLI client to Slack API
$ slack-cli users.profile.get | jq .profile.email
"maiha@wota.jp"
$ slack-cli users.lookupByEmail -d email=maiha@wota.jp | jq .user.name
"maiha"
Usage
usage: slack-cli [options...] <api> [<args>]
API Execution
If you want to call the users.profile.get
API, just type it in!
$ slack-cli users.profile.get
API parameters can be specified by -d <key>=<val>
option.
For example, users.lookupByEmail
API needs email
parameter.
$ slack-cli users.lookupByEmail -d email=maiha@wota.jp
{"ok":true,"user":{"name":"maiha","id":...
API Information
How do you know the parameters of the API? Well, just add the -h
!
$ slack-cli users.lookupByEmail -h
users.lookupByEmail (Find a user with an email address.)
Argument Example Required Description
-------- ----------------------- -------- -------------------------------------------
email spengler@ghostbuster... Required An email address belonging to a user in ...
All API lists can be retrieved with the --ls
option. Also, that list is filtered by ARG1.
$ slack-cli --ls
admin.apps.approve
admin.apps.approved.list
...
$ slack-cli --ls users.list
admin.users.list
usergroups.users.list
API Token
You can specify the API TOKEN in one of the following ways.
- by arg:
slack-cli --token XXXXX ...
- by env:
SLACK_TOKEN=XXXXX slack-cli ...
API Catalog
slack-cli maintains a catalog of API information. The catalog is bundled with slack-cli and can only be executed with APIs registered in it. The original data for API information uses the following
If you want to use a new API that doesn't exist in the built-in catalog, you can specify the latest catalog information in the directory.
$ git clone --depth 1 https://github.com/aki017/slack-api-docs.git
$ slack-cli -c slack-api-docs/methods ...
Development
See README.cr.md
Contributing
- Fork it (https://github.com/maiha/slack.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- maiha - creator and maintainer