Skip to main content

slack-primitive-cli

Build Status PyPI version Python Versions

slack-primitive-cli can execute Slack web api methods from command line. Command line argument is correspont to web api arguments, so slack-primitive-cli is primitive.

Requirements

  • Python 3.12+

Install

$ pip install slack-primitive-cli

https://pypi.org/project/slack-primitive-cli/

Usage

Sending a message

$ slackcli chat.postMessage --token xoxb-XXXXXXX --channel "#random" --text hello

$ export SLACK_API_TOKEN=xoxb-XXXXXXX
$ slackcli chat.postMessage  --channel "#random" --text hello
$ slackcli chat.postMessage --help

Usage: slackcli chat.postMessage [OPTIONS]

  Sends a message to a channel. See
  https://api.slack.com/methods/chat.postMessage

Options:
  --token TEXT               Authentication token. If not specified, refer
                             `SLACK_API_TOKEN` environment variable.
                             [required]

  --channel TEXT             Channel, private group, or IM channel to send
                             message to. Can be an encoded ID, or a name. See
                             below for more details.  [required]

  --text TEXT                How this field works and whether it is required
                             depends on other fields you use in your API call.
                             [required]

  --as_user BOOLEAN          Pass true to post the message as the authed user,
                             instead of as a bot.

  --attachments TEXT         A JSON-based array of structured attachments,
                             presented as a URL-encoded string.

  --blocks TEXT              A JSON-based array of structured blocks,
                             presented as a URL-encoded string.

  --icon_emoji TEXT          Emoji to use as the icon for this message.
                             Overrides icon_url. Must be used in conjunction
                             with as_user set to false, otherwise ignored. See
                             authorship below.

  --icon_url TEXT            URL to an image to use as the icon for this
                             message. Must be used in conjunction with as_user
                             set to false, otherwise ignored. See authorship
                             below.

  --link_names BOOLEAN       Find and link channel names and usernames.
  --mrkdwn BOOLEAN           Disable Slack markup parsing by setting to false.
  --parse BOOLEAN            Change how messages are treated.
  --reply_broadcast BOOLEAN  Used in conjunction with thread_ts and indicates
                             whether reply should be made visible to everyone
                             in the channel or conversation.

  --thread_ts TEXT           Provide another message's ts value to make this
                             message a reply. Avoid using a reply's ts value;
                             use its parent instead.

  --unfurl_links BOOLEAN     Pass true to enable unfurling of primarily text-
                             based content.

  --unfurl_media BOOLEAN     Pass false to disable unfurling of media content.
  --username TEXT            Set your bot's user name. Must be used in
                             conjunction with as_user set to false, otherwise
                             ignored.

  --help                     Show this message and exit.

Uploading files

$ slackcli files.upload --channels "#random" --file foo.txt
$ slackcli files.upload  --help
Usage: slackcli files.upload [OPTIONS]

  Uploads or creates a file. See https://api.slack.com/methods/files.upload

Options:
  --token TEXT                    Authentication token. If not specified,
                                  refer `SLACK_API_TOKEN` environment
                                  variable.  [required]

  --channels TEXT                 Comma-separated list of channel names or IDs
                                  where the file will be shared.  [required]

  File contents: [mutually_exclusive, required]
    --file TEXT                   File contents via multipart/form-data. If
                                  omitting this parameter, you must submit
                                  content.

    --content TEXT                File contents via a POST variable. If
                                  omitting this parameter, you must provide a
                                  file.

  --filename TEXT                 Filename of file.
  --filetype TEXT                 A file type identifier. See also
                                  https://api.slack.com/types/file#file_types
                                  .

  --initial_comment TEXT          The message text introducing the file in
                                  specified channels.

  --thread_ts TEXT                Provide another message's ts value to upload
                                  this file as a reply.

  --title TEXT                    Title of file.

Supported web api methods.

slack-primitive-cli supports a few web api methods.

Additional

Shell Completion

slack-primitive-cli depends on click, so slack-primitive-cli can provide tab completion. Bash, Zsh, and Fish are supported

In order to activate shell completion, you need to execute the following script.

$ eval "$(_SLACKCLI_COMPLETE=source slackcli)"

See here for details.

Usage for Developer

Refer to https://github.com/kurusugawa-computer/slack-primitive-cli/blob/main/README_for_developer.md .

Metadata

Release files for slack-primitive-cli 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slack-primitive-cli 0.3.1
File Size Uploaded Provenance Actions
slack_primitive_cli-0.3.1.tar.gz 44.1 kB Without provenance Details for slack_primitive_cli-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for slack-primitive-cli 0.3.1
File Interpreter ABI Platform Actions
slack_primitive_cli-0.3.1-py3-none-any.whl Python 3 none any Details for slack_primitive_cli-0.3.1-py3-none-any.whl

Total release size: 53.1 kB

Release files / slack_primitive_cli-0.3.1.tar.gz

Download URL slack_primitive_cli-0.3.1.tar.gz
Size 44.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6ba21e0207154005092276a86f8ddea588c708f9459cacbfa48567f23cc61705
BLAKE2b-256 checksum
How to use checksums
95b48a8e7fa644dcad1ce9c25d787513834a22fd659516926c8de0f40b7a4e58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / slack_primitive_cli-0.3.1-py3-none-any.whl

Download URL slack_primitive_cli-0.3.1-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65caea57ebcaa057c238eedc3c5eeadf8663795dccabbeef5152b6ffc09d5df5
BLAKE2b-256 checksum
How to use checksums
776e037342f4b11f1ef3767a495610593db7920e09f643061c2e11f7403ddae9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for slack-primitive-cli 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page