Skip to main content

Slack Plugin

SlackPlugin

This plugin implements functions for sending messages via Slack.

Installation and settings

Install the NuGet package:

Add the following namespaces to the usings section:

using OptimaJet.Workflow.Plugins;

Create a plugin object and arrange the required Settings:

var slackPlugin = new SlackPlugin();

// Here are your settings

// slackPlugin.Token = "Token";
// slackPlugin.NameParameterForSaveRequestResult = "SlackRequestResult";
// slackPlugin.ThrowExeptionIfNotSended = true;
// slackPlugin.SaveRequestResult = true;

Connect the plugin to the WorkflowRuntime:

var runtime = new WorkflowRuntime();
...
runtime.WithPlugin(slackPlugin);

Settings

Token

String: a parameter for access to Slack.

Used for SlackSendMessage.

NameParameterForSaveRequestResult

String: the name of the parameter, where the request result is stored.

Used for SlackSendMessage.

ThrowExceptionIfNotSended

Boolean: the flag for an exception to be thrown in case of a sending error: if true - the exception will be thrown; if false - the error will be skipped.

Default value: true

Used for SlackSendMessage.

SaveRequestResult

Boolean: the flag for storage the request result: if true - the result will be stored in the parameter; if false - the result won't be stored.

Default value: true

Used for SlackSendMessage.

Actions

Read about actions.

SlackSendMessage

Sends a message.

Parameters:

Token : String *

A parameter for access to Slack.

The value is taken from Token, if specified there.

Channel : String *

A channel to send the message to.

Message : String *

A string that contains the message body.

ThrowExeptionIfNotSended : Boolean *

The flag for an exception to be thrown in case of a sending error: if true - the exception will be thrown; if false - the error will be skipped.

Default value: true

The value is taken from ThrowExceptionIfNotSended, if specified there.

SaveRequestResult : Boolean *

The flag for storage the request result: if true - the result will be stored in the parameter; if false - the result won't be stored.

Default value: true

The value is taken from SaveRequestResult, if specified there.

NameParameterForSaveRequestResult : String *

The name of the parameter, where the request result will be stored.

The value is taken from NameParameterForSaveRequestResult, if specified there.