Ticketing workflow to post to Slack

This how-to article will help Admins (global and/or application) to create a workflow to post details on a record to Slack. The user must have access to the Ticketing application in TDAdmin.

Overview

This article is an example to help you leverage web service step capabilities. Learn more about setting up and using web service steps.

 

By adding a web service step to your workflow, you can have general ticket information sent to a Slack channel whenever a certain action is needed. This example is a very simple post to a Slack channel named Support and includes the ID of the current ticket. EX: a Change ticket is Submitted and you want to notify the CAB team via a Slack channel that a Change ticket was submitted.

 

There are three main steps needed to set up a workflow step to post to Slack:

 

  1. Create a Slack custom web hook integration.
  2. Configure the incoming web hook.
  3. Create a web service method. 

Configuring Slack Incoming Web Hooks 

First, you need to create a Slack custom web hook integration. Do this using the Slack knowledge base article for creating incoming web-hooks: 
https://api.slack.com/incoming-webhooks 

 

Once you complete the above setup, you will have a Web Hook URL which allows you to post messages to a channel. The URL will look like: 
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX  

The web hook is scoped to a specific channel (which you are prompted to choose) by default, but you can choose to override this with a channel property in your JSON (explained later).  

You can also further modify the web hook settings which control the hook name in Slack posts, avatar, etc. These changes are all made in Slack and are not core to getting a post from TDX working. 

 

Configuring the Incoming Web Hook

 

By default, the web hook is scoped to a specific channel which you are prompted to choose, but you can choose to override this with a channel property in your JSON.  

 

You can also further modify the web hook settings which control the hook name in Slack posts, avatar, etc. These changes are all made in Slack and are not critical to getting a post from TDX working. 

Creating the Web Service Method

You now need to create a web service method modeled after the example below.

 

It is important to always quote both property names and values, as Slack is very strict about JSON syntax. 

 

You can put more in the message and include other fields from the ticket, referenced as From Ticket parameters.

 

To create a web service method:

  1. In TDAdmin, click Applications in the left navigation.
  2. Click the Name of the Ticketing application you want to add this workflow step to.
  3. In the left navigation, click Workflows.
  4. On the Ticket Workflows page, click the Workflow name.
  1. Click the View Builder button.
  2. Click the New Step button in the toolbar.
  3. In the New Workflow Step window, enter a Name that indicates what the step will do.
  4. Select the step Type, Web Service from the dropdown.
  5. Select a Stage from the dropdown.
  1. Create a Provider, which is the URL of the Slack Web Hook URL. See the example above. 
  2. Leave the Authentication dropdown blank. No authentication is required to post to Slack Web Hook URLs. 
  3. Method (verb) – POST 
  4. URL – This should be prefilled from the provider URL which is the web hook URL and should not need to be changed. 
  5. Headers – They are: 
    1. Key – content-type 
      Value – application/json 
  6. Parameters –  TicketID – Integer – From Ticket – ID 
  7. Body –  { 
    "text":"Ticket ID {TicketID} started the approval workflow!", 
    "channel":"Support" 
  8. Click the Save button and close the New Step window.

For more details on how to format Slack messages with links and advanced formatting, see the Slack web hook knowledge base article https://api.slack.com/incoming-webhooks.

Details

Article ID: 49705
Created
Tue 3/6/18 8:00 PM
Modified
Wed 6/9/21 4:28 PM