How to send survey responses to Slack

Jun 26, 2024

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

It's useful receive Slack notifications as soon as users respond to your surveys. You can do this in PostHog using our realtime destinations.

After you've created your survey, go to the data pipeline destinations tab, search for the Slack destination and click + Create. Then on the creation screen:

  1. Follow the steps to integrate with your Slack workspace if you haven't already and then select it.

  2. Make sure the PostHog integration is added to the channel you want to send messages to and select it.

  3. Under Match event and actions, select survey sent.

  4. Under Blocks, modify the text to include the survey name and response. For example:

JSON
{
"text": {
"text": "*{person.name}* sent a response to {event.properties.$survey_name}: {event.properties['$survey_response_a3071551-d599-4eeb-9ffe-69e93dc647b6']}",
"type": "mrkdwn"
},
"type": "section"
},
  1. Customize the name and description, and press Create & enable.
Create Slack destination

You can then test the destination and it will start sending survey responses to Slack.

Slack message

Survey properties

You can extract the following properties from surveys:

PropertyDescription
event.properties.$survey_nameThe name of the survey
event.properties.$survey_questionsAn array of objects containing the following survey question properties: id, index, and question
event.properties.$survey_response_{response_key}The response to a specific question. To find response_key, go to your survey page and click on the button Copy survey response key. There's one for each question in your survey. response_key is identical to the corresponding survey question ID
person.name or other person propertiesThe name of the person who responded or other properties

Further reading

Subscribe to our newsletter

Product for Engineers

Read by 60,000+ founders and builders.

We'll share your email with Substack

Questions? Ask Max AI.

It's easier than reading through 637 pages of documentation

Comments