Email Classification
Slack classifies invited email addresses as internal or external, so it can steer users toward Workspace Invites or Slack Connect. The classifier checks unique domains against org settings and the inviter's domain in O(1), then looks up a per-team aggregate of user counts by domain and role in a Vitess table sharded by team_id. A domain counts as internal when it holds at least a configurable share of the team, for example 10%. Counts are kept current with relative +N/-N UPSERTs from asynchronous mutation jobs, and a Healer job recounts users in memory and applies corrective deltas when drift appears, such as negative counts from re-executed jobs. The result is an eventually consistent aggregate that needs no expensive daily backfills.
Related posts
- Role Management at Slack
Slack Engineering mediumAdeptSlack replaced its coarse guest/member/admin/owner hierarchy with a role-based access control system that grants granular permissions such as ARCHIVE_CHANNEL scoped to an enterprise or workspace entity. Authorization runs as ordered policy rules in the Hack monolith: deny restricted users, then check legacy preferences, then call a containerized Go permissions service over gRPC. That service reads from the same user_id-sharded Vitess store as the monolith. Clients get non-authoritative permissions via the Flannel edge cache and real-time updates in Redux. Rollout went from a loopback service to dark-mode dual reads compared in Prometheus, then light mode, and a codegen CLI built on HHAST lets other teams add roles without touching framework internals.
- Lessons on UX, security, and scale when building an enterprise-grade Slack agent
Sourcegraph mediumAdept
Sourcegraph's Deep Search Slack agent fits into enterprise workflows through staged status messages (emoji acknowledgement, escalation links for long searches), TL;DR answers with threaded follow-ups, and rich link unfurling via Slack's link_shared events, SHA256-based entity IDs, chat.unfurl work objects and flexpane details. On the enterprise side it supports Enterprise Grid's one-app-to-many-workspaces model, auto-links Slack users to Sourcegraph accounts by verified email so permissions match code access, and validates setup by forcing a fresh Slack event-URL ping with a random retry parameter. Abuse is controlled with simple Redis fixed-window counters per user and team that fail open if Redis is down.
- How Datadog’s IT team automated monitoring third-party accounts
Datadog Engineering mediumAdeptClarity is an internal tool that audits accounts in SaaS apps like Slack, GitHub, Zoom and Google Workspace against Workday, the HR source of truth, and flags any account that doesn't match an active employee. A scheduled CloudWatch rule triggers an AWS Lambda each weekday morning. It compares user email lists across apps and emits tagged Datadog gauge and count metrics plus faceted logs per account. It then opens Freshservice tickets and posts Slack Block Kit summaries that link to prefiltered logs. DynamoDB stores state between runs so flagged accounts keep a history and get re-ticketed if they remain unresolved past the SLA.
- Managing Slack Connect
Slack Engineering mediumAdeptSlack built per-connection configuration for Slack Connect using a single MySQL table keyed by source and target team ID, with org-level defaults modeled as target team 0 and settings stored as a Protobuf blob to avoid per-setting columns and tables. The application-layer store first grew into a tightly coupled monolith of per-pref logic, so it was refactored into a container that delegates to per-pref wrapper classes implementing transform, isValid and migrate, with exceptions isolated per pref. Wrapper classes won over code generation because each pref differed too much to template. For admin dashboards, multi-table reads over partitioned data caused latency and timeouts, so Slack denormalized connection data into Solr instead of MySQL, accepting a roughly five-second indexing delay in exchange for full indexing, array-field queries and dynamic fields that scale to millions of connections.
- Unified Grid: How We Re-Architected Slack for Our Largest Customers
Slack Engineering mediumAdeptSlack re-architected its backend and clients to replace the workspace-centric model, where session tokens carried a workspace ID used for shard routing and access control, with an org-wide Unified Grid view for Enterprise Grid customers. The work built on earlier Vitess resharding by channel ID and on RTM changes. APIs were fixed in one of three ways: allowing calls that no longer depended on workspace routing, prompting users to pick a workspace, or fanning queries out across the user's workspaces, capped at 50 relevant workspaces per user. The rollout used a "prototype the path" approach: dogfooding internally, two-pass API fixes, a parallel integration test suite run with org context, shared permission helpers and client data-store migrations, finishing in March 2024.