| name | customerio-local-dev-loop |
| description | Configure Customer.io local development workflow.
Use when setting up local testing, dev/staging isolation,
or mocking Customer.io for unit tests.
Trigger: "customer.io local dev", "test customer.io locally",
"customer.io dev environment", "customer.io sandbox", "mock customer.io".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(npx:*), Glob, Grep |
| version | 1.14.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","customer-io","testing","development","workflow"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Customer.io Local Dev Loop
Overview
Set up an efficient local development workflow for Customer.io: environment isolation via separate workspaces, a dry-run client for safe development, test mocks for unit tests, and prefixed events that never pollute production data.
Prerequisites
customerio-node installed
- Separate Customer.io workspace for development (recommended — free workspaces available)
dotenv or similar for environment variable loading
Instructions
Step 1: Environment Configuration
CUSTOMERIO_SITE_ID=dev-site-id
CUSTOMERIO_TRACK_API_KEY=dev-track-key
CUSTOMERIO_APP_API_KEY=dev-app-key
CUSTOMERIO_REGION=us
CUSTOMERIO_DRY_RUN=false
CUSTOMERIO_EVENT_PREFIX=dev_
CUSTOMERIO_SITE_ID=not-needed
CUSTOMERIO_TRACK_API_KEY=not-needed
CUSTOMERIO_APP_API_KEY=not-needed
CUSTOMERIO_DRY_RUN=true
CUSTOMERIO_EVENT_PREFIX=test_
Step 2: Environment-Aware Client
import { TrackClient, APIClient, RegionUS, RegionEU } from "customerio-node";
interface CioConfig {
siteId: string;
trackApiKey: string;
appApiKey: string;
region: typeof RegionUS | typeof RegionEU;
dryRun: boolean;
eventPrefix: string;
}
function loadConfig(): CioConfig {
{
: process.. ?? ,
: process.. ?? ,
: process.. ?? ,
: process.. === ? : ,
: process.. === ,
: process.. ?? ,
};
}
{
: | = ;
: ;
: .;
() {
. = ();
. = ..();
(!..) {
. = (
..,
..,
{ : .. }
);
}
}
() {
prefixedId = ;
(..) {
.(, prefixedId, attributes);
;
}
.!.(prefixedId, attributes);
}
() {
prefixedId = ;
prefixedEvent = ;
(..) {
.(, prefixedId, prefixedEvent, data);
;
}
.!.(prefixedId, {
: prefixedEvent,
data,
});
}
() {
prefixedId = ;
(..) {
.(, prefixedId);
;
}
.!.(prefixedId);
}
}