Send notifications to Slack

👍

Webhook plugin is deprecated.

Please use the Automation Rules feature instead, unless you're on the old Targetprocess version (older than Targetprocess v3.13.0) or on a local On-Site installations.

It is possible to get selected alerts from Targetprocess to Slack. This one-way integration is configured using Webhooks plugin of Targetprocess.

📘

Powerful two-way integration between Slack and Targetprocess has not been created so far. We gather ideas, feedback and votes regarging this improvement.

You need Administrator access to Targetprocess to perform this configuration. Follow the steps below to set it up.

Requires Targetprocess 3.8.1+

Step 1: Generate Webhook URL in Slack

First of all, we need to add new Incoming Webhook integration in Main menu > Apps & integrations > Build > Make a Custom Integration in Slack:

1139

Choose the channel and click "Add Incoming WebHooks Integration":

979

Copy generated Webhook URL:

975

Step 2: Create a new Webhook profile in Targetprocess

Create a new profile for the Webhook plugin in Targetprocess at Settings → System Settings → Plugins:

753

Put here Webhook URL from Step 1 (required), check on what modification of which entities you are interested in (required), a filter (optional) and a template (required).

🚧

Please note that 'Use template' box has to be checked, otherwise no template will be send and no Slack message will be created.

697

Here are some options for such webhook profiles to use as examples for your own unique integration.

Basic template

👍

Please consider using the following Automation Rule instead of this webhook.

This basic template can be used in order to receive notifications about created, modified and deleted work items.

on events: Create, Update, Delete
on entities: User Story, Task, Bug, Feature, Epic, Request
{
  "text": "{{EntityTypeName | Remove:'Tp.BusinessObjects.'}} <{{EntityUri}}|{{Name | ToPlainText}}> was {{Modification | Downcase }} by {{AuthorName}}",
  "username": "Targetprocess"
}

Information about changed Effort

👍

Please consider using the following Automation Rule instead of this webhook.

Update UserStory, Task, Bug
ChangedFields.Contains("Effort")
{
 {% if {{Previous.Effort}} == 0 %}
 "text": ":black_circle_for_record: Entity#{{ID}} <{{EntityUri}}|{{Name | ToPlainText}}> was estimated {{Effort}} points by {{AuthorName}}",
 {% elseif {{Effort}} > {{Previous.Effort}} %}
 "text": ":arrow_up: Entity#{{ID}} <{{EntityUri}}|{{Name|ToPlainText}}>. Effort increased from {{Previous.Effort}} to {{Effort}} points by {{AuthorName}}",
 {% else %}
 "text": ":arrow_down: Entity#{{ID}} <{{EntityUri}}|{{Name | ToPlainText}}>. Effort decreased from {{Previous.Effort}} to {{Effort}} points by {{AuthorName}}",
 {% endif %}
 "icon_emoji": ":large_blue_circle:",
 "username": "Targetprocess"
}
907

Information about changed state

👍

Please consider using the following Automation Rule instead of this webhook.

on events: Create, Update
on entities: User Story, Task, Bug, Feature, Epic, Request
EntityStateName != Previous.EntityStateName
{ 
   "text": "Change state for #{{ID}} [{{ProjectName}}] <{{EntityUri}}|{{Name|ToPlainText}}> by {{AuthorName}} [{{Previous.EntityStateName}}] -> [{{EntityStateName}}]",
   "username": "Targetprocess"
}

This block can be embedded as a part of complex template using if / elseif ... endif statements.

A user is assigned to an entity

👍

Please consider using the following Automation Rule instead of this webhook.

Create Assignment
//Don't use any filter if you'd like to post notifications even if the user assigns an entity to himself.

AuthorID != UserID
{
"text": "{{AssignableType | Remove:'Tp.BusinessObjects.'}} <{{EntityUri}}entity/{{AssignableID}}|{{AssignableName | ToPlainText}}> assigned to User:{{UserID}} by {{AuthorName}}",
"icon_emoji": ":robot_face:",
"username": "Targetprocess"
}
341

📘

Available fields

In the filter and template you can use Fields of Assignment resource.

Unfortunately it's not possible to get User Name instead of UserID, but if you have a small team you can enumerate all the users in your team:

Create Assignment
{
{% if {{UserID}} == 1 %}
"text": "{{AssignableType | Remove:'Tp.BusinessObjects.'}} <{{EntityUri}}entity/{{AssignableID}}|{{AssignableName | ToPlainText}}> assigned to User: @julia by {{AuthorName}}",
{% elseif {{UserID}} == 2 %}
"text": "{{AssignableType | Remove:'Tp.BusinessObjects.'}} <{{EntityUri}}entity/{{AssignableID}}|{{AssignableName | ToPlainText}}> assigned to User: @kate by {{AuthorName}}",
{% else %}
"text": "{{AssignableType | Remove:'Tp.BusinessObjects.'}} <{{EntityUri}}entity/{{AssignableID}}|{{AssignableName | ToPlainText}}> assigned to User:{{UserID}} by {{AuthorName}}",
{% endif %}
"icon_emoji": ":robot_face:",
"username": "Targetprocess"
}
475

Comment is added

👍

Please consider using the following Automation Rule instead of this webhook.

It is possible to send notification to Slack when comment is added to an entity. You won't be able to get text of the comment if you subscribe for Entity Modified trigger. Right way is to subscribe for Comment Created trigger instead.

Create Comment
{
  "text": "{{AuthorName}} said: {{Description|ToPlainText}} on {{GeneralType}}#{{GeneralID}} <{{EntityUri}}|{{GeneralName}}>",
  "link_names": 1,
  "username": "targetprocess"
}
{
  "text": "{{AuthorName}} said: {{RawDescription|ToPlainText|Remove:'user:'}} on {{GeneralType}}#{{GeneralID}} <{{EntityUri}}|{{GeneralName}}>",
  "link_names": 1,
  "username": "targetprocess"
}

Markup of messages

Slack messages are part message, part medium. Posting messages means sending not only a bundle of words, but also a series of attributes both describing and containing content. Find detailed guide on how to compose and format messages on Slack API guide.

Message Builder wizard available on Slack API portal helps to test JSON-formatted message templates on the fly, without actual submission of them.

See also