slack

Version, currently 0.3.02 versions

github.com/maiha/slack.cr

Simple CLI client to Slack API

0 stars
0 dependents
License: MIT

Nothing has been indexed for 0.3.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  slack:
    github: maiha/slack.cr
    version: ~> 0.3.0

Then run:

shards install

shard.yml

No shard.yml has been indexed for 0.3.0. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

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

  • https://github.com/aki017/slack-api-docs

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

  1. Fork it (https://github.com/maiha/slack.cr/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • maiha - creator and maintainer