Cancel Schedule API with repeating data constrains

Hey guys, I need some help figuring out how can I cancel a scheduled api if a value in a data set is repeated.

I’m building a sms app the will send SMS to customers with a discount code, and if the customer doesn’t come to the store again in X days, then he needs to be notified with another SMS that their coupon is about to expire.

In that case, if the customer phone number appears on the sales dataset more than one time in the designed timeframe, it needs to cancel prior scheduled API workflow, but only for those related to the repeating phone number.

I’ve been able to cancel prior schedule workflows, but then it cancels all of previous workflows, not only those that are realted do the repeating phone number.

Thank you so much!