intercom-local-dev-loop
Configure Intercom local development with testing, mocking, and hot reload. Use when setting up a development environment, writing tests against the Intercom API, or establishing a fast iteration cycle. Trigger with phrases like "intercom dev setup", "intercom local development", "intercom dev environment", "develop with intercom", "test intercom locally".
What this skill does
# Intercom Local Dev Loop
## Overview
Set up a fast local development workflow for Intercom integrations with proper test isolation, mocking strategies, and webhook tunneling.
## Prerequisites
- Completed `intercom-install-auth` setup
- Node.js 18+ with npm/pnpm
- A test/development Intercom workspace (separate from production)
## Instructions
### Step 1: Project Structure
```
my-intercom-app/
├── src/
│ ├── intercom/
│ │ ├── client.ts # Singleton client
│ │ ├── contacts.ts # Contact operations
│ │ ├── conversations.ts # Conversation operations
│ │ └── types.ts # Intercom type extensions
│ └── index.ts
├── tests/
│ ├── mocks/
│ │ └── intercom.ts # Mock client factory
│ ├── contacts.test.ts
│ └── conversations.test.ts
├── .env.development # Dev workspace token
├── .env.test # Test config (mocked)
├── .env.example # Template
└── package.json
```
### Step 2: Environment Configuration
```bash
# .env.example (commit this)
INTERCOM_ACCESS_TOKEN=
INTERCOM_WEBHOOK_SECRET=
NODE_ENV=development
# .env.development (git-ignored, real dev workspace token)
INTERCOM_ACCESS_TOKEN=dG9rOmRldl90b2tlbl9oZXJl
INTERCOM_WEBHOOK_SECRET=your-webhook-secret
NODE_ENV=development
```
### Step 3: Client Singleton with Environment Awareness
```typescript
// src/intercom/client.ts
import { IntercomClient } from "intercom-client";
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 not set. Copy .env.example to .env.development"
);
}
instance = new IntercomClient({ token });
}
return instance;
}
// Reset for testing
export function resetClient(): void {
instance = null;
}
```
### Step 4: Mock Client for Tests
```typescript
// tests/mocks/intercom.ts
import { vi } from "vitest";
export function createMockClient() {
return {
contacts: {
create: vi.fn().mockResolvedValue({
type: "contact",
id: "mock-contact-id",
role: "user",
email: "[email protected]",
name: "Test User",
external_id: "ext-123",
custom_attributes: {},
created_at: 1711100000,
updated_at: 1711100000,
}),
find: vi.fn().mockResolvedValue({
type: "contact",
id: "mock-contact-id",
email: "[email protected]",
}),
search: vi.fn().mockResolvedValue({
type: "list",
data: [],
total_count: 0,
pages: { type: "pages", page: 1, per_page: 50, total_pages: 0 },
}),
list: vi.fn().mockResolvedValue({
type: "list",
data: [],
total_count: 0,
pages: { next: null },
}),
update: vi.fn(),
delete: vi.fn(),
tag: vi.fn(),
untag: vi.fn(),
},
conversations: {
create: vi.fn().mockResolvedValue({
type: "conversation",
id: "mock-convo-id",
state: "open",
}),
find: vi.fn(),
list: vi.fn().mockResolvedValue({
type: "conversation.list",
conversations: [],
pages: { next: null },
}),
reply: vi.fn(),
close: vi.fn(),
assign: vi.fn(),
},
messages: {
create: vi.fn().mockResolvedValue({
type: "user_message",
id: "mock-msg-id",
}),
},
admins: {
list: vi.fn().mockResolvedValue({
type: "admin.list",
admins: [{ id: "admin-1", name: "Test Admin", email: "[email protected]" }],
}),
},
tags: {
create: vi.fn().mockResolvedValue({ type: "tag", id: "tag-1", name: "test" }),
list: vi.fn().mockResolvedValue({ type: "list", data: [] }),
},
};
}
```
### Step 5: Write Tests
```typescript
// tests/contacts.test.ts
import { describe, it, expect, vi, beforeEach } from "vitest";
import { createMockClient } from "./mocks/intercom";
describe("Contact Operations", () => {
let mockClient: ReturnType<typeof createMockClient>;
beforeEach(() => {
mockClient = createMockClient();
});
it("should create a user contact", async () => {
const contact = await mockClient.contacts.create({
role: "user",
externalId: "user-123",
email: "[email protected]",
});
expect(contact.id).toBe("mock-contact-id");
expect(contact.role).toBe("user");
expect(mockClient.contacts.create).toHaveBeenCalledWith({
role: "user",
externalId: "user-123",
email: "[email protected]",
});
});
it("should search contacts by email", async () => {
await mockClient.contacts.search({
query: { field: "email", operator: "=", value: "[email protected]" },
});
expect(mockClient.contacts.search).toHaveBeenCalledOnce();
});
});
```
### Step 6: Webhook Testing with ngrok
```bash
# Install ngrok
npm install -g ngrok
# Start your local server
npm run dev # Starts on port 3000
# Tunnel to expose locally
ngrok http 3000
# Use the HTTPS URL (e.g., https://abc123.ngrok.io) as your webhook URL
# in Intercom Developer Hub > Webhooks
```
### Step 7: Package Scripts
```json
{
"scripts": {
"dev": "tsx watch src/index.ts",
"test": "vitest",
"test:watch": "vitest --watch",
"test:integration": "INTERCOM_ACCESS_TOKEN=$INTERCOM_DEV_TOKEN vitest --config vitest.integration.config.ts",
"typecheck": "tsc --noEmit"
}
}
```
## Integration Test Pattern
```typescript
// tests/integration/contacts.integration.test.ts
import { describe, it, expect } from "vitest";
import { IntercomClient } from "intercom-client";
const client = new IntercomClient({
token: process.env.INTERCOM_ACCESS_TOKEN!,
});
describe.skipIf(!process.env.INTERCOM_ACCESS_TOKEN)("Contacts Integration", () => {
it("should create and retrieve a contact", async () => {
const created = await client.contacts.create({
role: "lead",
name: `Integration Test ${Date.now()}`,
});
expect(created.id).toBeDefined();
// Clean up
await client.contacts.delete({ contactId: created.id });
});
});
```
## Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| `INTERCOM_ACCESS_TOKEN not set` | Missing .env file | Copy `.env.example` to `.env.development` |
| Port 3000 in use | Another process | `lsof -i :3000` and kill, or change port |
| ngrok tunnel expired | Free tier 2h limit | Restart ngrok or use paid plan |
| Mock type mismatch | SDK updated | Regenerate mocks from SDK types |
| `rate_limit_exceeded` in dev | Dev workspace limits | Add delays between integration tests |
## Resources
- [intercom-client npm](https://www.npmjs.com/package/intercom-client)
- [Vitest Documentation](https://vitest.dev/)
- [ngrok](https://ngrok.com/)
## Next Steps
See `intercom-sdk-patterns` for production-ready code patterns.
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.