So far I only know to use Do Search For and then return :first item as a way to get data from my database. But lately this is causing a lot of headaches cause at times it’ll return the first item in my database if nothing matches – this is using ignore empty constraints cause I want to use multiple filters on my end. However, I get a ton of other weird issues doing searches for this.
What are the techniques you guys are using to return data and make sure they are the right data?
So far it makes my app look like you can accidentally mess up someone else’s data (if I didn’t use back checks).
Cause a huge issue is when I’m using a webhook return and I can’t just make sure the data belongs to the correct user (cause in backend workflows it’s anonymous user).
Privacy rules… if you’re running into this issue, it’s probably because that data is public when it shouldn’t be…
All webhooks have some kind of identifier that you can use to reconcile it with your database. For example, a request ID, which you save when sending the request and can look up when you get a completion notification via webhook.
You return lists by Do a search for or Thing’s List of Things.
You return individual entries using Thing’s X.
Almost all data should be tied to a specific user / company, so you can configure appropriate privacy rules and never orphan data.
If the API provider that you are receiving the webhooks from allows you to add metadata to the API call, like the way Stripe does, then I always use the metadata to add the unique ID of the things I will need to search and find in the backend workflow the webhook pings.
This looks like Do a search for thing with constraint unique id = metadataUID
I guess what you are looking for is Get a thing operator that returns only 1 thing that matches to your description (instead of returning a list) but it doesn’t exist So, the best thing is what you described: Do a search for (some contraints): first item.
Behind the scenes, when you search for unique ID:first item it’s actually just GET a single item. It’s a miracle this isn’t a native action yet. @Bubble boosts??
This is why I send metadata as the unique ID. Since Bubble charges a bit less WU for these types of searches, always need to try and find a way to leverage it where possible.