Skip to content

feat(signals): add slack notification picker in inbox source settings#2174

Draft
Twixes wants to merge 3 commits into
mainfrom
posthog-code/signals-inbox-slack-notifications
Draft

feat(signals): add slack notification picker in inbox source settings#2174
Twixes wants to merge 3 commits into
mainfrom
posthog-code/signals-inbox-slack-notifications

Conversation

@Twixes
Copy link
Copy Markdown
Member

@Twixes Twixes commented May 18, 2026

Problem

Signals inbox items previously surfaced only in-app. Users wanting a heads-up when a new item lands and they're a suggested reviewer had no way to opt in.

Even after the initial Slack notifications work landed, picking a channel still required a detour through PostHog Web — users had to leave PostHog Code to install the Slack integration, then come back. That's too much friction for what should be a one-time setup.

Changes

Slack notifications surface under Inbox source settings — same surface as the existing "PR auto-start threshold" control.

  • New SignalSlackNotificationsSettings component with three controls:
    • Slack workspace picker (shown only when more than one Slack Integration is connected; otherwise the single workspace is implied).
    • Notification channel picker, populated from /api/environments/{teamId}/integrations/{id}/channels/ — same endpoint as Insight Alerts. Includes an explicit "Off — don't notify me" option.
    • Minimum priority filter (P0 highest → P4, plus "every priority").
  • useSlackChannels hook caches the channel list for 5 min (server-side cache is already 1 h, so cheap refreshes).
  • useSignalSourceManager.handleUpdateSlackNotifications translates camelCase patches to the snake_case API body and only sends the fields the caller touched, so editing notifications doesn't wipe the autostart-priority setting (and vice versa).
  • SignalUserAutonomyConfig shared type and posthogClient.updateSignalUserAutonomyConfig extended with the new optional fields.

In-app Slack connect flow so users no longer have to leave PostHog Code for PostHog Web.

  • New SlackIntegrationService in the main process. Mirrors the existing GitHubIntegrationService but registers a separate slack-integration deep-link key so each provider's handler stays isolated.
  • New slackIntegration tRPC router (startFlow, onCallback, onFlowTimedOut, consumePendingCallback).
  • New renderer hooks: useSlackIntegrationCallback (deep-link subscriber, drains pending callbacks on mount) and useSlackConnect (button state machine — idle → connecting → idle/error/timed-out).
  • The empty state in SignalSlackNotificationsSettings now shows a Connect Slack workspace button that:
    1. Asks the main process to open the browser at PostHog Cloud's /api/environments/{projectId}/integrations/authorize/?kind=slack&next=/account-connected/slack-integration?...,
    2. Waits for PostHog Cloud to complete OAuth and create the team-level Slack Integration,
    3. PostHog Cloud redirects to /account-connected/slack-integration (see the paired backend PR), which fires a posthog-code://slack-integration?integration_id=… deep link back into the app,
    4. The deep-link handler invalidates integration queries — the channel picker appears without a refresh.
  • A "Connect another Slack workspace" affordance is also shown in the connected state so users with one workspace can add another without leaving the app.
  • Window-focus fallback: if the deep link gets eaten by the OS/browser, returning focus to PostHog Code re-runs the integrations query.

Pairs with the backend changes in PostHog/posthog#58774.

How did you test this?

I'm an agent. Verified:

  • pnpm typecheck (under apps/code) is clean — no new errors introduced.
  • pnpm exec biome check is clean on every modified and new file.
  • Did not start the Electron app locally; CI is authoritative for visual regressions and end-to-end behavior.

Publish to changelog?

no


Created with PostHog Code

Twixes added 2 commits May 18, 2026 09:51
Surfaces the new per-user Slack notification settings for the signals
inbox (workspace + channel + minimum priority) in the inbox source
settings panel. Reuses the existing /api/.../integrations/{id}/channels/
endpoint to populate the channel picker and the existing slack
Integration store, so no new auth setup is required — users connect
Slack once in PostHog Web and pick a channel here.

Pairs with the backend changes in PostHog/posthog#58774.

Generated-By: PostHog Code
Task-Id: 046d7425-f0b4-4ab4-97f8-cce0627927f0
Adds an in-app Slack connect flow so users no longer have to leave PostHog
Code for the PostHog web settings page just to wire up notifications.

Flow: clicking "Connect Slack workspace" in the inbox source settings
opens the browser to PostHog Cloud's Slack OAuth authorize endpoint with
`next=/account-connected/slack-integration?...`. PostHog Cloud completes
OAuth, creates the team-level Slack `Integration`, and redirects to a
landing page that fires a `posthog-code://slack-integration?...` deep
link back into the app. The new `SlackIntegrationService` (main process)
handles the deep link, emits a callback event, and the renderer hook
refreshes the integrations list.

Mirrors the existing `GitHubIntegrationService` so each provider's deep
link handler stays isolated. Pairs with backend changes in
PostHog/posthog#58774 that teach the `/account-connected/<kind>` page
about the new `slack-integration` kind.

Generated-By: PostHog Code
Task-Id: 046d7425-f0b4-4ab4-97f8-cce0627927f0
… channels

Switches the notification channel picker from a Radix Themes Select to the
searchable, virtualized Combobox from @posthog/quill (the same component used
by GitHubRepoPicker and BranchSelector). Workspaces commonly have hundreds of
channels — the old Select was unsearchable and rendered every option upfront.

Also rewires handleUpdateSlackNotifications to apply changes via setQueryData
optimistically, rather than waiting for the round-trip + cache invalidation.
On error, rolls back to the previous snapshot. This makes channel and
minimum-priority picks reflect immediately, and surfaces failures via toast.

Generated-By: PostHog Code
Task-Id: 046d7425-f0b4-4ab4-97f8-cce0627927f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant