Klaviyo Hello World
SkillDev tools'Create a minimal working Klaviyo example with real API calls.
Use Klaviyo Hello World in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add Klaviyo Hello World and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the Klaviyo Hello World skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; Ahel provides instructions and does not run this skill.
No other account needed.
Add Ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
What this skill tells your AI
The instructions your AI receives, as published by jeremylongshore/tons-of-skills-marketplace in skills/.curated/klaviyo-hello-world/SKILL.md and read by Ahel’s review.
Overview
Minimal working example: create a profile, track an event, and query the result
using the klaviyo-api Node.js SDK against a.klaviyo.com/api/*. This is the
smoke test that proves your API key, SDK install, and network path all work
end-to-end before you build anything real.
Prerequisites
- Completed the
klaviyo-install-authsetup so credentials are in place. KLAVIYO_PRIVATE_KEYexported in your environment (a private API key with Profiles and Events scopes).klaviyo-apiinstalled in the project (npm install klaviyo-api).tsxavailable to run the TypeScript file (npx tsx …).
Instructions
Write the code into a single hello-klaviyo.ts file, then run it with
npx tsx hello-klaviyo.ts. The full script performs four things in order:
-
Create a profile —
profilesApi.createProfile(...)with a JSON:API payload. The essential skeleton:import { ApiKeySession, ProfilesApi, ProfileEnum } from 'klaviyo-api'; const session = new ApiKeySession(process.env.KLAVIYO_PRIVATE_KEY!); const profilesApi = new ProfilesApi(session); const profile = await profilesApi.createProfile({ data: { type: ProfileEnum.Profile, attributes: { email: 'hello@example.com', firstName: 'Hello', lastName: 'World' }, }, }); console.log('Profile created:', profile.body.data.id); -
Track an event —
eventsApi.createEvent(...)with ametric(created on first use) linked to the profile by email. -
Retrieve the profile —
profilesApi.getProfiles({ filter: '...' })to confirm the write landed. -
Run the combined script —
npx tsx hello-klaviyo.ts.
For the complete step-by-step code (all payloads with camelCase and JSON:API detail), see the full walkthrough. For the single combined runnable script and variations, see worked examples.
Output
Running the combined script prints one line per operation. The profile ID is a
26-character ULID; Verified echoes the firstName read back from the API,
proving the round trip succeeded:
Profile created: 01JXXXXXXXXXXXXXXXXXXXXXX
Event tracked successfully
Verified: Hello
Error Handling
| Error | Status | Cause | Solution |
|---|---|---|---|
Duplicate profile | 409 | Email already exists | Use createOrUpdateProfile instead |
Invalid email format | 400 | Malformed email | Validate email before sending |
Missing metric name | 400 | Empty metric object | Always include metric.data.attributes.name |
Unauthorized | 401 | Bad API key | Check KLAVIYO_PRIVATE_KEY env var |
Examples
The canonical example is the single combined script that creates a profile,
tracks an event, and reads the profile back — see the
worked examples for the full file plus two common
variations (idempotent upsert with createOrUpdateProfile, and a revenue event
that sets value). The core shape of every call is the same JSON:API envelope:
await eventsApi.createEvent({
data: {
type: 'event',
attributes: {
metric: { data: { type: 'metric', attributes: { name: 'Hello World Test' } } },
profile: { data: { type: 'profile', attributes: { email: 'hello@example.com' } } },
properties: { source: 'hello-world' },
time: new Date().toISOString(),
},
},
});
Key SDK Conventions
- camelCase properties: The SDK uses
firstName,phoneNumber,lastName(not snake_case) - JSON:API format: All payloads use
{ data: { type, attributes } }structure - Response body: Access via
response.body.data(notresponse.data) - Profile identifiers: Use
email,phoneNumber, orexternalIdto identify profiles
Resources
Next Steps
Proceed to klaviyo-local-dev-loop for development workflow setup, or
klaviyo-core-workflow-a for profile and list management.
Signals
- GitHub stars
- 3k
- Forks
- 415
- Last commit
- Oct 2026
Ahel review
K1binfo
installs-packages
Automated review, not a security audit. Ruleset v1+k2.
Advanced
- Item type
- skill
- Key
klaviyo-hello-world- Source
- github.com/jeremylongshore/tons-of-skills-marketplace
github.com/jeremylongshore/tons-of-skills-marketplace
Related picks
Skill · thedaviddias
The pick for JavaScriptmodern-javascript-patterns
Skill · wshobson
The pick for JavaScriptsetup-ts-deep-modules
Skill · mattpocock
The pick for TypeScripttypescript-pro
Skill · jeffallan
The pick for TypeScripthandsontable-playwright-e2e
Skill · handsontable
The pick for End-to-end testingmstar-e2e
Skill · btspoony
The pick for End-to-end testing