It can be useful to receive notifications whenever a user responds to your survey. For example, messages containing their response can be sent to Slack, Discord, Teams, or your own custom destination.
Using webhooks
For Slack, Discord, and Teams, you can set up and use our webhook. To set this up, follow the below steps:
Step 1: Set up your PostHog Webhook
First you need to set up an webhook endpoint where you'll receive survey responses. You can use your own custom endpoint, or you can follow our guides to set one up for Slack, Discord, or Teams.
Step 2: Create an action for survey responses
Next, set up an action to post survey events to our webhook. To do this:
- Navigate to the actions tab in Data Management and click New action in the top right.
- Select From event or pageview when prompted.
- Under Match Group #1, click All events and select
survey sent
as the event name. - Check the box which says
Post to webhook when this action is triggered
. - In the message format text field, set the text to
New response for [event.properties.$survey_name] from user [person]: "[event.properties.$survey_response]"
Save your action and you will now begin receiving notifications whenever users respond to your survey.
Using realtime destinations
Our new realtime destinations are currently in preview. These provide customizable destinations, more formatting options, a revamped configuration UI. You can use them to send survey responses to Slack or any other destination that supports webhooks.
To do this, start by enabling the Pipeline destinations 3000 feature preview.
Next, go to the data pipeline destinations tab and search for the Slack destination (or HTTP Webhook for custom) and click + Create. On the creation screen:
Follow the steps to integrate with your Slack workspace if you haven't already and then select it.
Make sure the PostHog integration is added to the channel you want to send messages to and select it.
Under Match event and actions, select survey sent.
Under Blocks, modify the text to include the survey name and response. For example:
{"text": {"text": "*{person.name}* sent a response to {event.properties.$survey_name}: {event.properties.$survey_response}","type": "mrkdwn"},"type": "section"},
- Customize the name and description, and press Create & enable.
You can then test the destination and it will start sending survey responses to Slack.