Sending Event Notifications to a Slack Channel

The Secret Server Bot sends direct messages to individual users. It does not post to channels.

To post event notifications into a shared Slack channel, use an Event Pipeline with the Post Slack Message (WebHook) task. An example channel is #security-alerts. The bot and the pipeline are independent. You can use both at the same time.

Step 1: Create an Incoming Webhook in Slack

  1. Go to api.slack.com/apps and open your Secret Server Bot app. You can also use a different app that has incoming webhooks turned on. See Step 5 in Configuration.

  2. Click Incoming Webhooks in the left menu. Make sure Activate Incoming Webhooks is on.

  3. Click Add New Webhook to Workspace.

  4. Select the target channel and click Authorize. For a private channel, you must be a member of that channel first.

  5. Copy the webhook URL. The URL starts with https://hooks.slack.com/services/.

The webhook URL is a credential. Anyone with the URL can post to the channel. Store the URL in Secret Server. Do not put it in tickets, chat, or source control. Slack revokes webhook URLs that it finds in public places.

On Slack Business+ or Enterprise Grid, the webhook step can require Org Admin approval. See Configuration.

Step 2: Create the Event Pipeline in Secret Server

  1. Go to Administration > Actions > Event Pipeline Policy.

  2. Click the Pipelines tab, then click Add Pipeline.

  3. Select the Pipeline Type:

    • Secret: for secret events. Examples: Delete, Undelete, Access Approved, Password Change, Expires in 7 Days, Heartbeat Failure.

    • User: for user events. Examples: Disable, Added to Group.

  4. Click Create. Add one or more triggers. Click Next.

  5. Add filters if necessary. Click Next.

  6. Add the Post Slack Message (WebHook) task. Paste the webhook URL from Part 1. Type the message text.

  7. Click Next. Type a Pipeline Name and click Save.

  8. Add the pipeline to an active Event Pipeline policy. Assign targets to the policy:

    • Secret pipelines: folders or secret policies. Folder targets are not recursive. Only secrets directly in the folder trigger the pipeline. For a secret policy target, set Event Pipeline Policy to Enforced in that secret policy.

    • User pipelines: user groups.

A pipeline does nothing until it is in an active policy that has targets.

Use Event Variables in the Message

You can put event variables in the message text. Secret Server replaces them when the event occurs. Example:

:warning: $ByUserDisplayName did $EventAction on secret "$SecretName" (folder $FolderName).

For the full list, see Event Variables.

Step 3: Verify

  1. Do the trigger event on a secret or user that the policy targets.

  2. Make sure the message appears in the Slack channel.

  3. If no message appears, open the policy and click Activity. Look for a failure or a skip.

Send Different Events to Different Channels

Each webhook posts to one channel. To use more channels, create one webhook for each channel. Then create one pipeline for each event group. Example:

Pipeline Triggers Webhook channel
Secret deletions Delete, Undelete #security-alerts
Secret expirations Expires in 7 Days, Expired Today #ops

Limitations

  • Channel messages are one-way. They have no Approve or Deny buttons. Use the Secret Server Bot for approvals.

  • Each webhook posts to one fixed channel. The Slack Integration settings page has no channel selector.

  • Password fields and file attachments are not available as variables. Other secret fields are available, for example $Username and $Notes. Do not put sensitive fields in channel messages.