I’m building an app that sends automatic emails to users when an event (routes) happens near them. In my database I have their adresses, the radius of alert they have chosen and the adress of the event.
Everytime I post an event or the user update his adress or update the radius (1 km, 3 km, 5 km, 10 km or the entire country) of alert, a workflow is triggered in backend and emails are sent.
Here is an exemple for the update adress workflow :
An API workflow is triggered in backend.
An email is sent to the user if his adress is within X kilometers of the event (origin or destination), his radius = X and if the date of the event is not in the past.
It works but I think it’s very sloppy and time consuming. I only created space for 10 events (routes) and take a look at the sender area of the email. Right now I need to repeat step 2 twice (once for the origin of the event and once for the destination) for every event.
I tried to search through the list of events using the constraint “search for Evènement 1s’s from” but it refuses since it’s a list. I also tried with the constraint “:item until#” and “:item from#” but it refuses.
I’m sure there is a better way to do things (smarter and more efficient), so my question is how can I search through a list of event adresses instead of one by one.
Thank you in advance.
PS: I really tried before asking for help.