...
This Universal Extension creates a Slack Bot that provides the capability to directly interact with Universal Controller, by executing Slack Commands.
Version Information
Template Name | Extension Name | Extension Version |
---|---|---|
Slack Bot | ue-slack-bot | 1.0.0 |
Refer to Changelog for version history information.
...
This Universal Extension provides Slack Commands that let's a user gain information about reports, agents and task instances, or even alter the latter. These commands are the following:
Area of Interest | Available Commands |
---|---|
Tasks and Instances | Rerun a Task Instance. |
Tasks and Instances | Hold a Task Instance. |
Tasks and Instances | Force Finish/Cancel a Task Instance. |
Tasks and Instances | Show Task Instances for specific filter parameters. |
Tasks and Instances | Show Late Task Instance with certain parameters. |
Tasks and Instances | Retrieve the output of a Task Instance. |
Tasks and Instances | Retrieve detailed information about a task instance. |
Tasks and Instances | Schedule an ad-hoc run of a task instance by enabling a trigger. |
Agents | Show the status of all available Universal agents |
Reports | Show a Report. |
Additionally, this extension provides the following features:
...
Step 1: Introduction of the Slack Bot to the users is done at the setup phase, where the Slack Bot greets the channel users with a small and informative message, guiding them on the next actions they could take.
Step 2: The help menu is available to the users whenever they need a list of available commands, from which they can even trigger the corresponding popup dialog (help menu is available though command /uacbot help).
Step 3: Triggering a Slack command from a popup dialog is helpful, as the dialog provides guidance on the available parameters and their values.
Step 4: Slack Bot command results are provided in-channel, with simple and informative messages.
Import Universal Template
...
- Navigate to "Basic Information" (navigation bar on the left).
- Scroll down to the "Display Information" section.
- Upload the icon provided here:
Configure a slack channel
...
The input fields for this Universal Extension are described below.
Field | Input type | Default value | Type | Description |
---|---|---|---|---|
Slack Bot token | Required | - | Credentials | The Slack bot token as obtained from Slack App. It is used to connect Slack Application with a Workspace. The Credentials definition should be as follows:
|
Slack App token | Required | - | Credentials | The Slack app token obtained from Slack App. It is used to connect the Slack Bot with the corresponding Slack App. The Credentials definition should be as follows:
|
Slack Channel ID | Required | - | Text | The Slack channel ID that the bot will connect. to. |
ACL | Required | - | Script | The JSON script that contains the ACL rules for your Slack. users. |
Universal Controller URL | Required | - | Text | The URL of the target UC (e.g. http://ue.stonebranch.org:8080/uc) |
Universal Controller Credentials | Required | - | Credentials | This extension uses RESTful Web Services API as a client, and in this field the corresponding username & password should be provided. This user should have Web Service Access enabled (directly or through System Default). It is strongly advised not to reuse admin or any existing user but create a new one used only for this specific integration. The Universal Controller Credentials definition should be as follows:
|
UC REST API Timeout | Required | 20 | Text | The timeout (in seconds) that the Slack Bot will wait for UC to respond. If the UC won't respond in the specified time limit Slack will display a corresponding error to the user. |
Auditing | Optional | True | Checkbox | A variable that if selected the bot will provide auditing logs. |
ACL
ACL (Access Control List) is responsible for granting or denying permissions to your Slack users, on accessing specific functionality & resources on UC, through Slack commands. The access rights granted can be fine-grained, using rules that describe the explicit access right for a specific user, providing his e-mail local part(what everything is included before @ symbol) on a specific resource type and the corresponding action on that resource.
...
The ACL configuration is based on UC Scripts (of type Data Script), and more specifically expressed with JSON format. It is expected to be consisted of rules for each user, where each rule has the following fields:
Key | Description |
---|---|
resource | Whether a command is related to instances, agents or reports. Can be equal to "*" to refer to all available resources. |
action | Available actions that can be performed in a resource. Can be equal to "*" to refer to all available resources. |
permission | Whether the permission of the combination of specified action and resource is allowed or forbidden. |
ACL Rules to Slack Command Mapping
Command | Resource | Action |
---|---|---|
rerun task instance | instance | instance.rerun |
hold task instance | instance | instance.hold |
force finish task instance | instance | instance.finish |
schedule ad hoc run | instance | instance.schedule |
get task instances | instance | instance.query |
get late tasks | instance | instance.query |
get task instance output | instance | instance.query |
get task instance info | instance | instance.query |
get agents | agent | agent.query |
run report | report | report.run |
Usage Examples
The order in which the rules are provided is essential. The first rule has the most priority whereas the last rule is the lowest priority.
...
Example of UE Slack Bot Universal Task for starting the execution of the Slack Bot.
Task Output
Since this universal task is designed to operate endlessly, task output is provided only in case of an error in initialization phase or during task instance cancel.
...
The output only fields for this Universal Extension provide operational information of the Slack Bot and are described below.
Field | Type | Description |
---|---|---|
Total Requests Handled | Text | The total request slack bot has handled since starting |
Total Requests Succeeded | Text | The total request slack bot has returned a successful response |
Total Requests Failed | Text | The total request slack bot has returned a failed response |
Total Validation Errors | Text | The sum of validation errors that slack bot raised |
Total Permission Errors | Text | The sum of permission errors that slack bot raised |
STDOUT and STDERR
STDOUT and STDERR provide additional information to the user. The populated content can be changed in future versions of this extension without notice. Backward compatibility is not guaranteed.
...
Command Name: rerun task instance
Parameters | Description | Values and Constraints | Required | Default |
---|---|---|---|---|
id | sys_id used within the Universal Controller to identify this task instance | Same with Universal Controller | True | - |
Command Examples
/uacbot rerun task instance id:'<some_valid_id>'
...
Command Name: hold task instance
Parameters | Description | Values and Constraints | Required | Default |
---|---|---|---|---|
id | sys_id used within the Universal Controller to identify this task instance | Same with Universal Controller | True | - |
Command Examples
/uacbot hold task instance id:'<some_valid_id>'
...
Command Name: force finish task instance
Parameters | Description | Values and Constraints | Required | Default |
---|---|---|---|---|
id | The identifier of the task instance to be force finished or canceled. | Same with Universal Controller | True | - |
halt | If set to True it prevents successor task instances of the specified task instance id in a Workflow from being run. | True / False | False | False |
cancel | If set to True cancels the task instances. | True / False | False | False |
Command Examples
/uacbot force finish task instance id:'<some_valid_id>' halt: 'true'
...
Command Name: get task instances
Parameters | Description | Values and Constraints | Required | Default |
---|---|---|---|---|
name | The name of the task instances. This field also accepts wildcards "?" or "*". | Max 255 length string (case insensitive). | False | - |
type | Filter the tasks being queried, by task type attribute. | Valid Universal Controller task types (case insensitive). | False | - |
status | Filter the tasks being queried, by task status attribute. | Valid Universal Controller statuses (case insensitive). | False | - |
lastupdated | Filter instances that have been updated in the last X hours/minutes. | Timestamps in hours or minutes format, e.g 1h, 20m. | False | - |
show | Filter to fetch all instances or only the last updated instances that match the rest of the input fields. | Latest / All | False | All |
Command Examples
- Fetch the latest task instances that contain "slack" in their name of type Linux with statuses Finish and Success that have been last updated in the past two days.
...
Command Name: get late tasks
Parameters | Description | Values and Constraints | Required | Default |
---|---|---|---|---|
name | The name of the task instances. This field also accepts wildcards "?" or "*". | Max 255 length string (case insensitive). | True | - |
lastupdated | Filter instances that have been updated in the last X hours/minutes. | Timestamps in day, month or minutes format, e.g. 1h, 20m. | False | 24h |
type | Filter tasks based on available late time options. | Late start / Late finish / Early finish / All | False | Late Start |
Command Examples
- Fetch task instances that contain "slack" in their name that have been last updated in the past two days and have late type of either late start, late finish or early finish.
...
Command Name: get task instance output
Parameters | Description | Values and Constraints | Required | Default |
---|---|---|---|---|
instance | The id of the task instance to be retrieved. | Max 255 length string (case insensitive) or valid Universal Controller sys_id format. | True | - |
outputtype | Retrieve instance output by type. | Long list of values, including: STDOUT, STDERR, EXTENSION. Full list of values is available in popup drop-down list. | False | STDOUT |
length | Number of lines to fetch from the outputtype. | Positive integer | False | 20 |
fetchfrom | Fetch the output logs from the start or from the end. | Start / End | False | Start |
Command Examples
- Fetch last twenty lines of the newest active instance that matches the name slack-bot.
...
Command Name: get task instance info
Parameters | Description | Values and Constraints | Required | Default |
---|---|---|---|---|
instance | The name or the id of the task instance to be retrieved. | Max 255 length string (case insensitive) or valid Universal Controller sys_id format. | True | - |
criteria | The last updated criteria of the task instance. Mandatory when the query is made with task name. | Newest Instance, Oldest Instance, Newest Active Instance, Oldest Active Instance. | False | Newest Instance |
Command Examples
/uacbot get task instance info instance:'<slack-bot>' criteria:'Oldest Instance'
...
Command Name: schedule ad hoc run
Parameters | Description | Values and Constraints | Required | Default |
---|---|---|---|---|
triggername | The name of the triggered to be created. | Max 255 length string (case insensitive) | True | - |
taskname | The task name to be binded with the created trigger triggername. | Max 255 length string (case insensitive) | True | - |
date | The date which the taskname will be run. | YYYY-mm-dd format | True | Current date |
time | The date which the taskname will be run. In combination with date filed it must be after current time. | HH:MM format | True | Current time + 1 minutes |
timezone | the timezone of the specified time. | UTC-12 to UTC+14 | True | UTC |
Command Examples
/uacbot schedule ad hoc run triggername:'<valid_trigger_name>' taskname:'<valid_task_name>' date:'YYY-mm-dd' time:'HH:MM' timezone: 'UTC'
...
Command Usage
Command Name: get agents
Parameters | Description | Values and Constraints | Required | Default |
---|---|---|---|---|
name | The name of the agent to be retrieved. This field also accepts wildcards | Max 255 length string (case insensitive) | False | - |
os | Filter based on the operating system the agent is based on. | Windows, Linux, z/OS (case insensitive) | False | - |
version | Filter based on agent version. | Valid Universal Controller version format | False | - |
status | Filter based on agent status. | Active / Offline (case insensitive) | False | - |
suspended | Filter agents that are temporarily suspended. | True/False | False | - |
groupby | Filter to control the grouping of the output message. | A value of all previous available fields. | False | Operating System |
Command Examples
- List and groupby os all active, non-suspended agents which run linux operating system and 7.2 UC version with a specified name.
...
Command Usage
Command Name: get agents
Parameters | Description | Values and Constraints | Required | Default |
---|---|---|---|---|
name | The name of the report to be retrieved. | Max 255 length string (case insensitive) | True | - |
Command Examples
/uacbot get agents name:'<valid_report_name>'
...
This document references the following documents.
Document Link | Description |
---|---|
Universal Templates | User documentation for creating, working with and understanding Universal Templates and Integrations. |
Universal Tasks | User documentation for creating Universal Tasks in the Universal Controller user interface. |
Slack Bot API | User guide for Slack Bot API. |
Changelog
ue-slack-bot-1.0.0 (YYY-MM-DD)
...