Skip to main content

Creating a Webhook for Slack

What do you want your webhook to do?

Scenario:
As a Data Request Manager, you currently receive daily email summaries when DSAR requests are email-verified. These emails are often delayed and mixed with other messages, making it hard to act promptly. You want to be notified immediately via Slack, when all action items on a DSAR are complete so you can review the request right away.

Solution:
Use a Webhook to Send Slack Notifications When DSAR Action Items Are Complete

To set this up, you’ll need to create a Slack app and configure a webhook. Start by reviewing the Slack Webhooks documentation.

Step 1: Create Slack App

First you need to create a Slack app that will host the messages sent from Osano. Click the Create an app button within the Slack webhooks documentation page.

Step 1

Step 2: Choose How to Create Your App

Select From scratch to build a new app.

Step 2

Step 3: Name Your App & Select a Workspace

Give your app a name and choose the Slack workspace where notifications should be sent. Then click Create App.

Step 3

Step 4: Add Incoming Webhooks

In the app’s Features tab, click Incoming Webhooks and toggle the switch to On to activate incoming webhooks.

Step 4

Step 5: Add App to Workspace

Click the Add New Webhook button to create a new webhook. Install the app if prompted. Once the app has been installed, there should be a new entry with a Webhook URL. Click the Copy button next to the webhook url as we'll need this later.

Step 5 Step 6

Step 6: Create Webhook in Osano

Navigate to the Webhooks section on my.osano.com and create a new webhook.

App and Event

Under the App and Event section, select Subject Rights as the product and Request In Progress as the event.

Actions

For the method and url, select POST and enter your Slack webhook url from Step 5

  • Method: POST
  • URL: <YOUR_SLACK_WEBHOOK_URL>

Content

Slack requires a specific JSON structure for messages. Below is a sample payload using Slack’s https://docs.slack.dev/block-kit/ format. You can customize it further using supported variables listed on the variables page.

{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "New Subject Rights Request Received",
"emoji": true
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Request Type:*\n{{dsaRequestType}}"
},
{
"type": "mrkdwn",
"text": "*Request ID:*\n{{dsarId}}"
},
{
"type": "mrkdwn",
"text": "*Created At:*\n{{created}}"
}
]
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Please review and take appropriate action."
}
]
}
]
}

Result: Real-Time Notifications for DSAR

Now click the Test button in the content section to verify your webhook sends a message to the channel you selected.

Result