How to get Slack notifications when Feature Flags change
Contents
When you're managing Feature Flags across a team, it's important to know when flags are created, updated, or deleted. PostHog's Activity Logs track these changes, and you can use a custom Data Pipelines destination to forward them to Slack in real time.
This tutorial walks through setting up a custom Hog function via the API that listens for feature flag changes and posts rich Slack notifications – including release conditions, variant rollouts, payloads, and who made the change.
Note: This destination triggers on the internal
$activity_log_entry_createdevent, which isn't available in the UI event picker yet. You need to create it using the PostHog API.
Prerequisites
You need:
- A PostHog account with Data Pipelines enabled
- A Slack workspace connected to PostHog (see Slack destination docs for setup)
- A personal API key with write access
- Your PostHog project ID (found in project settings)
How it works
The destination listens for the internal $activity_log_entry_created event, filtered to the FeatureFlag scope. When someone creates, updates, or deletes a feature flag, the Hog function runs and posts a formatted message to Slack using the Block Kit API.
The message includes:
- Who made the change and what action they took
- Release condition details (rollout percentages, targeting rules, variants)
- Before/after comparisons for variant rollout changes
- Payload values
- A direct link to the flag in PostHog
Step 1: Prepare the API request body
The API request creates a Hog function with type internal_destination. You need to customize three values in the JSON below:
slack_workspacevalue – Your Slack integration ID. Find this in PostHog by going to Data Pipelines > Destinations > creating a new Slack destination > connecting your workspace. The integration ID appears in the URL or you can find it via the API at/api/environments/<project_id>/integrations/.channelvalue – Your Slack channel ID (e.g.,C0NA9JPU2). You can find this in Slack by right-clicking a channel > View channel details > the ID is at the bottom.<project_id>in the API URL – Your PostHog project ID.
Save the following JSON to a file called create_hog_function.json:
Step 2: Create the destination via the API
Run the following cURL command, replacing <your_api_key> and <project_id> with your values:
If you're on PostHog EU, use
eu.posthog.cominstead ofus.posthog.com.
A successful response returns the created Hog function with an id field. The destination is immediately active.
Step 3: Verify in PostHog
After creating the destination, go to Data Pipelines > Destinations in PostHog. You should see Feature Flag Change Notifier -> Slack listed and enabled. You can click into it to test, view Logs, or adjust settings.
To trigger a test notification, create, update, or delete any feature flag in your project.
Understanding the Hog Code
The Hog function in the JSON above does the following:
Parses the activity log event – Extracts the action type (
created,updated,deleted), flag name, actor, and change details fromevent.properties.Builds the Slack message header – Shows who did what with an emoji indicator and a link to the flag in PostHog.
Adds change details for updates – When a flag is updated, the function iterates through each change and formats it:
- Release conditions – Rollout percentages, targeting rules, and variant assignments for each condition set
- Multivariate variants – Current rollout percentages with before/after comparison when changed
- Payloads – Key-value pairs attached to variants
- Status changes – Whether the flag was enabled or disabled
- Renames – Old and new flag names
Adds a "View Flag" button – A direct link to the flag in PostHog (omitted for deleted flags).
Posts to Slack – Sends the message using the Slack
chat.postMessageAPI with Block Kit formatting.
What the notifications look like
Once enabled, you'll see Slack messages like:
- Flag created:





