Search for Customers With Phone Numbers

I’m trying to put something together that will enroll any customer in the directory with a phone number into the loyalty program. Unfortunately, the customer sign-up page that collects e-mail and phone doesn’t automatically enroll into loyalty.

So, I need to build a query that gets all the users that are:

  1. Not a member of our loyalty program
  2. Have a phone number

Once I have that I can use another function to enroll them into loyalty. Then I can figure out how to run that every 5 minutes. Seems bizarre I’d have to do this but it is what it is.

But with Search Customers I can do an exact or fuzzy match but no way to get anyone WITHOUT a phone number.

Am I missing something?

Thanks

:waving_hand: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Create and Retrieve Loyalty Accounts
Set up a Loyalty Program (Walkthrough 1)
Loyalty API

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

The SearchCustomers endpoint will has a time range filter that you can use to pull in customer profiles. Then you can parse the results for profiles with phone numbers and from there determine whether or not you’ll enroll them in the loyalty program. :slight_smile:

Thanks, Bryan - guess that makes sense. Get all the data, then pare it down on my end. I’m right on the edge of knowing what I’m doing with curl and json so was hoping to keep it as simple as possible but that will probably work.

Unless you can think of some other way to accomplish my high level goal of collecting an email and a phone number and automatically enrolling them into the loyalty program. I feel like I’m swimming upstream to do something simple here.

At this time this is the best way to go about this with the data you have. Will you also be collecting the customer information? :slight_smile: