Shopify and Klaviyo: AI Customer-Segment Classifier Template

A scheduled Spojit workflow lists your Shopify customers, classifies each one into a value segment with an Agent-mode Connector node, and adds matching profiles to the right Klaviyo list.

What It Builds

This template starts on a Schedule trigger that runs on a cron you choose. A Connector node on the shopify connector calls list-customers to pull recent customers, then a Loop walks each one. Inside the loop, an Agent-mode Connector node reads each customer's order history and total spend and returns a value segment ("VIP", "Loyal", "At Risk", or "New") as structured output. A Condition routes each result, and a Connector node on the klaviyo connector calls add-profiles-to-list so the profile lands on the correct segment list. The outcome: your Klaviyo audiences stay sorted by value without anyone exporting a spreadsheet.

The Prompt

Paste this into Miraxa, the intelligent layer across your automation, and it builds the workflow and connects the tools for you:

Build a scheduled workflow that runs every morning at 7am Australia/Sydney. List my Shopify customers, then loop over each one and use an Agent-mode Connector node with a response schema to classify the customer into a value segment of VIP, Loyal, At Risk, or New based on their total spend and order history, returning the segment as {{ classification.segment }}. Based on the segment, add the customer's profile to the matching Klaviyo list using add-profiles-to-list.

Connectors Used

  • Schedule trigger - runs the classifier on a cron you set (for example 0 7 * * * with an IANA timezone).
  • shopify - list-customers pulls the customers to classify; get-customer can enrich a single record if needed.
  • klaviyo - add-profiles-to-list places each classified profile on the right segment list; list-lists helps you confirm list IDs.

Customize It

The obvious knobs to change in the prompt: the cron expression and timezone, the segment names and the spend thresholds the agent uses to decide them, and which Klaviyo list each segment maps to. You can also narrow list-customers to only customers updated since the last run, or add a Send Email node at the end to email yourself a count per segment. Tune all of this in the prompt before you run it, then fine-tune individual fields in the properties panel.

Tips

  • Define a clear Response Schema on the Agent-mode node so the segment always comes back as one of your fixed values; this keeps the downstream Condition reliable.
  • Use Direct mode for the Shopify and Klaviyo calls (they are predictable single-tool actions with no AI cost) and reserve Agent mode for the classification step that needs judgment.
  • Confirm your Klaviyo list IDs with list-lists first so each segment routes to the audience you expect.

Related

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.