:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { useActions, useValues } from 'kea'
import { IconSend } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
import { messageAudienceAccessDisabledReason } from 'products/workflows/frontend/MessageAudience/messageAudience'
import { surveyRespondentsBroadcastLogic } from './surveyRespondentsBroadcastLogic'
export function SurveyRespondentsBroadcastButton({ surveyId }: { surveyId: string }): JSX.Element {
const logic = surveyRespondentsBroadcastLogic({ surveyId })
const { respondentsCohortLoading, hasActiveFilters } = useValues(logic)
const { emailRespondents } = useActions(logic)
return (
<LemonButton
type="secondary"
size="small"
icon={<IconSend />}
onClick={emailRespondents}
loading={respondentsCohortLoading}
disabledReason={messageAudienceAccessDisabledReason()}
tooltip="Send a one-time email to the people behind the responses shown"
data-attr="survey-email-respondents"
>
{hasActiveFilters ? 'Email these respondents' : 'Email respondents'}
</LemonButton>
)
}