Skip to main content

Scenario

Your Customer.io campaigns generate open, click, and conversion metrics across email, push, and in-app channels. But you never synthesize which message types actually perform — is it urgency-driven subject lines? Personalized value props? Social proof? This job pulls campaign metrics from the App API, identifies the highest-performing message patterns, then feeds those patterns to Mave Agent for analysis and Mavera Generate to produce new variations that extend the winning formula. Flow: Customer.io App API /v1/campaigns/{id}/metrics → Rank campaigns by conversion → Extract winning copy patterns → Mave POST /api/v1/mave/chat (pattern analysis) → POST /api/v1/generations (new variations)

Architecture

Code

Example Output

Error Handling

The App API is strict at 10 req/sec. Code includes 120ms delay between requests. For workspaces with 50+ campaigns, batch in groups of 8 with 1s pauses between batches.
New campaigns may return empty series arrays. The code defaults to [0] to avoid division errors. Filter out campaigns with fewer than 100 sends for meaningful CTR.
The /actions endpoint returns message variants. Multi-variant campaigns have multiple actions. The code limits to 2 per campaign to stay within rate limits.

What’s Next

Customer.io Integration

Back to Customer.io integration overview

Customer Attribute Personas

Build attribute-clustered personas from Customer.io segments

Mave Agent

Full reference for POST /api/v1/mave/chat

Generate API

Full reference for POST /api/v1/generations