If you’ve ever had the need to send messages to a private channel (or wondered what the process of configuring a webhook looks like) within a BetterCloud Workflow this guide is for you. Follow along and let us know if you have any questions in the comments section below.
NOTE: You will need access to BetterCloud’s API add-on in order to complete this tutorial
1) Configure the Slack Webhook
The first thing you will need to do is set-up your Slack Incoming Webhook in order to be able to send a message to a private channel.
- Navigate to: Slack Incoming Webhooks
- Choose ‘Add to Slack’
- Choose a channel from the ‘Post to Channel’ section
- Click ‘Add Incoming WebHooks integration’
- Copy the ‘Webhook URL’ from this page.
This will look similar to:
2) Create a Custom BetterCloud Integration
Next, you will need to create a custom action with in a custom BetterCloud Integration. This action will send a POST request with your message to the Slack channel.
- Navigate to: app.bettercloud.com > Integration Center > Create a Custom Integration
- Set the ‘Name’ to ‘Custom Slack Integration’ (or whatever name you prefer) and set the ‘Logo’ to ‘Other’. Leave ‘Authentication’ set to ‘None’. Click Save.
- On the next screen, under ‘Create Your First Extension’ click ‘Get Started’
- Choose ‘Add an Action for Workflows’
- Configure the action like so:
Action Name: Send Slack Message to Private Channel (adjust as you’d like)
Action Pre-Request Script: leave blank
-> HTTP Method: POST
-> Destination URL: Paste the Webhook URL from Step 1.5
Additional Headers: leave blank
Test your Action:
Feel free to adjust these values for your test as needed.
"text":"Testing from BetterCloud!",
"username": "BetterCloud Bot",
- Click ‘Run Test’. At this point, you should see a message appear in your Slack channel.
If you do not, check the error message returned for more detail.
- Click ‘Next’
- Click the ‘Required?’ checkbox for the ‘text’ line item
- Click Save
3) Configure Your Alert / Workflow
Now that you’ve configured your Slack Incoming Webhook and your custom BetterCloud action, you’re ready to configure your Alert & Workflow.
- Navigate to app.bettercloud.com > Workflows > New
- In the ‘WHEN’ section of your Workflow, find & select the Alert that you’ve already configured
- In the ‘THEN’ section of your Workflow, find the ‘Send Slack Message to Private Channel’ action we created in section 2 and add it to your Workflow
- On the right side of your Workflow Builder fill in the ‘Action Properties’ with the text, username, and icon_emoji like so:
- Save and Publish your Workflow