Small utility library to report last state of any long-running process to Slack.
Supports:
- .NET Standard 1.1
- .NET 4.5
- .NET 4.0
Just add a nuget package into your project:
PS> Install-Package SlackReporting
First you should initialize a SlackReporter
object:
var options = new SlackReporterOptions
{
AccessToken = "YOUR_SLACK_ACCESS_TOKEN",
Channel = "CHANNEL_OR_USERNAME", // e.g. "#my-test-channel" or "#my_user_name"
};
var reporter = options.CreateReporter();
After that you may post a new message with initial status text:
using(var message = reporter.BeginMessage("Initial status test"))
{
// ...
}
This will post a message into Slack. This message can be updated:
message.Update("Updated status text");
Once you dispose an instance of SlackMessage
the status message will be deleted. Set SlackReporterOptions.DeleteMessageAfterwards
to false
to disable message deletion.
Please note that you can use any ordinary Slack markup within both initial and updated statuses.
Additinally you may set bot's user name and icon via SlackReporterOptions.Username
and SlackReporterOptions.Icon
properties.
Run build.ps1
in your terminal:
./build.ps1
This command will produce nuget packages and put then into /artifacts
directory.
This project is licensed under MIT License.