Skip to main content

Scenario

Your store uses customer metafields for loyalty tier, preferences, communication preferences, or NPS scores. You pull these via GraphQL, match customers to existing Mavera personas by cohort, and enrich those personas with real-world attributes.

Architecture

Code

Example Output

Error Handling

If the namespace doesn’t match your store’s config, the response returns an empty array without error. Check namespaces in Shopify Admin → Settings → Custom data → Customers. Common namespaces: custom, global, or app-specific like loyalty_app.
If a persona was deleted or the ID is stale, PATCH returns 404. Always fetch the latest list with GET /api/v1/personas before updating. If the persona no longer exists, create a new one with POST.