Skip to main content

setSlackTarget

A Workflow Engine function that sets the target Slack channel and title for a message payload. Before you use this function, you must set up the Sack Incoming Webhook in the Slack integration.

You can use this function to build that message payload to send to Slack channels.

This function is available as a feature of the Add-ons v2.1 download and later. See Install Moogsoft Add-ons for information on how to upgrade.

This function is available for alert and Situation workflows.

Back to Workflow Engine Functions Reference.

Arguments

Workflow Engine function setSlackTarget has no arguments.

Workflow Engine function setSlackTarget takes the following arguments:

Name

Required

Type

Description

slackChannel

Yes

String

The target Slack channel.

title

No

String

Message that to send to the specified Slack channel. Can be static text and/or Macros.

Example

The following example demonstrates typical use of Workflow Engine function setSlackTarget.

You want to message payload will be built using integration configuration for the Slack channel called aiopstesting and override the default title with your own. Set the following:

  • channel: aiopstesting

  • title: $EXPAND(internal_priority) level Situation - $(description)

The UI translates your settings to the following JSON:

{"slackChannel":"aiopstesting","title":"$EXPAND(internal_priority) level Situation - $(description)"}

If you do not define a title, then this function will use the default that is set under the target channel's integration configuration for the alert or Situation.

The function forwards the alert or Situation once the message payload is successfuly build. Otherwise, the function returns false if it cannot successfully build the message payload.