# slack-primitive-cli
[![Build Status](https://app.travis-ci.com/kurusugawa-computer/slack-primitive-cli.svg?branch=main)](https://app.travis-ci.com/kurusugawa-computer/slack-primitive-cli)
[![PyPI version](https://badge.fury.io/py/slack-primitive-cli.svg)](https://badge.fury.io/py/slack-primitive-cli)
[![Python Versions](https://img.shields.io/pypi/pyversions/slack-primitive-cli.svg)](https://pypi.org/project/slack-primitive-cli/)
`slack-primitive-cli` can execute [Slack web api methods](https://api.slack.com/methods) from command line.
Command line argument is correspont to web api arguments, so `slack-primitive-cli` is **primitive**.
# Requirements
* Python 3.8.1+
# 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.
* [chat.delete](https://api.slack.com/methods/chat.delete)
* [chat.postMessage](https://api.slack.com/methods/chat.postMessage)
* [files.delete](https://api.slack.com/methods/files.delete)
* [files.upload](https://api.slack.com/methods/files.upload)
# Additional
## Shell Completion
`slack-primitive-cli` depends on [click](https://click.palletsprojects.com/en/7.x/), 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](https://click.palletsprojects.com/en/7.x/bashcomplete/) for details.
# Usage for Developer
Refer to https://github.com/kurusugawa-computer/slack-primitive-cli/blob/main/README_for_developer.md .
Raw data
{
"_id": null,
"home_page": "https://github.com/kurusugawa-computer/slack-primitive-cli",
"name": "slack-primitive-cli",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "slack, cli",
"author": "Kurusugawa Computer Inc.",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/1a/a5/660107da0ba5bacb0059d610c1a494facd4518bb54db023c954d107be2b9/slack_primitive_cli-0.3.0.tar.gz",
"platform": null,
"description": "# slack-primitive-cli\n[![Build Status](https://app.travis-ci.com/kurusugawa-computer/slack-primitive-cli.svg?branch=main)](https://app.travis-ci.com/kurusugawa-computer/slack-primitive-cli)\n[![PyPI version](https://badge.fury.io/py/slack-primitive-cli.svg)](https://badge.fury.io/py/slack-primitive-cli)\n[![Python Versions](https://img.shields.io/pypi/pyversions/slack-primitive-cli.svg)](https://pypi.org/project/slack-primitive-cli/)\n\n`slack-primitive-cli` can execute [Slack web api methods](https://api.slack.com/methods) from command line.\nCommand line argument is correspont to web api arguments, so `slack-primitive-cli` is **primitive**.\n\n\n# Requirements\n* Python 3.8.1+\n\n# Install\n\n```\n$ pip install slack-primitive-cli\n```\n\nhttps://pypi.org/project/slack-primitive-cli/\n\n\n# Usage\n\n## Sending a message\n\n```\n$ slackcli chat.postMessage --token xoxb-XXXXXXX --channel \"#random\" --text hello\n\n$ export SLACK_API_TOKEN=xoxb-XXXXXXX\n$ slackcli chat.postMessage --channel \"#random\" --text hello\n```\n\n\n```\n$ slackcli chat.postMessage --help\n\nUsage: slackcli chat.postMessage [OPTIONS]\n\n Sends a message to a channel. See\n https://api.slack.com/methods/chat.postMessage\n\nOptions:\n --token TEXT Authentication token. If not specified, refer\n `SLACK_API_TOKEN` environment variable.\n [required]\n\n --channel TEXT Channel, private group, or IM channel to send\n message to. Can be an encoded ID, or a name. See\n below for more details. [required]\n\n --text TEXT How this field works and whether it is required\n depends on other fields you use in your API call.\n [required]\n\n --as_user BOOLEAN Pass true to post the message as the authed user,\n instead of as a bot.\n\n --attachments TEXT A JSON-based array of structured attachments,\n presented as a URL-encoded string.\n\n --blocks TEXT A JSON-based array of structured blocks,\n presented as a URL-encoded string.\n\n --icon_emoji TEXT Emoji to use as the icon for this message.\n Overrides icon_url. Must be used in conjunction\n with as_user set to false, otherwise ignored. See\n authorship below.\n\n --icon_url TEXT URL to an image to use as the icon for this\n message. Must be used in conjunction with as_user\n set to false, otherwise ignored. See authorship\n below.\n\n --link_names BOOLEAN Find and link channel names and usernames.\n --mrkdwn BOOLEAN Disable Slack markup parsing by setting to false.\n --parse BOOLEAN Change how messages are treated.\n --reply_broadcast BOOLEAN Used in conjunction with thread_ts and indicates\n whether reply should be made visible to everyone\n in the channel or conversation.\n\n --thread_ts TEXT Provide another message's ts value to make this\n message a reply. Avoid using a reply's ts value;\n use its parent instead.\n\n --unfurl_links BOOLEAN Pass true to enable unfurling of primarily text-\n based content.\n\n --unfurl_media BOOLEAN Pass false to disable unfurling of media content.\n --username TEXT Set your bot's user name. Must be used in\n conjunction with as_user set to false, otherwise\n ignored.\n\n --help Show this message and exit.\n\n```\n## Uploading files\n\n```\n$ slackcli files.upload --channels \"#random\" --file foo.txt\n```\n\n```\n$ slackcli files.upload --help\nUsage: slackcli files.upload [OPTIONS]\n\n Uploads or creates a file. See https://api.slack.com/methods/files.upload\n\nOptions:\n --token TEXT Authentication token. If not specified,\n refer `SLACK_API_TOKEN` environment\n variable. [required]\n\n --channels TEXT Comma-separated list of channel names or IDs\n where the file will be shared. [required]\n\n File contents: [mutually_exclusive, required]\n --file TEXT File contents via multipart/form-data. If\n omitting this parameter, you must submit\n content.\n\n --content TEXT File contents via a POST variable. If\n omitting this parameter, you must provide a\n file.\n\n --filename TEXT Filename of file.\n --filetype TEXT A file type identifier. See also\n https://api.slack.com/types/file#file_types\n .\n\n --initial_comment TEXT The message text introducing the file in\n specified channels.\n\n --thread_ts TEXT Provide another message's ts value to upload\n this file as a reply.\n\n --title TEXT Title of file.\n\n```\n\n# Supported web api methods.\n`slack-primitive-cli` supports a few web api methods.\n\n* [chat.delete](https://api.slack.com/methods/chat.delete)\n* [chat.postMessage](https://api.slack.com/methods/chat.postMessage)\n* [files.delete](https://api.slack.com/methods/files.delete)\n* [files.upload](https://api.slack.com/methods/files.upload)\n\n# Additional\n\n## Shell Completion\n`slack-primitive-cli` depends on [click](https://click.palletsprojects.com/en/7.x/), so `slack-primitive-cli` can provide tab completion.\nBash, Zsh, and Fish are supported\n\nIn order to activate shell completion, you need to execute the following script.\n\n```\n$ eval \"$(_SLACKCLI_COMPLETE=source slackcli)\"\n```\n\n\nSee [here](https://click.palletsprojects.com/en/7.x/bashcomplete/) for details.\n\n\n# Usage for Developer\nRefer to https://github.com/kurusugawa-computer/slack-primitive-cli/blob/main/README_for_developer.md .\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Primitive Slack CLI",
"version": "0.3.0",
"project_urls": {
"Homepage": "https://github.com/kurusugawa-computer/slack-primitive-cli",
"Repository": "https://github.com/kurusugawa-computer/slack-primitive-cli"
},
"split_keywords": [
"slack",
" cli"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "85ad540535b69e6ffd3aa7041a58bceb2ddfe685117d763abaaf699927aa9576",
"md5": "ee12d2fd0275656b014ec0dad124723b",
"sha256": "542f30b92a780ad68415ecbae2d2034b6809edd6508171a277ca950da19727c3"
},
"downloads": -1,
"filename": "slack_primitive_cli-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ee12d2fd0275656b014ec0dad124723b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 9037,
"upload_time": "2024-05-13T05:50:22",
"upload_time_iso_8601": "2024-05-13T05:50:22.388876Z",
"url": "https://files.pythonhosted.org/packages/85/ad/540535b69e6ffd3aa7041a58bceb2ddfe685117d763abaaf699927aa9576/slack_primitive_cli-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1aa5660107da0ba5bacb0059d610c1a494facd4518bb54db023c954d107be2b9",
"md5": "d4599da7ddb68350a01f72c72755481b",
"sha256": "fd7156f87c34a1638f08b3c9b7a4278afbe444d261abb0ba88a87cc12301d9cf"
},
"downloads": -1,
"filename": "slack_primitive_cli-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "d4599da7ddb68350a01f72c72755481b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 8314,
"upload_time": "2024-05-13T05:50:23",
"upload_time_iso_8601": "2024-05-13T05:50:23.859853Z",
"url": "https://files.pythonhosted.org/packages/1a/a5/660107da0ba5bacb0059d610c1a494facd4518bb54db023c954d107be2b9/slack_primitive_cli-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-13 05:50:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kurusugawa-computer",
"github_project": "slack-primitive-cli",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"lcname": "slack-primitive-cli"
}