Document toolboxDocument toolbox

Slack: Send and Receive Notifications and Approvals

Disclaimer

Your use of this download is governed by Stonebranch’s Terms of Use, which are available at  Stonebranch Integration Hub - Terms of Use.

Overview

This Universal Task sends job status notifications to a Slack channel. It also enables users to send interactive messages in Slack for Universal Controller manual task approvals.

  • Notifies users of job failure, late start/run, and other important events via a Slack channel.

  • Approval in Slack for Manual task type – users simply click on an approval button in Slack message to run manual tasks to success in Universal Controller, triggering continuation of workflow execution.

  • Quick reaction time on job failures.

  • Manual task interruptions in workflows can be handled by the concerned applications/business teams, while workflows in Universal Controller can be resumed simply by responding to the approval message in Slack. 

Version Information

Template NameVersion

SLACK-NOTIFY

1.2.0

Software Requirements

This integration requires a Universal Agent and a Python runtime to execute the Universal Task against a Slack account with an Incoming webbook enabled for a job notification. Also, in order to cater the approval functionality from Slack for a manual task type in Universal Controller, you will need to have an Interactivity enabled in Slack with the request URL which will be used to send the HTTP POST request for interactive messages by Slack.

Software Requirements for Universal Template and Universal Task

This integration requires a Universal Agent and a Python runtime to execute the Universal Task against.

  • Requires Python 3.6 or higher. Tested with the Universal Agent bundled Python distribution.

  • Python modules required:

    • requests

Software Requirements for Universal Agent

Either:

  • Universal Agent for Windows x64 Version 7.1.0.0 and later with Python options installed

  • Universal Agent for Linux Version 7.1.0.0 and later with Python options installed

Software Requirements for Universal Controller

  • Universal Controller Version 7.1.0.0 and later

Software Requirements for the Application to be Scheduled

The task can be used against any of your Slack account or workspace that is of either free or standard or plus or enterprise grid

Technical Considerations

The request URL provided in Slack could be an endpoint either in AWS lambda or Azure Function, GCP function, or your custom API endpoint to handle the interactive message from Slack and advise Universal Controller on approval or rejection of the manual task.

Below is the sample Python code that could be invoked for the Slack interactive message handling

Steps to Activate Incoming Webbooks

  • Go to your browser and provide the URL: https://api.slack.com/apps/.

  • Select or create an application that would be appropriate for sending Universal Controller notifications.

  • Click on Incoming webhooks on the left menu and activate Incoming webhooks as below.

The URL generated here will be used in the Universal Task for posting message to slack platform


Slack Notification Key Features

Feature

Description

Job Notification

This feature can be used to send any job notification to a slack channel; for example, a job failure, Job long-running, or Job held.

Approval Notification

Typically, Manual task types in Universal Controller are used, when there is a user manual intervention needed in a workflow task type and the Manual Task is completed successfully in Universal Controller by clicking on to the manual task command “Set Completed” traditionally.

Now this task for Slack can notify Slack channel when the manual task reaches the status: “Action Required” and the User in Slack can simply click on the approve/Reject Button in the Slack interactive message that was sent by Universal Controller and then the manual task in the workflow can either go to success if approved or wait in the same status if rejected


Import Universal Template

To use the Universal Template, you first must perform the following steps.

  1. This Universal Task requires the Resolvable Credentials feature. Check that the Resolvable Credentials Permitted system property has been set to true.

  2. To import the Universal Template into your Controller, follow these instructions.

  3. When the files have been imported successfully, refresh the Universal Templates list; the Universal Template will appear on the list.

Configure Slack Notification Universal Task

For the new Universal Task type, create a new task, and enter the task-specific details that were created in the Universal Template.

Field Descriptions for Slack Notification Universal Task

Field

Description

Slack Function

Approval Notification  (ideal to associate with manual tasks)

Job Name

Name of the job :${ops_task_name}

Job Status

Status of the job:${ops_status}

Slack Incoming Webhook

Incoming webhook URL for your Slack account

Execution User

Execution User of the Manual Task:${ops_execution_user}

Job type

Task type of task instance: ${ops_task_type}

MessageLarge text to pass any message from UAC task execution or any custom info to Slack notifications

Examples of Slack Notification Universal Tasks

Send a Job Status Notification to slack (Task defintion)


Send a Job Status Notification to Slack (Task Instance)

Calling a Slack Job Status Notification through Action → System Operations and Launch Task

(Also this could be made generic for a group of jobs or all jobs by calling the Slack notification job from the Task monitor job.)

Slack Notifications for UAC Job Status

Approval Notification defined in Manual Task Actions ==>System Operations

Send an Approval Notification to Slack

Approval Message in Slack


Document References

This document references the following documents:

Name

Description

Universal Templates

User documentation for creating Universal Templates in the Universal Controller user interface.

Universal Tasks

User documentation for creating Universal Tasks in the Universal Controller user interface.

Changelog

ut-slack-notifications-1.2.0 (2023-04-24)

Enhancements

  • Introduced a new field name called Message (large textbox) for sending additional messages to slack channels as notifications

  • Color codes in Slack messages for different UAC job status