How-to: Integrate Slack
Integrate Slack with HCL DevOps Deploy (Deploy) to post notifications automatically to your Slack app whenever a specific deployment event happens.
About this task
Walk through a scenario and learn how to push messages to Slack when an application process fails to deploy in Deploy.
In this example, you'll learn about the requirements and procedure to integrate Slack with Deploy. To integrate Slack with Deploy, follow the steps provided in this section:Step 1: Create an incoming webhook app in Slack
Procedure
- Go to api.slack.com and click Create an App.
- Provide an App Name and choose an appropriate workspace.
- After you create the app, go to Incoming Webhooks.
- Turn on Activate Incoming Webhooks, and click Add New Webhook to Workspace.
- Choose a Slack channel that you want the post the messages to.
- Click Allow.
- Copy and save the generated webhook URL.
Results
Step 2: Define the message layout
A message layout is defined in a JSON format that includes the message in text, links, and image, if required. For HCL DevOps Deploy (Deploy), you can create message layout that refers to the process name, status, and a link to the process deployment page. This message layout is used in the webhook template. Message layout is defined differently for each event type.
About this task
- Application Deployment Failure JSON body
- Application Deployment Success JSON body
- Approval Completed JSON body
- Approval Created JSON body
- Approval Failed JSON body
- External Approval Completed JSON body
- External Approval Failed JSON body
- Generic Process Failure JSON body
- Generic Process Request Started JSON body
- Generic Process Success JSON body
- Process Not Started JSON body
- Process Request Started JSON body
- Task Created JSON body
Step 3: Create a webhook template
Create a webhook template for an application process failure so that when the event happens a notification is triggered in your Slack app.
Procedure
- Select .
- Provide a name and description for the template. For this example, give the name as Application process failed notification.
- Click on Body and paste the example Application Deployment Failure JSON body from the step 2.
- Choose the event type Process Failure from the Type field.
- Submit your changes.
Results
Step 4: Add the webhook template to an application
You can add a webhook template to applications, generic processes, and external approval processes. For this example, you add the template to an application.
Before you begin
Procedure
-
Select
.The Add Webhook window is displayed.
- Copy the URL that you generated from step 1 and paste it in the URL field.
- Specify the event type as Process Failure.
- Select the template name created in step 3 from the Webhook Template field.
- Specify the environment name from the Environments field.
- Submit your changes.
Results
Webhook-Integration-Test | 6/13 6:53 PM |
An approval failed for the App application on the Env environment | |
An application process was rejected during its approval process | |
Application: App Environment: Env Requested by: admin Scheduled for: Sun Jun 13 18:52:31 IST 2021 Description: ${request.Description} | |
Click View Details for more information. |