| Crates.io | slack-cli |
| lib.rs | slack-cli |
| version | 0.1.1 |
| created_at | 2024-12-18 23:37:21.206267+00 |
| updated_at | 2024-12-19 01:31:29.600389+00 |
| description | slack cli Project homepage: https://github.com/isaacadams/slack-api-client |
| homepage | https://github.com/isaacadams/slack-api-client |
| repository | https://github.com/isaacadams/slack-api-client |
| max_upload_size | |
| id | 1488598 |
| size | 52,325 |
This is a CLI tool for sending messages to Slack channels. It supports sending text messages, blocks, and attachments using the Slack API.
Make sure the SLACK_TOKEN environment variable is set with your Slack bot token.
export SLACK_TOKEN=xoxb-your-slack-bot-token
cargo install slack-cli
slack --help
cargo build --release.slack <COMMAND> [OPTIONS]
slack send <message>Send a message to a Slack channel.
--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. For block or attachment, provide a valid JSON object.Send a text message:
slack send --channel general --kind text "Hello, Slack!"
slack send --channel=#general --kind text "Hello, Slack!"
slack send --channel "#general" --kind text "Hello, Slack!"
Send a block message:
slack send --channel general --kind block '[{"type": "section", "text": {"type": "mrkdwn", "text": "*Hello, Slack!*"}}]'
Send an attachment message:
slack send --channel general --kind attachment '[{"color":"#f2c744","blocks":[{"type":"section","text":{"type":"mrkdwn","text":"*Hello, Slack!*"}}]}]'
SLACK_TOKEN: Required. The token for authenticating with the Slack API. Set this in your environment or use a .env file for local development.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.