Route new Shopify buyers into the right Flodesk nurture
Every new Shopify order sends the buyer into the right Flodesk segment, New, Repeat, or VIP, and starts their post-purchase emails.
Build a code workflow that runs whenever a new Shopify order is created, and routes the buyer into the right Flodesk segment plus the matching post-purchase email workflow using deterministic rules. Two integrations only: Shopify and Flodesk. No judgement step, the rules are fixed.
Trigger: a Shopify orders/create webhook. The webhook payload includes the order ID and the customer ID.
Configurable inputs the user sets up once when installing the workflow: NEW_SEGMENT_ID, REPEAT_SEGMENT_ID, VIP_SEGMENT_ID (Flodesk segment IDs), NEW_WORKFLOW_ID, REPEAT_WORKFLOW_ID, VIP_WORKFLOW_ID (Flodesk workflow IDs), and VIP_THRESHOLD (numeric, default 200, in the store's currency).
Step 1. Call Shopify Get Order with the order ID from the webhook payload to read the order total, the customer email, the customer first and last name, the customer ID, the line items, and whether the buyer opted out of marketing.
Step 2. Call Shopify Get Customer Orders for the customer ID and count how many total orders this customer has (including the one that just came in).
Step 3. Apply the rules. If the customer's total order count is 1, flag them as new. If the count is greater than 1, flag them as repeat. Independently, if the order total is greater than or equal to VIP_THRESHOLD, also flag them as VIP. Build the list of Flodesk segment IDs from whichever flags are set (a first-time big spender lands in both the New segment and the VIP segment). Pick a single post-purchase workflow ID by priority: VIP wins over Repeat, Repeat wins over New.
Step 4. If the customer email is missing or the buyer opted out of marketing, log the decision and stop, do not write to Flodesk.
Step 5. Call Flodesk Create or Update Subscriber with the customer's email, first name, and last name. Then call Flodesk Add Subscriber to Segments with the chosen segment IDs. Then call Flodesk Add Subscriber to Workflow with the chosen workflow ID to enroll them in the matching post-purchase nurture.
Return a small JSON summary with the customer email, order total, total order count, the segment IDs that were applied, and the workflow ID they were enrolled into, so the run history is easy to debug.
Additional information
What does this prompt do?
- Listens for every new Shopify order and reads who bought, what they bought, and how much they spent.
- Sorts the buyer into the right Flodesk segment: New Customer for first-time buyers, Repeat Customer for everyone else, and VIP for orders above the threshold you set.
- Adds the buyer to Flodesk as a subscriber and enrolls them in the matching post-purchase email workflow.
- Runs in seconds after checkout, so your nurture emails always match what the buyer just did.
What do I need to use this?
- A Shopify store you can connect with admin access
- A Flodesk account with the segments and workflows you want buyers added to
- Segment IDs for your New Customer, Repeat Customer, and VIP segments
- An order total threshold for VIP (the example uses 200 in your store currency)
How can I customize it?
- Change the VIP order threshold to match your average order value.
- Swap which Flodesk segments and post-purchase workflows new, repeat, and VIP buyers get added to.
- Add extra rules for product collections, discount codes, or shipping country so buyers land in even more specific tracks.
Frequently asked questions
Will this create duplicate subscribers in Flodesk?
What counts as a repeat buyer?
Can a buyer land in more than one Flodesk segment?
Does the VIP threshold have to be in US dollars?
How fast does the buyer land in Flodesk after checkout?
Stop manually tagging buyers in Flodesk.
Connect Shopify and Flodesk once, and every new order picks its own segment and post-purchase nurture.