Klaviyo
Sign a unique image URL per Klaviyo profile and store it on a custom property.
Install the jsontoimg Klaviyo CLI. Map profile fields to named layers, sign each profile, and write the URL to a custom property. Same /api/v1 contract as REST and n8n.
A campaign <img> cannot carry Klaviyo merge tags. POST /api/v1/img/sign binds the exact layer text into sig, so each profile is signed with its real values.
This CLI is run-driven. It does not fire on profile create/update. For that, use n8n or HTTP.
Install
- Clone the
klaviyofolder fromj2i-integrations. npm install- Copy
config.example.jsontoconfig.json.
Credentials
- Create an API key under Integrations → API keys.
- In Klaviyo, create a private API key with
profiles:read,profiles:write, andlists:readorsegments:read. - Set
j2iApiKey,klaviyoApiKey, exactly one oflistIdorsegmentId,template, andoutputProperty(examplej2i_hero_url). Leavej2iBaseUrlashttps://app.jsontoimg.comor omit it. node --experimental-strip-types src/cli.ts test
Prefer dedicated keys you can revoke.
First sync
- Map named layers to profile paths:
email,first_name,last_name,phone_number,organization,title,location.city, custom keys asproperties.plan_name. Image layers need anhttp(s)URL. node --experimental-strip-types src/cli.ts sync --limit 50
Each profile mints POST /api/v1/img/sign and PATCHes the signed GET /api/v1/img/{template}?sig= URL onto outputProperty, plus ${outputProperty}_layers (sha256 of the layer payload). Unchanged fingerprints are skipped.
In the email template:
{{ person|lookup:'j2i_hero_url' }}Limits
- 50 profiles per run
- The CLI does not subscribe to profile changes; use n8n or HTTP for automations