home / skills / jeremylongshore / claude-code-plugins-plus-skills / customerio-hello-world

This skill helps you learn and test Customer.io by identifying a user and sending a basic hello_world event in your integration.

npx playbooks add skill jeremylongshore/claude-code-plugins-plus-skills --skill customerio-hello-world

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.1 KB
---
name: customerio-hello-world
description: |
  Create a minimal working Customer.io example.
  Use when learning Customer.io basics, testing SDK setup,
  or creating your first messaging integration.
  Trigger with phrases like "customer.io hello world", "first customer.io message",
  "test customer.io", "customer.io example".
allowed-tools: Read, Write, Edit, Bash(npm:*), Bash(pip:*), Grep
version: 1.0.0
license: MIT
author: Jeremy Longshore <[email protected]>
---

# Customer.io Hello World

## Overview
Create a minimal working Customer.io example that identifies a user and triggers an event.

## Prerequisites
- Completed `customerio-install-auth` skill
- Customer.io SDK installed
- Valid Site ID and API Key configured

## Instructions

### Step 1: Create Basic Integration
```typescript
// hello-customerio.ts
import { TrackClient, RegionUS } from '@customerio/track';

const client = new TrackClient(
  process.env.CUSTOMERIO_SITE_ID!,
  process.env.CUSTOMERIO_API_KEY!,
  { region: RegionUS }
);

async function main() {
  // Step 1: Identify a user
  await client.identify('user-123', {
    email: '[email protected]',
    first_name: 'Hello',
    created_at: Math.floor(Date.now() / 1000)
  });
  console.log('User identified');

  // Step 2: Track an event
  await client.track('user-123', {
    name: 'hello_world',
    data: {
      source: 'sdk-test',
      timestamp: new Date().toISOString()
    }
  });
  console.log('Event tracked');
}

main().catch(console.error);
```

### Step 2: Run the Example
```bash
npx ts-node hello-customerio.ts
```

### Step 3: Verify in Dashboard
1. Go to Customer.io dashboard
2. Navigate to People section
3. Search for "user-123" or "[email protected]"
4. Verify user profile shows attributes
5. Check Activity tab for "hello_world" event

## Output
- User created/updated in Customer.io
- Event recorded in user's activity log
- Console output confirming success

## Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| 401 Unauthorized | Invalid credentials | Verify Site ID and API Key |
| 400 Bad Request | Invalid data format | Check attribute names and types |
| User not found | Identify not called | Always identify before tracking events |
| Event not showing | Dashboard delay | Wait 1-2 minutes and refresh |

## Examples

### Python Hello World
```python
import os
from customerio import CustomerIO

cio = CustomerIO(
    site_id=os.environ.get('CUSTOMERIO_SITE_ID'),
    api_key=os.environ.get('CUSTOMERIO_API_KEY')
)

# Identify user
cio.identify(id='user-123', email='[email protected]', first_name='Hello')
print('User identified')

# Track event
cio.track(customer_id='user-123', name='hello_world', source='sdk-test')
print('Event tracked')
```

### With Anonymous User
```typescript
// Track anonymous user with device ID
await client.identify('device-abc123', {
  anonymous_id: 'device-abc123',
  platform: 'web'
});
```

## Resources
- [Identify API](https://customer.io/docs/api/track/#operation/identify)
- [Track API](https://customer.io/docs/api/track/#operation/track)

## Next Steps
After verifying hello world works, proceed to `customerio-local-dev-loop` to set up your development workflow.

Overview

This skill provides a minimal working Customer.io example that identifies a user and sends a simple event. It's designed for learning Customer.io basics, verifying SDK setup, and creating a first messaging integration. The example includes both TypeScript and Python snippets and steps to run and verify results in the dashboard.

How this skill works

The skill shows how to call Customer.io's Identify API to create or update a person, then call the Track API to record an event on that person. It initializes a Track client with your Site ID and API Key, performs an identify call, then sends a named event with simple metadata. Console output confirms success and the dashboard can be used to verify the results.

When to use it

  • When learning how to use Customer.io SDKs for the first time
  • To verify Site ID and API Key are correctly configured
  • When creating a basic messaging integration or onboarding test
  • To reproduce a minimal identify + track flow for debugging
  • When testing anonymous or device-based identification

Best practices

  • Always set CUSTOMERIO_SITE_ID and CUSTOMERIO_API_KEY in environment variables
  • Call identify before tracking events for a given customer_id
  • Use created_at timestamps in seconds for user attributes where relevant
  • Handle API errors (401, 400) and retry or surface clear messages
  • Check the dashboard activity tab and allow a 1–2 minute delay for events

Example use cases

  • Run a quick smoke test of Customer.io credentials and SDK connectivity
  • Create a first demo that shows a user profile and a single custom event
  • Validate event payload structure when building automated campaigns
  • Test anonymous device tracking by identifying with a device ID
  • Train teammates on basic identify + track flows using the provided snippets

FAQ

What prerequisites are required?

Install and authenticate the Customer.io SDK and ensure SITE ID and API KEY are set in environment variables.

Why doesn't my event show up immediately in the dashboard?

Dashboard updates can be delayed; wait 1–2 minutes and refresh. Verify identify was called first and payloads are valid.