Hi everyone,
I’m building a scenario that is almost working, but I’ve lost the plot a bit on how to get it fully functioning. I’d appreciate any help you can offer!
TL;DR
I’m building a Make.com scenario that pulls an address from Notion, finds nearby businesses via Google Maps API, and writes them to a Notion database. I only want to add 3 new businesses (no duplicates), but I’m stuck setting up the counter and/or filtering the API results. Looking for help fixing the logic!
Here’s a screenshot of the current scenario:
(Ignore the router — I plan to add a second branch that will do the same thing, searching for another type of location.)
Here’s what’s working so far:
- Once triggered, the scenario pulls an address from a Notion table called Locations.
- It uses an HTTP request to the Google Maps API to geocode the address (get latitude & longitude).
- It then updates the corresponding row in the Locations table with that lat/long.
Here’s where I’m stuck:
- A second HTTP request uses the lat/long to search for nearby businesses (for example, pet stores).
- Google Maps API returns 10+ results.
- I only want to add the 3 closest matching businesses to a second Notion table (let’s call it Pet Stores).
- For each response:
- The scenario checks if the business already exists in the Pet Stores table (using the
place_id
). - If it doesn’t exist, it should create a new entry.
- If it already exists, it should skip it.
- The scenario checks if the business already exists in the Pet Stores table (using the
- The process should continue until 3 new businesses are added — and then stop — even if the API returned 10+ results.
Where I need help:
- I’m having trouble properly setting up a counter variable to track how many new businesses have been added and to stop once 3 have been created.
- OR is there a better way to limit the number of Google API responses up front (to only 3 results), instead of handling it after the fact.
- Specifically:
- Where should the counter be initialized?
- When/how should the counter be increased?
- Where should the filter or condition be placed to “stop” after reaching 3?
Any advice on structuring the logic better — or identifying what I’m missing — would be hugely appreciated! Thank you so much.