slack-cli-0.1.1 is not a library.
Slack CLI
This is a CLI tool for sending messages to Slack channels. It supports sending text messages, blocks, and attachments using the Slack API.
Installation
Make sure the SLACK_TOKEN environment variable is set with your Slack bot token.
via cargo install
via source
- Clone the repository.
- Install dependencies and compile the code using
cargo build --release. - cargo run -p slack-cli
Usage
General Command
Commands
slack send <message>
Send a message to a Slack channel.
Arguments
--channel(-c) - The Slack channel to send the message to. Accepts either the channel name (e.g.,#general) or the channel ID.--kind(-k) - The type of message to send. Options are:text- A simple text message.block- A message with block elements (provide a JSON object).attachment- A message with attachments (provide a JSON object).
<message>- The content of the message. Forblockorattachment, provide a valid JSON object.
Example Usage
Send a text message:
Send a block message:
Send an attachment message:
Environment Variables
SLACK_TOKEN: Required. The token for authenticating with the Slack API. Set this in your environment or use a.envfile for local development.
Error Handling
Ensure that all required options are provided and that the SLACK_TOKEN environment variable is set. The CLI will display meaningful error messages if these requirements are not met.