/intercom-pack:intercom-reference-architecturefrom intercom-pack
Scaffolds or reviews Intercom integrations using a four-layer architecture (API/webhook, service, client, infrastructure) with type-safe SDK usage, webhook processing, contact sync, and Help Center management.
Ships in intercom-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A production-ready reference architecture for Intercom integrations built on four layers — API/webhook, service, Intercom client, and infrastructure — with type-safe SDK usage, webhook processing, contact sync, and Help Center management. Use it to scaffold a new integration or to review an existing one against a known-good structure.
The layers (top to bottom): the API / Webhook layer (Express routes, webhook
endpoints) calls into the service layer (contacts, conversations, articles —
business logic and orchestration), which calls the Intercom client layer (a
singleton intercom-client SDK wrapper with typed errors, caching, and rate
limit handling), all resting on infrastructure (Redis cache, job queue,
monitoring). Keeping dependencies flowing strictly downward is what prevents the
circular imports and test-isolation problems listed under Error Handling.
intercom-client npm package
installed.INTERCOM_ACCESS_TOKEN environment variable (see
Step 1). Create one under Intercom → Developer Hub → your app →
Authentication. Never commit it; load it from the environment.X-Hub-Signature header on inbound webhook POSTs.Use Read/Grep to inspect the current project layout, then build each layer
in order — the client layer is the dependency root for every service.
Client layer (src/intercom/client.ts) — a lazy singleton
getClient() that reads INTERCOM_ACCESS_TOKEN once, plus an
IntercomServiceError that wraps raw SDK errors into a typed, retry-aware
shape. Skeleton:
let instance: IntercomClient | null = null;
export function getClient(): IntercomClient {
if (!instance) {
const token = process.env.INTERCOM_ACCESS_TOKEN;
if (!token) throw new Error("INTERCOM_ACCESS_TOKEN required");
instance = new IntercomClient({ token });
}
return instance;
}
Contacts service (src/services/contacts.service.ts) —
findOrCreate (search-before-create to avoid 409s), syncFromCRM,
mergeLead, and a searchAll async generator for cursor pagination.
Conversations service (src/services/conversations.service.ts) —
replyAsAdmin, addNote, closeWithMessage, and a scoped open-queue
search.
Articles service (src/services/articles.service.ts) — Help Center
article create/list, defaulting new articles to draft.
Wire the data flow — Intercom pushes events to your webhook router; the service layer makes API calls back and persists to your database + cache.
The full project tree, every service method, and the layer/data-flow diagrams are in the full implementation walkthrough; the complete directory layout is in project-structure.md.
Applying this skill produces a layered Intercom integration:
src/intercom/ client layer (singleton SDK wrapper + typed errors).src/services/ layer with contacts, conversations, and articles services.src/webhooks/, src/sync/, src/api/, and src/cache/ directories wired
to the layers above.config/ files and a tests/ tree with unit + integration
suites.When used to review an existing project, the output is a gap report: which layers exist, which are missing, and where dependency direction is violated.
| Issue | Cause | Solution |
|---|---|---|
| Circular dependencies | Service A imports B imports A | Use dependency injection |
| Client initialization race | Async token fetch | Lazy singleton pattern |
| Cache inconsistency | Stale data after update | Webhook-driven invalidation |
| Test isolation | Shared SDK state | resetClient() in beforeEach |
401 Unauthorized | Missing/invalid INTERCOM_ACCESS_TOKEN | Verify the env var is loaded before getClient() |
429 Too Many Requests | Rate limit exceeded | Retry with backoff — IntercomServiceError.retryable is true here |
Once the client and service layers exist, wiring them together is a few lines — sync a CRM user, reply to and close a conversation, page through contacts, or publish an article:
const contacts = new ContactsService();
const contact = await contacts.syncFromCRM({
id: "crm_8842", email: "[email protected]", name: "Ada Lovelace",
plan: "enterprise", company: "Analytical Engines Ltd",
});
See examples.md for the full set of runnable usage snippets (conversation reply/close, paginated search, Help Center publish).
For multi-environment configuration and deployment, see the
intercom-multi-env-setup skill, which extends the config/ layer described
above into per-environment credential and rate-limit management.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
intercom, reference-architecture, integration-patterns, webhooks, saas
24 skills in this plugin
/intercom-ci-integrationConfigure CI/CD pipelines for Intercom integrations with GitHub Actions.
Use when setting up automated testing, configuring CI with Intercom secrets,
or integrating Intercom API tests into your build process.
Trigger with phrases like "intercom CI", "intercom GitHub Actions",
"intercom automated tests", "CI intercom", "intercom pipeline".
/intercom-common-errorsDiagnose and fix Intercom API errors by HTTP status code and error type.
Use when encountering Intercom errors, debugging failed API requests,
or troubleshooting integration issues.
Trigger with phrases like "intercom error", "fix intercom",
"intercom not working", "debug intercom", "intercom 401", "intercom 429".
/intercom-core-workflow-aManage Intercom contacts: create, search, update, merge leads into users.
Use when building contact management features, syncing user data, or implementing contact search and segmentation against the Intercom REST API.
Trigger with phrases like "intercom contacts", "intercom users", "intercom leads", "create intercom contact", "search intercom contacts", "merge intercom lead".
/intercom-core-workflow-bManage Intercom conversations: create, reply, close, snooze, assign, and tag.
Use when building conversation management features, automating replies,
or implementing support workflow automation.
Trigger with phrases like "intercom conversations", "intercom reply",
"intercom assign conversation", "intercom close conversation",
"intercom snooze", "manage intercom conversations".
/intercom-cost-tuningOptimize Intercom API costs through caching, request reduction, and usage monitoring.
Use when analyzing Intercom API usage, reducing unnecessary requests,
or implementing usage tracking and budget awareness.
Trigger with phrases like "intercom cost", "intercom billing",
"reduce intercom requests", "intercom pricing", "intercom usage", "intercom budget".
/intercom-data-handlingImplement Intercom data handling for GDPR, contact export, data retention, and PII.
Use when handling sensitive Intercom contact data, fulfilling a data subject access or deletion request, redacting PII in logs, or setting retention policy for cached Intercom records.
Trigger with phrases like "intercom data", "intercom PII",
"intercom GDPR", "intercom data retention", "intercom privacy", "intercom CCPA",
"intercom data export", "intercom delete contact".
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin intercom-packOther plugins' skills for the same job