Ensure unique customers are processed by Get Customer Data

Setup: 2 workflows work side by side

Workflow 1: triggered by schedule time, processes 100 customers every 10 minutes, checks their eligibility via run code, and tags them if they are eligible

Workflow 2: triggered by the tag, will send an email, remove the tag, and add another tag that ensures they will not enter the Workflow 1.

We have 10,000 customers.

How do I ensure that the 100 customers processed by Workflow 1 is not the same set of customers process in the previous 10 minutes?

I checked with their AI in Shopify Help, and it says that it might get the same 100 customers repeatedly.

This is the AI response

100 customers per 10 minutes is 600 customer per hour – it will take 17 hours to process each day.
That’s a lot.

I’d try to restructure your processing, probably try using Customers-> Segments (as they have their own powerful filtering) and “Customer joined segment” trigger in Flow.

If not, then I’d create 2 flows (sets of flows).

Flow 1, runs scheduled every 10 minutes

  • checks if date is odd,
  • then gets 100 customers “not tag: processed-odd”,
  • removes tag “processed-even”,
  • runs code, sends e-mail if needed,
  • adds tag “processed-odd”

    On even dates – does nothing.

Flow 2 is the same, but symmetrical:

  • checks for even date,
  • gets customers “not tag: processed-even”,
  • removes tag “processed-odd”,
  • runs code, sends e-mail if needed,
  • adds tag “processed-even”.

    On odd dates – does nothing.

This way each customer is processed once per day and is prepared to get processed tomorrow.

Another option, if you don’t mind using third-party apps, is to use the “Start custom workflow for list of customers” action from the Flow Companion app on a schedule. This action selects all customers with no limit on their number and starts a workflow that begins with the “Customer: custom trigger triggered” trigger. Each customer will be selected exactly once regardless of the actions of the second workflow. In the “Query” field you can apply a filter to the selection, for example by filtering customers who have not yet been processed by the second workflow in previous runs.

To avoid hitting rate limits at the Shopify Flow level, I recommend setting the delay between triggering to 1 or 2 times per second.

The second workflow is started from the first one for each customer in the selection - here you add the main logic.

Please note that the “Specifier” field in both workflows must match.

Thank you, Tim.

We don’t mind the 17 hours per day. In fact, I am ok with it taking days to process just so Workflow 2 in my post does not send the email at odd hours of the morning like 3 AM.

I would follow your suggestion, but our process is trickier.

I tried segments, but it won’t work with our setup.

For our setup, we have milestones based on birthdays. There are 8 milestones; some are before the birthday, and some are after the birthday. Segments, unfortunately, cannot compute days after a birthday (basically, dates in the future).

For the setup mentioned in my post, each milestone will have 2 flows. This means that in 1 day, there are 8 tagger flows that run.

Does this mean that you are suggesting we use 2 tagger flows per milestone?

Thank you, Mivicle.

I’ll check with management on using 3rd party apps.

May I know if this trigger works with RunCode?

We use run code to compare a metafield date with the date today.

Hmm. it does for me:

This one for birthday one day ago:

This one with bd tomorrow:


I can't suggest anything more precise because I do not know your entire situation. Would still rather vote for segments though.
The Flow companion gives you additional trigger -- you can create your flow using this trigger as usual and use all usual actions, "Run code" included.
1 Like

Yes, of course. Flow Companion actions and triggers are compatible with any other actions, including “Run Code”.

By the way, Flow Companion also provides the “Get current datetime” action that provides the current date and time to the workflow in the UTC time zone. Maybe this will be useful to you since you compare dates in the “Run code” action.

It will, Mivicle! Thank you.

I will explore the app in staging site while waiting for management decision.

Tim, I missed the + in my segment definition!

That’s why I couldn’t get it to work.

Thank you so much for this. Let me tinker again with segments.

1 Like

Tim, one more question as I build this, since the segments are based on birthdays, and customers enter the segment based on the date changes, does this mean that my emails will most likely send around midnight?

hmm. Good question. Never really tested this, but makes sense.
However if it does, you should be able to add a delay in Flow before sending.

Like “Customer joined segment”-> “Wait for 8 hours”-> “Send e-mail”?