Tutorial

Sending BetterCloud Alerts to a Private Slack Channel using Webhooks

  • 24 February 2021
  • 4 replies
  • 463 views

Userlevel 5
Badge +2

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.

  1. Navigate to: Slack Incoming Webhooks
  2. Choose ‘Add to Slack’
  3. Choose a channel from the ‘Post to Channel’ section 
  4. Click ‘Add Incoming WebHooks integration’
  5. Copy the ‘Webhook URL’ from this page. 

    This will look similar to: 

    https://hooks.slack.com/services/T011GA9NK/B0P7TR98F/mZZPPISVd6Q0BuIcTFz5t

 

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.

 

  1. Navigate to: app.bettercloud.com > Integration Center > Create a Custom Integration
  1. 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.
  2. On the next screen, under ‘Create Your First Extension’ click ‘Get Started’
  3. Choose ‘Add an Action for Workflows’
  4. Configure the action like so:
    Action Name: Send Slack Message to Private Channel (adjust as you’d like)
    Description: (optional)
    Action Pre-Request Script: leave blank
    API Configuration:
    -> HTTP Method: POST
    -> Destination URL: Paste the Webhook URL from Step 1.5
    Additional Headers: leave blank
    Test your Action: ✅
    Payload:
    {
    "text":"Testing from BetterCloud!",
    "username": "BetterCloud Bot",
    "icon_emoji": ":rotating_light:"
    }
    Feel free to adjust these values for your test as needed.
  5. 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.
  6. Click ‘Next’
  7. Click the ‘Required?’ checkbox for the ‘text’ line item 
  8. 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.

  1. Navigate to app.bettercloud.com > Workflows > New
  2. In the ‘WHEN’ section of your Workflow, find & select the Alert that you’ve already configured

    This can be a system Alert or a custom Alert created from a template. More on that here.

  1. 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
  2. On the right side of your Workflow Builder fill in the ‘Action Properties’ with the textusername, and icon_emoji like so: 
  1. Save and Publish your Workflow

 

 


4 replies

Badge

Worked like a charm!

Great guide, shame I can’t get past step 2...all I have is “learn more” where create custom integration should be!

We are going to provide you the complete guide of all the Sims 4 relationship cheats in this article. We have it all because, with Sims 4 relationship, How to modify relationship in sims 4? https://screamreality.com/sims-4-relationship-cheats/ friendship cheats, and romance cheats, all become child’s play. With the knowledge you will gain from this article about Sims 4 cheats for relationships, you can set relationships any way you prefer.

I’ve followed the instructions but get “The test has failed”. Any advice would be much appreciated.

 

The test has failed

Request

URL:

https://hooks.slack.com/services/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

HEADERS:

Content-Type:

text/plain

Response

HEADERS:

date:

Sun, 02 Oct 2022 20:04:22 GMT

server:

Apache

x-powered-by:

HHVM/4.153.1

x-frame-options:

SAMEORIGIN

access-control-allow-origin:

*

referrer-policy:

no-referrer

x-slack-backend:

r

x-slack-unique-id:

YznuxvUZ7S0UYNIjdG9VCQAAADw

strict-transport-security:

max-age=31536000; includeSubDomains; preload

vary:

Accept-Encoding

content-type:

text/html

x-envoy-upstream-service-time:

13

x-backend:

main_normal main_bedrock_normal_with_overflow main_canary_with_overflow main_bedrock_canary_with_overflow main_control_with_overflow main_bedrock_control_with_overflow

x-server:

slack-www-hhvm-main-iad-xdsd

x-slack-shared-secret-outcome:

no-match

via:

envoy-www-iad-va60, envoy-edge-iad-7yfz

x-edge-backend:

envoy-www

x-slack-edge-shared-secret-outcome:

no-match

connection:

close

transfer-encoding:

chunked

Reply