Skip to content
DevOps AI ToolKit
Newsletter
All prompts
AI for Slack Difficulty: Advanced ClaudeChatGPTCursor

Slack User Group Membership Drift Audit Prompt

Reconcile Slack @-usergroup membership against an IdP/source of truth — detect drift, propose add/remove diffs, and auto-remediate on-call and team groups safely.

Target user
Platform and identity engineers keeping Slack user groups in sync with HR/IdP data
Difficulty
Advanced
Tools
Claude, ChatGPT, Cursor

The prompt

You are an identity-focused platform engineer who syncs Slack user groups with
an external source of truth and knows the usergroups API (usergroups.list,
usergroups.users.list, usergroups.users.update) and its full-replace semantics.

I will provide:
- The source of truth (IdP group export, HRIS team map, on-call schedule API)
- The Slack usergroup handles and the source keys they map to
- Match rules (email, SCIM externalId, employee id) and exclusions
- Cadence and safety requirements (approval gates, protected groups)

Your job:

1. **Fetch current state** — list usergroups (`include_disabled`, `include_users`)
   and per-group members via usergroups.users.list; normalize Slack user ids to
   the join key using users.lookupByEmail or a cached directory.

2. **Compute target state** — resolve each source group to a set of Slack user
   ids, handling users with no Slack account, deactivated members, and
   multi-workspace/Enterprise Grid identity.

3. **Diff** — per group, produce `to_add`, `to_remove`, `unchanged`, plus a
   confidence flag when a match is fuzzy (email mismatch, ambiguous name).

4. **Remediate safely** — because usergroups.users.update replaces the whole
   list, always send the FULL computed target set; show the exact payload and
   how to guard against an empty/near-empty target (fail closed if the target
   drops below a sanity threshold vs current).

5. **Approval & protected groups** — for groups tied to paging/escalation,
   require an approval step (Block Kit approve/deny) before applying removals;
   auto-apply only additive changes to low-risk groups.

6. **Reporting & observability** — a drift report (per group: counts, diff,
   unresolved users), an append-only change log, and an alert when drift
   exceeds a threshold or a group hasn't synced in N hours.

Output: (a) state-fetch snippet with pagination, (b) key-normalization logic,
(c) diff algorithm, (d) safe full-replace update call with the sanity guard,
(e) approval flow for protected groups, (f) drift report format and rollout
plan (report-only → additive-only → full reconcile).

Fail closed on ambiguity: never remove a user you cannot confidently match.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More Slack prompts & error guides

Browse every Slack prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.