51

I am a user of slack https://slack.com/

I think the desktop client is useful, but sometimes I am working on servers. There is also a browser interface and android and iPhone Clients. My objective is to read and write messages form a command line, for example inside a server environment.

So is there a command line interface frontend for slack?

1

3 Answers 3

13

There is no full-fledged command line interface that I know of, but there is an API, so in principle anybody could start writing one. Slackcat is a first step in that direction.

A potential alternative approach might be installing a text-mode IRC or XMPP client on your servers, and using the Slack/IRC/XMPP gateway.

EDIT/UPDATE: This answer is clearly outdated now – see the comments and other answers.

3
  • There is a basic client called Yfiton: github.com/yfiton/yfiton
    – Laurent
    Jan 11, 2016 at 20:06
  • 2
    There is also slacktee, which runs from the command line and the only requirement is curl: github.com/course-hero/slacktee
    – ltn100
    Jul 1, 2016 at 10:47
  • 2
    If you're just looking to send a simple message, you're probably better off using Slack's incoming webhook and curl. No cli necessary. Jul 14, 2017 at 10:52
24

I use this one. Try https://github.com/candrholdings/slack-cli

To install, type

npm install -g slack-cli

To send a message,

slackcli -t <Slack token> -g <Slack group name> -m "Hello, World!"

To send a file,

slackcli -t <Slack token> -g <Slack group name> -f <File name>

To send from standard input,

cat anyFile.txt | slackcli -t <Slack token> -g <Slack group name> -c

You can even set the token as environment variable.

SET SLACK_TOKEN=<Slack token>
slackcli -g yourGroupName -m "Hello, World!"
2
  • 1
    Does this support attachments?
    – Michael
    Oct 21, 2016 at 2:27
  • 1
    Tokens are disabled now by slack because they recommend slack apps or webhooks for security reasons I'm guessing. So this answer no longer works :( Apr 16, 2021 at 23:28
2

Here's Slacker, a CLI for Slack using PHP. You'll need your own Slack api token and adjust the configs: https://github.com/TidalLabs/Slacker

1

Not the answer you're looking for? Browse other questions tagged .