slack_cli 0.0.1 slack_cli: ^0.0.1 copied to clipboard
Simple CLI to send Slack messages
slack_cli #
Simple CLI to call Slack API and send messages.
slack_cli post -t xoxb-xxx \
-c channel-name \
-m "Hello world"
Supported commands:
post
- sends a message to Slack channelupdate
- updates the CLI
Getting Started 🚀 #
Activate globally from pub.dev via:
dart pub global activate slack_cli
Or locally via:
dart pub global activate --source=path <path to this package>
Posting messages #
The post
command allows to send messages to desired Slack channel. Before you use this CLI, you need to create Slack app and get bot token. See this official manual for more details. Once you have the token (it starts with xoxb-
), you can use it to send messages to Slack channels.
slack_cli post --token <token> --channel <channel> --message <message> --blocks <blocks>
Examples #
slack_cli post -t xoxb-xxx \
-c builds \
-m "Build 1234 finished" \
-b "[header=App build 1234 :white_check_mark:][fields=Commit \`93f5a0f\`=Branch \`main\`][text=*Changelog*\n - *General*: Audio of objects falling at night increased by 33% <https://google.com|EU-2137>\n - All instruments have been replaced with Chipi Chipi Chapa Chapa <https://google.com|EU-997>][text=*Artifacts*][button=Android APK url=http://google.com title=:arrow_down: Download][button=iOS IPA url=http://google.com title=:arrow_down: Download][context=Build run on Oct 10, 2024]"
Supported blocks #
Blocks to send to the channel, each block has its own type and formatting.
Special characters used as delimiters: [ ] =
[text=This is simple text with *markdown* support and <http://google.com|links>]
[header=This is the header]
[divider]
[img=https://assets3.thrillist.com/v1/image/1682388/size/tl-horizontal_main.jpg title=required title]
[fields=Text fields _use_ *markdown*=and are separated with=equal sign]
[button=Text on the left side url=http://pub.dev title=Button title] - all properties required
[context=This is _tiny_ message shown below]',
Special thanks #
This project uses block classes from slack_notifier.