Setup Flow automation to send a scheduled email to certain customer segment

Setup Flow automation to send a scheduled email to certain customer segment

DanLapodo
Tourist
14 0 1

Hello.

 

I am trying to setup a scheduled email ( I have the template created ) and can attach to the flow. However I want to send out only to a certain customer group, but I cannot find where that is.

 

I select the trigger ( Flow ) - Scheduled Time, but after then I cant find that customer section.

 

DanLapodo_0-1746104836314.png

 

I have my customer setup into segments and a metafield custom.customer_group

 

Some help onthis would be appreciated.

Replies 17 (17)
DanLapodo
Tourist
14 0 1

I have just installed to take a look. Will shopify/ flow/ email not deal with this internally?

tim
Shopify Partner
4539 546 1658

Usually it's like this: 

Screenshot 2025-05-01 at 10.51.44 PM.png

 

Not sure about the metafield though -- to what object it is attached? If you want to get customers from metafield, need to find the object it's attached to, then loop over the metafield contents.

If my post is helpful, hit the thumb up button -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com
DanLapodo
Tourist
14 0 1

Hi. Thanks for the reply. I was able to do that, i ran query to get the customers in the segment i needed, but theres a limit on the number of customers to 100, what happens to other the customers within the segment

 

DanLapodo_0-1746138492829.png

 

tim
Shopify Partner
4539 546 1658

I do not know what you're trying to achieve in details, maybe there is a better solution possible, say look under Marketing tab in Admin...

 

Flow would do nothing to the rest of the segment after first 100.

You may do more loops or schedule more often and after processing the customer, tag 'em and skip tagged customers in Get Customer Data...

And you may tag=> wait (say a day)=> remove tag, so they are ready for the next campaign.

If my post is helpful, hit the thumb up button -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com

paul_n
Shopify Staff
1778 195 416

Marketing automation does not have a way to send bulk email campaigns via their action. So you need to send them 1x1. That is possible, but you'll need to use an action to "Get" the customers and then a "For each" action to loop over the customers (caveat - this action has a limit of 100 at a time). 

 

The "Get customer data" action does not yet support segments, because the API doesn't yet. But you can query by metafield values, if those metafields are indexed.  This shows the syntax for the query https://shopify.dev/docs/apps/build/custom-data/metafields/query-by-metafield-value#querying-product...

 

Something like:

metafields.custom.material:"cotton"

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
DanLapodo
Tourist
14 0 1

Hi.

 

I have this so far, its not tested. But why is there a customer limit of 100

 

DanLapodo_0-1746196181675.png

 

with this query on Get customer data

DanLapodo_1-1746196249076.png

DanLapodo_2-1746196321893.png

 

 

paul_n
Shopify Staff
1778 195 416

It's a Flow product limitation right now, in that pulling that much data can bump into API limits and also storage limits. So assume you need to workaround it. 

 

Regarding the query, you do not put in a SQL query. I'd encourage your to read help for the action. This is a query to the Admin API, and you only need the text that would go in the query field (the metafields part I shared above). 

 

https://help.shopify.com/en/manual/shopify-flow/reference/actions/get-customer-data

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
DanLapodo
Tourist
14 0 1

Ok, so just metafields.custom.customer_group = 'Re-Seller'

 

How would you go about sending emails for the remaing customers after that first 100.

 

There was a suggestion ( Thank you Tim ) futher up the conversation of this;

 

You may do more loops or schedule more often and after processing the customer, tag 'em and skip tagged customers in Get Customer Data...

And you may tag=> wait (say a day)=> remove tag, so they are ready for the next campaign.

 

If I could do the first 100, then tag, then run it again immediately ignoring those which had tags, then have those tags removed ( could be within a few hours ), keep repeating until no customers left.

 

Could you advise as to how that would layout?

paul_n
Shopify Staff
1778 195 416

Yeah, that's a good approach. Add something like "tag_not:processed" to your query. And then put an Add customer tag (processed) after the email action

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
DanLapodo
Tourist
14 0 1

Ive added the tag: processed after the email action, a couple of things;

 

1. how do join the not:processed with my query

2. then loop round to the second step and do the whole process again until there are no customers not:processed

3. remove the processed tag within a certain time frame

paul_n
Shopify Staff
1778 195 416

The action has links to help for both the query filters available and syntax. Roughly you can add OR and AND between filters and also use parantheses

 

I don't understand your other questions as they are vague

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
tim
Shopify Partner
4539 546 1658

For the #3 the actions should be like this:

"Add customer tag" => "Wait:  3 days" => "Remove customer tag"

 

For the #2 -- simply schedule your Flow more often, say once per hour and then regulate the frequency by setting the "wait" parameter.

Basically, if a customer was sent e-mail they keep the tag for 3 days and does not get any new e-mails, then tag's removed....

 

Say, you have 500 e-mail targets. With runs scheduled every 10 minutes, they will be processed within an hour and will sit with a tag for next 3 days. Then tag removed and they are ready for new e-mails.

 

However, while this will work, it's probably not the most efficient way to do it.

If my post is helpful, hit the thumb up button -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com
Yuka
Shopify Partner
14 1 0

To iterate through all customers, you can use the combination of the Custom trigger triggered trigger and the Start custom workflow action from the Flow Companion app. The workflow will look approximately as follows:

CleanShot 2025-05-04 at 12.21.43.png

At the beginning of the workflow, add a check to ensure that the Specifier starts with the value send email. The Specifier value can be anything that suits you best.

In the Get customer data action, include a condition to check that the customer does not have the processed tag by entering the query condition -tag:processed in the query field.

At the end of the workflow, verify whether the list of retrieved customers contains at least one item. If it does, trigger this same workflow again, passing send email {{ "now" | date: "%Y-%m-%d %H:%M" }} as the Specifier value. The current date is needed to prevent Flow Companion app from activating an infinite loop protection. This way, the workflow will continue running until there are no customers left to process.

You can then schedule this workflow using another workflow, for example, to run once a day:

CleanShot 2025-05-04 at 12.30.08.png

DanLapodo
Tourist
14 0 1

Thank you for that detailed reply. Its more advanced than I may be able to write myself, I only recently moved from Magento 2 to Shopify, wil give it a go though.

 

I may have missed it but when does the tag:processed get removed for the next run. Im looking to send an email out say every 3 days at 9am to a particular customer segment which I did a query on, so do I leave that as I've already got;

 

"metafields.custom.customer_group = 'Re-Seller'"

 

How is the tag removed once the email is sent ?

Yuka
Shopify Partner
14 1 0

@DanLapodo wrote:

I may have missed it but when does the tag:processed get removed for the next run.


Thank you for the question. I missed that point in the solution. To remove the tag, you can add the Start custom customer workflow action right after we add the processed tag with the Specifier set to empty processed tag (postponed):

CleanShot 2025-05-04 at 17.31.25.png

You also need to create a separate workflow that starts with the trigger Custom customer trigger triggered, where you add the tag removing action after 71 hours (so that the mailing can happen again after 72 hours):

CleanShot 2025-05-04 at 17.34.28.png

DanLapodo
Tourist
14 0 1

This is what I have;

DanLapodo_1-1746356758929.png

 

I tried to add the Flow companion to the the Custom trigger triggerd but get an error

 

DanLapodo_0-1746356676005.png

 

If you could simplify possible? How do add the additional query for the tag processed to the GEt Customer data, not sure how to add that with the metafield query that is there?

 

Yuka
Shopify Partner
14 1 0

 


@DanLapodo wrote:

I tried to add the Flow companion to the the Custom trigger triggerd but get an error


I noticed in your screenshot that you created a workflow that starts with the Scheduled to run... trigger. The Flow Companion app cannot start a workflow that begins with that trigger. To make this setup work, you need to start the main workflow with the Custom trigger triggered trigger and create an additional workflow that starts on a schedule and launches the main workflow (see the screenshots in my previous message).


@DanLapodo wrote:

If you could simplify possible? How do add the additional query for the tag processed to the GEt Customer data, not sure how to add that with the metafield query that is there?


As Paul_n mentioned above, you can only filter elements by a metafield value if the metafield is indexed. Unfortunately, customer metafields do not support indexing (here is the request I found for adding such functionality). For now, the only option I see is to store the customer’s segment membership in customer tags, for example, by adding the segment-re-seller tag:

CleanShot 2025-05-04 at 17.41.57.png

If you store the segment in tags, you can filter items in the Get customer data action by adding the following condition to the query field: tag:segment-re-seller AND tag_not:processed.

CleanShot 2025-05-04 at 17.27.00.png


P.S. You can change tag names and Specifier values as you see fit.

P.P.S. You can also contact Flow Companion support if you have any questions related to private data that you prefer not to share in the community.