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?

Alojz Janez
  • 781
  • 3
  • 7
  • 13

3 Answers3

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!"
Eyal Levin
  • 519
  • 5
  • 15
Juan Kris
  • 241
  • 2
  • 2
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.

d0gb3r7
  • 281
  • 2
  • 5
  • There is a basic client called Yfiton: https://github.com/yfiton/yfiton – Laurent Jan 11 '16 at 20:06
  • 2
    There is also slacktee, which runs from the command line and the only requirement is `curl`: https://github.com/course-hero/slacktee – ltn100 Jul 01 '16 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. – brianpeiris Jul 14 '17 at 10:52
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

jojo
  • 121
  • 4