Guides

Setup Slack Notifications

A common use-case is to send notificaitons to a Slack channel when projects complete. Privacy Dynamics can provide real-time information to other applications as soon as a project completion events occur using webhooks. This document explains how to register webhook URLs with Privacy Dynamics and alert on project completion.

Privacy Dynamics doesn't communicate directly with Slack, but third-party services like Zapier and n8n can be used as a bridge to deliver notifications to Slack. Privacy Dynamics will send a JSON payload to the third-party which formats and delivers the message to Slack.

Please note that the project completion event is organization-wide and will fire for every project. Also, all jobs within a project must complete before the project event will fire.

Using Zapier as a communication bridge

Zapier can be used to receive event notifications from Privacy Dynamics and forward them to your Slack workspace. You will create a Zap in Zapier containing three steps: a Trigger to receive the message, a Formatter to process it, and a Slack app to deliver the message. Before you get started, you will need to create a Zapier account and install the Zapier Slack app.

Create a Trigger and webhook URL

The first step is to create a webhook URL for Privacy Dynamics to send messages to. This will be an address owned by Zapier that will receive notification messages when projects complete.

  1. Create a new Zap and add a “Webhooks by Zapier” Trigger. Select the “Catch Hook” event. On the “Test” tab, the trigger will present a callback URL to Zapier. Copy the URL.
  2. Using the URL copied from the Test tab of the trigger and while Zapier is listening, send the HTTP request below via curl. It is important to preserve the new line characters in the sample JSON because they will be needed to format the message correctly.
curl -X "POST" "https://hooks.zapier.com/hooks/catch/15252zzz/39mmzzz/" \
     -H 'Content-Type: application/json' \
     -d $'{
  "project_id": "f84fbe42-a465-43f7-bab9-8aac06566d4f",
  "project_title": "Test Project Title",
  "project_statuses": [
    {
      "result": "FAILURE",
      "dataset_name": "test_table_1_044569262"
    },
    {
      "result": "SUCCESS",
      "dataset_name": "test_table_1_044569261"
    }
  ]
}'
  1. Click the “Test trigger” button. Select the request that contains the payload that was sent from the previous step. Click the “Continue with selected record” button. When complete, the Trigger box should contain a green check mark. Note that this URL is what you will register with Privacy Dynamics as your project completion callback URL.

Setup Formatting Action

  1. Add a “Formatter by Zapier” action. Select the “Utilities” event under “App & event.” On the “Action” tab, select the “Line-item to Text” Transform. Add the following:
  2. Values – Input: <Insert Data: Project Statuses Table Name>: <Insert Data: Project Status Result>
  3. Separator: \n
  4. Hit the Test Button. When done, the Action window should have a green check mark and contain mappings for each of the lines in the message sent by Privacy Dynamics.

Setup Slack Message Action

  1. Add a “Slack” action and select “Send Channel Message” Event under “App & event.”
  2. Authenticate with your Slack account. Hit the “Continue” button.
  3. Under “Action”, fill in the following:
    1. Channel: The Slack channel to send the message to, ex., "webhooks."
    2. Message Text: Anonymization on the project *<Insert Data: 1. Project Title>* is now complete. Table details: <Insert Data: 2. Output Text>
    3. Send as Bot: Yes.
    4. Bot Name: Privacy Dynamics
    5. Bot Icon: https://media.licdn.com/dms/image/C560BAQFZD41uaLXphg/company-logo_200_200/0/1647537225138?e=1684368000&v=beta&t=T8iHuEypmqtRDGwd_SaluoscUzfi8fJst_Vtt5tIcOQ
  4. Test and Publish

Register callback URL with Privacy Dynamics

With the callback URL collected in the step, “Create a Trigger and webhook URL,” above, register it with Privacy Dynamics. From the Settings screen, click “Webhooks” and then click the “Add webhook” button to register the callback URL.

Previous
k-member Micro-aggregation
Next
Overview