slack-send
1.1.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package slack-send --version 1.1.1
NuGet\Install-Package slack-send -Version 1.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="slack-send" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add slack-send --version 1.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: slack-send, 1.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install slack-send as a Cake Addin #addin nuget:?package=slack-send&version=1.1.1 // Install slack-send as a Cake Tool #tool nuget:?package=slack-send&version=1.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
slack-send
A simple utility to send a Slack message using Slack Web API to your channels
Usage
slack-send --help
-h, --help (Default: false) Prints this help message.
-c, --channels (Default: empty) Slack channels to send message, separated by ';', default is empty, which means use the channels in the configuration file.
-d, --desc (Default: empty) description on the top of the message
-t, --title (Default: empty) title to send
-m, --message Required. message to send
-s, --status (Default: good) Status good | warning | error, default is good
-j, --json (Default: empty) JSON formated Slack message (https://api.slack.com/reference/messaging/attachments), it overrides the message and status options, if those values exist on JSON.
--help Display this help screen.
--version Display version information.
Example
slack-send -m <message> -c <channel>
# slack-send -m "Hello, My Slack Channel!" -c "#general"
or
slack-send -m <message> -c <channel1>;<channel2> ...
# slack-send -m "Hello, My Slack Channel!" -c "#general;#random"
or
slack-send -d <description> -t <title> -m <message> -c <channel1>;<channel2> ...
# slack-send -d "This is a description" -t "This is a title" -m "Hello, My Slack Channel!" -c "#general;#random"
or
slack-send -d <description> -t <title> -m <message> -c <channel1>;<channel2> ... -j <json_string>
# slack-send -d "This is a description" -t "This is a title" -m "Hello, My Slack Channel!" -c "#general;#random" -j "{\"color\":\"#36a64f\",\"pretext\":\"Optional pre-text that appears above the attachment block\",\"author_name\":\"author_name\",\"author_link\":\"https://flickr.com/bobby/\",\"author_icon\":\"https://placeimg.com/16/16/people\",\"title\":\"title\",\"title_link\":\"https://api.slack.com/\",\"text\":\"Optional `text` that appears within the attachment\",\"fields\":[{\"title\":\"A field's title\",\"value\":\"This field's value\",\"short\":false},{\"title\":\"A short field's title\",\"value\":\"A short field's value\",\"short\":true},{\"title\":\"A second short field's title\",\"value\":\"A second short field's value\",\"short\":true}],\"thumb_url\":\"https://placekitten.com/g/200/200\",\"footer\":\"footer\",\"footer_icon\":\"https://platform.slack-edge.com/img/default_application_icon.png\",\"ts\":123456789}"
Pre-requisites
- Create a
- Create a configuration file
slack-send.json
in the same directory as theslack-send
executable. - Then run ./slack-send -m "Hello, My Slack Channel!" -c "#general"
slack-send.json
You can also use a configuration file to set the default values for the message, channel, and attachments.
- The configuration file should be named
slack-send.json
and should be in the same directory as theslack-send
executable. - The configuration file should be in JSON format.
- The configuration file should have the following keys:
ApiToken
: Your Slack API Key for a bot, typically starts with 'xoxb-'.ApiUrl
: The Slack API URL for sending messages.Channels
: An array of channel names to send the message to.Attachments
: An array of attachments to send with the message. The format of the attachments is the same as the JSON format for attachments in the Slack API.
{
"ApiToken": "<your Slack API Key for a bot, typically starts with 'xoxb-'>",
"ApiUrl": "https://slack.com/api/chat.postMessage",
"Channels": [ "<your channel #1>", "<your channel #2>" ],
"Attachments": [
{
"author_name": "<your sender name, i.e. GitHub Actions>",
"author_icon": "https://github.com/fluidicon.png"
}
]
}
'Attachments' JSON Format
https://api.slack.com/reference/messaging/attachments
Example:
{
"channel": "ABCDEBF1",
"attachments":
[
{
"mrkdwn_in": ["text"],
"color": "#36a64f",
"pretext": "Optional pre-text that appears above the attachment block",
"author_name": "author_name",
"author_link": "https://flickr.com/bobby/",
"author_icon": "https://placeimg.com/16/16/people",
"title": "title",
"title_link": "https://api.slack.com/",
"text": "Optional `text` that appears within the attachment",
"fields":
[
{
"title": "A field's title",
"value": "This field's value",
"short": false
},
{
"title": "A short field's title",
"value": "A short field's value",
"short": true
},
{
"title": "A second short field's title",
"value": "A second short field's value",
"short": true
}
],
"thumb_url": "https://placekitten.com/g/200/200",
"footer": "footer",
"footer_icon": "https://platform.slack-edge.com/img/default_application_icon.png",
"ts": 123456789
}
]
}
Reference
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- CommandLineParser (>= 2.9.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.