---
name: intercom-enterprise-rbac
description: |-
  Configure Intercom enterprise OAuth, admin roles, and app-level access control.
  Use when implementing OAuth integration, managing admin permissions, or setting
  up organization-level controls for Intercom — e.g. gating a delete endpoint by
  role, installing a public app for a customer workspace, or adding admin audit
  logging.
  Trigger with phrases like "intercom OAuth", "intercom RBAC", "intercom
  enterprise", "intercom roles", "intercom permissions", "intercom admin access".
allowed-tools: Read, Write, Edit
version: 1.6.0
license: MIT
author: Jeremy Longshore <jeremy@intentsolutions.io>
tags:
  - saas
  - support
  - messaging
  - intercom
compatibility: Designed for Claude Code
title: intercom-enterprise-rbac
canonical_url: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/intercom-enterprise-rbac
last_updated: 2026-10-07T06:06:28.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/examples.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/intercom-enterprise-rbac/references/examples.md), [references/implementation.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/intercom-enterprise-rbac/references/implementation.md).
>
> If the user asked to install this Skill, run `npx skilld install jeremylongshore/tons-of-skills-marketplace/intercom-enterprise-rbac`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/intercom-enterprise-rbac`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/jeremylongshore/tons-of-skills-marketplace/intercom-enterprise-rbac) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/intercom-enterprise-rbac`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/intercom-enterprise-rbac --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/intercom-enterprise-rbac --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Intercom Enterprise RBAC

## Overview

Configure enterprise-grade access control for Intercom integrations with OAuth
scopes, admin role management, and app-level permission enforcement.

The workflow covers the full path: enumerate the workspace's admins and teams,
authorize a public app with least-privilege scopes, enforce per-operation
permissions at the application layer, route conversations to teams, and audit
sensitive admin actions.

The high-level workflow lives here; complete, copy-ready code for every step is in
[references/implementation.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/intercom-enterprise-rbac/references/implementation.md), and end-to-end
scenarios are in [references/examples.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/intercom-enterprise-rbac/references/examples.md).

## Prerequisites

- Intercom workspace with admin access
- Understanding of OAuth 2.0 flows
- For public apps: OAuth configured in Developer Hub
- `intercom-client` installed and `INTERCOM_ACCESS_TOKEN` (or OAuth client
  credentials) available in the environment

## Intercom Admin Roles

Intercom has built-in admin roles that control workspace access:

| Role | API Access | Capabilities |
|------|-----------|-------------|
| Owner | Full | All operations, billing, workspace settings |
| Admin | Full | Manage contacts, conversations, content |
| Agent | Limited | Reply to conversations, view contacts |
| Custom roles | Configurable | Enterprise plan feature |

These built-in roles govern access inside the Intercom UI and API. Map them onto
explicit permissions (Step 3) rather than trusting the role name alone.

## Instructions

Follow the five steps in order. Each step's full code is in
[references/implementation.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/intercom-enterprise-rbac/references/implementation.md) under the matching
heading — the skeletons below show the essential call surface.

### Step 1: List admins and roles

Enumerate every admin and team to map real identities to permissions.

```typescript
const client = new IntercomClient({ token: process.env.INTERCOM_ACCESS_TOKEN! });
const adminList = await client.admins.list();
// admin.type is "admin" or "team" — teams are used for routing in Step 4
```

### Step 2: OAuth scope-based access control

For public apps, request the **minimal** scopes required, build the authorization
URL with a CSRF `state`, and exchange the returned code for a per-workspace token.

```typescript
const authUrl = getAuthUrl(crypto.randomUUID());  // redirect the user here
const { token } = await exchangeCode(code);        // on callback
```

Store one token per workspace (`WorkspaceAuth`) for multi-tenant installs. Full
exchange + storage code: see references.

### Step 3: App-level permission enforcement

Define an explicit `IntercomPermission` union, map each role to a permission set,
and gate operations with middleware — never rely on the role name at the call site.

```typescript
function checkPermission(role: string, perm: IntercomPermission): boolean { /* … */ }
app.delete("/api/contacts/:id", requirePermission("contacts:delete"), handler);
```

### Step 4: Team-based conversation assignment

Filter admins where `type === "team"`, then assign conversations to the right
team by topic via `client.conversations.assign(...)`.

### Step 5: Audit logging for admin actions

Record every privileged action to a durable audit store, mirror it as an Intercom
data event for visibility, and warn on `delete`/`settings` operations.

For the OAuth scope-to-endpoint mapping, see the **OAuth Scope Reference** table
in [references/implementation.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/intercom-enterprise-rbac/references/implementation.md).

## Output

Applying this skill produces:

- An admin/team inventory printed from `client.admins.list()` (name, email, id, type).
- A working OAuth authorization + token-exchange flow that yields a per-workspace
  access token stored as a `WorkspaceAuth` record.
- A permission layer (`ROLE_PERMISSIONS`, `checkPermission`, `requirePermission`)
  that returns `403 Forbidden` with the missing permission when a caller lacks it.
- Topic-based team routing on conversations.
- Audit entries in the audit store plus mirrored `admin-action-logged` Intercom data
  events, with console warnings on sensitive actions.

## Error Handling

| Issue | Cause | Solution |
|-------|-------|----------|
| OAuth callback fails | Wrong redirect URI | Match exactly in Developer Hub |
| `forbidden` (403) | Missing OAuth scope | Add scope, user must re-authorize |
| Token revoked | User uninstalled app | Handle gracefully, notify admin |
| Admin not found | Admin left workspace | Remove from the local system |
| Team assignment fails | Team ID invalid | List teams first with `admins.list()` |

## Examples

- **Gate a delete endpoint by role** — only owners reach the handler; agents get
  a structured `403`. See [references/examples.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/intercom-enterprise-rbac/references/examples.md) § Example 1.
- **Install a public app for a new customer workspace** — consent → code exchange
  → per-workspace token persistence. See § Example 2.
- **Route + audit a sensitive assignment in one flow** — route to the billing team
  and record the action. See § Example 3.

## Resources

- [Authentication](https://developers.intercom.com/docs/build-an-integration/learn-more/authentication)
- [Setting up OAuth](https://developers.intercom.com/docs/build-an-integration/learn-more/authentication/setting-up-oauth)
- [OAuth Scopes](https://developers.intercom.com/docs/build-an-integration/learn-more/authentication/oauth-scopes)
- [Admins API](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/admins)

## Next Steps

For major workspace migrations that move data and reconfigure roles at scale, see
the `intercom-migration-deep-dive` skill, which builds on the RBAC primitives
established here.
