{"id":14128641,"url":"https://github.com/regisb/slack-cli","last_synced_at":"2025-04-05T23:09:51.824Z","repository":{"id":57468206,"uuid":"54651676","full_name":"regisb/slack-cli","owner":"regisb","description":"Slack CLI for productive developers","archived":false,"fork":false,"pushed_at":"2020-12-15T11:50:24.000Z","size":1776,"stargazers_count":170,"open_issues_count":9,"forks_count":24,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-29T22:09:38.823Z","etag":null,"topics":["cli","productivity","python","slack"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/regisb.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-24T15:13:41.000Z","updated_at":"2023-10-29T10:14:52.000Z","dependencies_parsed_at":"2022-09-19T09:30:51.398Z","dependency_job_id":null,"html_url":"https://github.com/regisb/slack-cli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regisb%2Fslack-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regisb%2Fslack-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regisb%2Fslack-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regisb%2Fslack-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/regisb","download_url":"https://codeload.github.com/regisb/slack-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411235,"owners_count":20934653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","productivity","python","slack"],"created_at":"2024-08-15T16:01:58.795Z","updated_at":"2025-04-05T23:09:51.801Z","avatar_url":"https://github.com/regisb.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"=========\nslack-cli\n=========\n\n⚠️ THIS PROJECT IS IN MAINTENANCE MODE. I have lost interest in Slack -- actually, the less I use Slack the better I feel. Thus I do not have the time nor the energy to make slack-cli compatible with the new Slack authentication mechanism. I will happily review and merge pull requests, though 🙂 If a contributor would like to step forward and start fixing issues, I could then transfer ownership of the project (after they have demonstrated proficiency and integrity).\n\nEffectively interact with `Slack \u003chttps://slack.com/\u003e`_ from the command line: send messages, upload files, send command output, pipe content... all from the confort of your terminal.\n\nMember of dozens of Slack teams? No worries, with ``slack-cli`` you can easily switch from one team to another.\n\n.. image:: https://raw.githubusercontent.com/regisb/slack-cli/master/docs/demo.png\n\nQuickstart\n==========\n\n::\n\n    $ pip install slack-cli\n    $ slack-cli -d general \"Hello everyone!\"\n\n\nYou will be asked to provide a Slack API token. It's easy, check out the `Tokens`_ section for a quickstart.\n\nUsage\n=====\n\n::\n\n    $ slack-cli -h\n    usage: slack-cli [-h] [-t TOKEN] [-T TEAM] [-d DST] [-f FILE] [--pre] [--run]\n                     [-u USER] [-s SRC] [-l LAST]\n                     [messages [messages ...]]\n\n    Send, pipe, upload and receive Slack messages from the CLI\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      -t TOKEN, --token TOKEN\n                            Explicitly specify Slack API token which will be\n                            saved to /home/user/.config/slack-cli/slack_token.\n      -T TEAM, --team TEAM  Team domain to interact with. This is the name that\n                            appears in the Slack url: https://xxx.slack.com. Use\n                            this option to interact with different teams. If\n                            unspecified, default to the team that was last used.\n\n    Send messages:\n      -d DST, --dst DST     Send message to a Slack channel, group or username\n      -f FILE, --file FILE  Upload file\n      --pre                 Send as verbatim `message`\n      --run                 Run the message as a shell command and send both the\n                            message and the command output\n      -u USER, --user USER  Send message not as the current user, but as a bot\n                            with the specified user name\n      messages              Messages to send (messages can also be sent from\n                            standard input)\n\n    Receive messages:\n      -s SRC, --src SRC     Receive messages from a Slack channel, group or\n                            username. This option can be specified multiple times.\n                            When streaming, use 'all' to stream from all sources.\n      -l LAST, --last LAST  Print the last N messages. If this option is not\n                            specified, messages will be streamed from the\n                            requested sources.\n\nSending messages\n----------------\n\nThe destination argument may be any user, group or channel::\n\n    $ slack-cli -d general \"Hello everyone!\"\n    $ slack-cli -d slackbot \"Hello!\"\n\nSend message with a different username::\n\n    $ slack-cli -d general -u terminator \"I'll be back\"\n\nUpdate status\n-------------\n\n::\n\n    $ slack-cli -d general \"/status :office: In the office\"\n    $ slack-cli -d general \"/status :house: At home\"\n    $ slack-cli -d general \"/status Just chillin'\"\n    $ slack-cli -d general \"/status clear\"\n\nPipe content from stdin\n~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n    $ cat /etc/hosts | slack-cli -d devteam\n\nUsually you will want to format piped content as verbatim content with triple backticks (\"\\`\\`\\`\"). This is achieved with the ``--pre`` option::\n\n    $ tail -f /var/log/nginx/access.log | slack-cli -d devteam --pre\n\nUpload file\n~~~~~~~~~~~\n\n::\n\n    $ slack-cli -f /etc/nginx/sites-available/default.conf -d alice\n\nRun command and send output\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis is really convenient for showing both the result of a command and the command itself::\n\n    $ slack-cli -d john --run \"git log -1\"\n\nwill send to user ``john``::\n\n    $ git log -1\n    commit 013798f5c85043d31f0221a9a32b39298e97fb08\n    Author: Régis Behmo \u003cregis@behmo.com\u003e\n    Date:   Thu Jun 22 15:20:36 2017 +0200\n\n        Replace all commands by a single command\n\n        Our first 1.0 release!\n\nReceiving messages\n------------------\n\nStream to stdout\n~~~~~~~~~~~~~~~~\n\nStream the content of a channel::\n\n    $ slack-cli -s general\n\nMonitor all conversations::\n\n    $ slack-cli -s all\n\nDump (backup) the content of a channel\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n    $ slack-cli -s general --last 10000 \u003e general.log\n    $ slack-cli -s myboss --last 10000 \u003e covermyass.log\n\nAuthentication\n--------------\n\nSwitch to a different team\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nSwitch to a different team anytime with the ``-T`` flag::\n\n    $ slack-cli -T family -d general \"I'll be home in an hour\"\n\nThe new team will become the new default team.\n\nToken management\n~~~~~~~~~~~~~~~~\n\nNote that the Slack token may optionally be stored in an environment variable (although it is not recommended `for security reasons \u003chttps://unix.stackexchange.com/questions/369566/why-is-passing-the-secrets-via-environmental-variables-considered-extremely-ins\u003e`_)::\n\n    $ export SLACK_TOKEN=\"slack_token_string\"\n\nThe ``slack-cli`` configuration is stored in a generic configuration directory -- by default, this is ~/.config/slack-cli on Linux. You can check the path of this directory by running::\n\n    python3 -c \"from slackcli.token import CONFIG_ROOT; print(CONFIG_ROOT)\"\n\nThis directory can be modified by setting the ``SLACK_CLI_CONFIG_ROOT`` environment variable. For instance::\n\n    export SLACK_CLI_CONFIG_ROOT=~/slackcli\n\nBells and Whistles ᕕ(⌐■_■)ᕗ ♪♬\n------------------------------\n\nAutocomplete\n~~~~~~~~~~~~\n\nChannel, group and user names can be autocompleted from the command line for `bash` users. Add the following line to `~/.bashrc`::\n\n    eval \"$(register-python-argcomplete slack-cli)\"\n\nThen, try autocompletion with::\n\n    $ slack -s gene\u003ctab\u003e\n\nor::\n\n    $ slack -d \u003ctab\u003e\u003ctab\u003e\n\nUnfortunately, I did not manage to get autocompletion to work with ``zsh`` ¯\\\\_( ͡° ͜ʖ ͡°)_/¯ Please let me know if you have more success.\n\nColors\n~~~~~~\n\nColor output is activated by default in compatible terminals. To deactivate colors, define the ``SLACK_CLI_NO_COLOR`` environment variable::\n\n    export SLACK_CLI_NO_COLORS=1\n\nEmojis\n~~~~~~\n\nEmoji short codes will be automatically replaced by their corresponding unicode value. For instance, ``:smile:`` will become 😄. However, **these characters will display properly only if your terminal supports them!** I stronly encourage you to download patched fonts from `Nerd Fonts \u003chttps://nerdfonts.com/\u003e`_ and to configure your terminal to use them. For instance, in Ubuntu this is how I downloaded the DejaVuSansMono fonts::\n\n    wget -O ~/.fonts/DejaVuSansMono.zip https://github.com/ryanoasis/nerd-fonts/releases/download/v2.0.0/DejaVuSansMono.zip\n    cd ~/.fonts\n    unzip DejaVuSansMono.zip\n    fc-cache -vf ~/.fonts\n\nIf emojis are not your thing, you can disable them globally with the ``SLACK_CLI_NO_EMOJI`` environment variable::\n\n    export SLACK_CLI_NO_EMOJI=1\n\nTokens\n~~~~~~\n\nTo generate a token, create a `new Slack App \u003chttps://api.slack.com/apps/new\u003e`__ and add it to your workspace.\n\nGrant API Permissions to your App, select all that apply (you probably want \"chat:write\"):\n\n.. figure:: https://raw.githubusercontent.com/regisb/slack-cli/master/docs/permissions.gif\n   :alt: Create App and add OAuth Scopes\n\n\nThis is an example of how it could look like:\n\n.. figure:: https://raw.githubusercontent.com/regisb/slack-cli/master/docs/scope_example.png\n   :alt: Example scopes\n\nNow hit the green ``Install App to workspace`` button, and you will be presented with a token you can use for authentication.\n\n.. figure:: https://raw.githubusercontent.com/regisb/slack-cli/master/docs/token.png\n   :alt: OAuth Access Token\n\n\nDevelopment\n-----------\n\nContributions\n~~~~~~~~~~~~~\n\nI am very much open to comments! Please don't be afraid to `raise issues \u003chttps://github.com/regisb/slack-cli/issues\u003e`_ or `open pull requests \u003chttps://github.com/regisb/slack-cli/pulls\u003e`_.\n\nThis work is licensed under the terms of the `MIT License \u003chttps://tldrlegal.com/license/mit-license\u003e`_\n\nNote that this project was initially a fork of `slacker-cli \u003chttps://github.com/juanpabloaj/slacker-cli/\u003e`_ but the two projects have now considerably diverged.\n\nTests\n~~~~~\n\nInstall the development requirements::\n    \n    pip install -e .[development]\n\nRun all tests::\n    \n    make test\n\nFormat your code with `black \u003chttps://black.readthedocs.io/en/stable/\u003e`__::\n\n    make format\n\nUpdate emojis\n~~~~~~~~~~~~~\n\n::\n\n    python -c \"from slackcli.emoji import Emojis; Emojis.download()\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fregisb%2Fslack-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fregisb%2Fslack-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fregisb%2Fslack-cli/lists"}