Skip to main content

Scenario

Customer.io’s reporting webhooks fire on critical events — email bounces, unsubscribes, conversions, subscription changes. When a high-value customer unsubscribes, you don’t want to find out in a weekly report. This job sets up a webhook receiver that listens for specific events, maps the customer to a persona type using their attributes, then triggers Mave Agent to research retention strategies tailored to that persona. The result is an immediate, actionable research brief every time a churn signal fires. Flow: Customer.io Reporting Webhook → Filter high-value events → Look up customer attributes → Map to persona type → Mavera POST /api/v1/mave/chat: “Research retention strategies for {persona type}” → Research brief

Architecture

Code

Example Output

Error Handling

Customer.io signs webhooks with HMAC SHA-256. Set CIO_WEBHOOK_SECRET from your workspace settings. The code gracefully skips verification if no secret is set (dev mode only — always verify in production).
If the customer was deleted or the App API is down, attributes will be empty. The code continues with defaults but the persona classification will be generic. Consider caching attributes locally.
Customer.io uses event_type in some webhook versions and metric in others. The code checks both fields. Test with Customer.io’s webhook tester before deploying.
During a campaign blast, hundreds of events may fire simultaneously. Use a queue (Redis, SQS) between the webhook handler and Mave calls to avoid overwhelming Mavera’s 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

Campaign Messaging Strategy

Analyze campaign metrics for winning patterns

Mave Agent

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