Skip to content

: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.

feat(settings): turn task comment slack dms on or off on the web under today-rail-nav (#110269)

Shy Alter0c2497541b27
diff --git a/frontend/src/scenes/settings/SettingsMap.tsx b/frontend/src/scenes/settings/SettingsMap.tsx
index 7a1d56805c8d..896a5559f17b 100644
--- a/frontend/src/scenes/settings/SettingsMap.tsx
+++ b/frontend/src/scenes/settings/SettingsMap.tsx
@@ -206,6 +206,7 @@ import {
SidebarLayoutSetting,
SidebarMyProductsSetting,
} from './user/SidebarSettings'
+import { TaskCommentSlackNotifications } from './user/TaskCommentSlackNotifications'
import { ThemeSwitcher } from './user/ThemeSwitcher'
import { TwoFactorSettings } from './user/TwoFactorSettings'
import { UpdateEmailPreferences } from './user/UpdateEmailPreferences'
@@ -2654,6 +2655,15 @@ export const SETTINGS_MAP: SettingSection[] = [
flag: 'REAL_TIME_NOTIFICATIONS',
keywords: ['notification', 'in-app', 'realtime', 'popover', 'mention'],
},
+ {
+ id: 'task-comments-slack-dm',
+ title: 'Agent tasks',
+ description:
+ 'Get a Slack direct message when someone mentions you, replies to your comment, or comments on a task you own.',
+ component: <TaskCommentSlackNotifications />,
+ flag: 'TODAY_RAIL_NAV',
+ keywords: ['slack', 'dm', 'direct message', 'comments', 'tasks', 'desktop', 'notifications'],
+ },
],
},
{
diff --git a/frontend/src/scenes/settings/types.ts b/frontend/src/scenes/settings/types.ts
index ca27c3269dba..02f6a8b3ddd8 100644
--- a/frontend/src/scenes/settings/types.ts
+++ b/frontend/src/scenes/settings/types.ts
@@ -299,6 +299,7 @@ export type SettingId =
| 'task-agent-project-instructions'
| 'ai-usage-spend'
| 'ai-cloud-environments'
+ | 'task-comments-slack-dm'
| 'task-agent-project-default'
| 'theme'
| 'tracing-distinct-id-attribute-keys'
diff --git a/frontend/src/scenes/settings/user/TaskCommentSlackNotifications.tsx b/frontend/src/scenes/settings/user/TaskCommentSlackNotifications.tsx
new file mode 100644
index 000000000000..9303315e13f3
--- /dev/null
+++ b/frontend/src/scenes/settings/user/TaskCommentSlackNotifications.tsx
@@ -0,0 +1,45 @@
+import { useActions, useValues } from 'kea'
+
+import { LemonSwitch, LemonTag, Link } from '@posthog/lemon-ui'
+
+import { urls } from 'scenes/urls'
+import { userLogic } from 'scenes/userLogic'
+
+import { LOCKED_BY_ORGANIZATION, lockedValueFor } from '../shared/notificationLocks'
+
+const SETTING = 'task_comments_slack_dm'
+
+export function TaskCommentSlackNotifications(): JSX.Element {
+ const { user, userLoading } = useValues(userLogic)
+ const { updateUser } = useActions(userLogic)
+
+ const enforced = lockedValueFor(user?.notification_locks, SETTING)
+ const stored = user?.notification_settings?.[SETTING]
+ const checked = typeof enforced === 'boolean' ? enforced : stored !== false
+
+ return (
+ <div className="flex flex-col gap-2 max-w-200">
+ <LemonSwitch
+ bordered
+ data-attr="task-comments-slack-dm"
+ label={
+ <span className="flex items-center gap-2">
+ Slack DMs for task comments
+ {enforced !== null ? <LemonTag type="highlight">Set by your admin</LemonTag> : null}
+ </span>
+ }
+ checked={checked}
+ onChange={(next) => {
+ if (user?.notification_settings) {
+ updateUser({ notification_settings: { ...user.notification_settings, [SETTING]: next } })
+ }
+ }}
+ disabledReason={enforced !== null ? LOCKED_BY_ORGANIZATION : userLoading ? 'Loading...' : undefined}
+ />
+ <p className="text-secondary text-xs mb-0">
+ We find your Slack account by your email. If your Slack email is different, link your account in{' '}
+ <Link to={urls.settings('user-personal-integrations')}>Personal integrations</Link>.
+ </p>
+ </div>
+ )
+}
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index f1fd838a4752..21bcf2f91e10 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -487,6 +487,7 @@ export interface NotificationSettings {
organization_member_join_email_disabled?: Record<string, boolean>
realtime_notifications_disabled?: Record<string, Record<string, boolean>>
pipeline_notifications_disabled?: Record<string, boolean>
+ task_comments_slack_dm?: boolean
}
export interface WebAnalyticsDigestMetricChange {