The latest from the PostHog community

How to send survey responses to Slack

Jun 26, 2024

It's useful to send survey responses from your users to Slack. This way you're notified as soon as they respond to a survey. This tutorial shows you how to set this up in PostHog and Slack.

Step 1: Create your survey

The first step is to create a survey. Our docs cover how to do this, so we won't go into detail here. We also have framework-specific tutorials.

Step 2: Create an app in Slack

The next step is configure an app in Slack that will send messages with the survey responses.

Go to the Slack developer dashboard, click Create New App, and then click From scratch. Name your app "PostHog", connect it to the workspace of your choice, and click Create App.

Optional: Feel free to use an image from here as the app's logo.

How to create a new Slack app

Step 3: Create a webhook in Slack

Go to the Incoming Webhooks page for your newly-created app and toggle Activate Incoming Webhooks to turn it on. Then click Add New Webhook to Workspace and select the channel that the you want to send survey responses to.

Once created, copy the URL for your new webhook.

Select a channel to send survey responses to

Step 4: Connect your webhook to PostHog

Go to Integration section in your PostHog project settings and paste the URL from the previous step in the Webhook integration field.

Click Test & Save and you should receive a message in Slack from your app.

Connect your Slack webhook to PostHog

Note: In your project settings, you'll also see a "Slack integration" section. You can ignore this as it is not required for setting up the Slack webhook. It's only required for setting up subscriptions to receive regular reports for any insight or dashboard.

Screenshot of Slack integration

Step 5: Create an action for your survey responses

In PostHog, navigate to actions in the Data management tab. Click the New action button in the top right and then From event or pageview.

Then under Match Group #1, click on the Other events tab and set the Event name to survey sent.

Lastly, check the box for Post to webhook when this action is triggered and set the Slack message format to New response for [event.properties.$survey_name] from [person]: "[event.properties.$survey_response]".

Altogether it should look like this:

Setting up a survey action

And we're done! Now whenever a user responds to your surveys, you'll receive a message in Slack

Survey response in Slack

Further reading