Best answer

How to prevent repeating back-and-forth Zaps?

  • 11 January 2022
  • 13 replies
  • 378 views

I have a web app and mobile app that pull from separate databases, but still need to keep up to date with each other. My web app is working from MySQL, and I am developing a Native mobile app on Adalo.

 

I have very similar Zaps that, for instance, create a new record in Adalo if a new row is created in MySQL, and vice-versa. The issue is, when the first Zap is executed, it triggers the same Zap in the opposite direction. This will continue back-and-forth until a new row tries to be created in MySQL that is a duplicate, and will stop in Zapier because of this error (ie. user enters new record in Adalo → New row created in MySQL → Another (repeated) record created in Adalo → Error message in Zapier as we cannot duplicate this Adalo record). 

 

For my Zaps that involve creating a record in Adalo that triggers a new row in MySQL, I have tried to create a filter after the trigger, but all these filters can only read record fields in Adalo, so I am unable to look for duplicate entries in MySQL, and filter out these Zaps before they finish. 

 

Any advice on this is greatly appreciated

icon

Best answer by Troy Tessalone 18 January 2022, 22:36

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

13 replies

Userlevel 7
Badge +14

Hi @Henrik 

Zapier is not meant to 2-way syncing of data: https://zapier.com/help/create/basics/does-zapier-support-two-way-syncing

 

If you can add a reference ID (e.g. record ID) from each app into the other app, then you may be able to filter based on whether that reference ID exists, in order to prevent the infinite loop and errors.

 

Otherwise, try implementing this type of logic: find record else create record, then update record.

Userlevel 1
Badge

Thank you @Troy Tessalone for the suggestions, your idea for implementing the final logic did work well for my Zaps that involved creating a new record in Adalo, triggering a new row in MySQL. However, on the flip side, creating a new row in MySQL to trigger a new record in Adalo cannot have this type of logic implemented so easily. 

 

The issue is actions for MySQL include creating, updating, and finding rows in a table. But Adalo only has creating and updating records as available actions. I have been trying to work with both your suggestions on these more problematic Zaps, but unfortunately have still not been able to cease the issue of the following loop: New record in Adalo → new row in MySQL → New (Duplicate) row in Adalo. 

 

Is there a way to implement a ‘find record’ action for Adalo in Zapier? Any advice is greatly appreciated.

Userlevel 7
Badge +14

@Henrikcox 

Look into leveraging the Adalo API: https://help.adalo.com/integrations/the-adalo-api

This may be usable to find records.

App APIs can be used in Zaps with the Webhooks app as an action step: https://zapier.com/apps/webhook/help

 

 

Userlevel 1
Badge

Thank you @Troy Tessalone, I’ll dive into these APIs and get back with updates

Userlevel 1
Badge

Hi @Troy Tessalone, I believe I almost have it but am experiencing one small hiccup.

 

The Webhook step works well after I pulled the GET URL and Content-Type & Authorization headers from the Adalo API documentation of my database. My issue is the test is getting the wrong single record from my ‘groups’ table.

 

I am trying to specify that a record in Adalo should be searched for by matching the Group ID from MYSQL under the Query String Params (I’m not certain if Query String Params is the correct way to specify which column to search by). However, every test result both from running the in-Zap test (2nd screenshot) and creating a new row in MySQL and reviewing the zap runs (final screenshot) show the same results: Group_id 2 is always being read from MySQL, no matter the new row I create.

 

Many thanks again for your help with this so far

 

 

 

Userlevel 7
Badge +14

@Henrikcox 

Can you indicate which Adalo API endpoint documentation you are referencing by linking to it?

Userlevel 1
Badge

That would be the documentation page found when clicking the three dots next to a database collection, and the ‘Fetch a single collection record’ endpoint

 

 

Userlevel 7
Badge +14

@Henrikcox 

This Adalo API endpoint expects 3 path parameters and 0 Query String Parameters.

 

NOTE: I don’t see documentation in the screenshot related to “group_id”, which may explain why the returned results are not what you are expecting.

 

Would need to see more screenshots with how your Zap step is configured for the full API request.

Userlevel 1
Badge

@Troy Tessalone 

 

I’ve attached screenshots of the full Zap step, including the review test in progress and results. I’m not sure where the path parameters can be inputted, and replace those with the current query string parameters

 

 

 

 

Userlevel 7
Badge +14

@Henrikcox 

Path parameter are part of the URL, which should be indicated by the Adalo API documentation:

 

You may have to use a different endpoint then filter those results by your query criteria:

 

Userlevel 1
Badge

@Troy Tessalone 

I’ll give that a go! I also tried replacing the end of the Endpoint URL with {ElementId} instead of 1 and feeding in the group_id through the query string parameter but had a bad request. I’ll try getting all collection records and filtering through that way.

 

 

Userlevel 7
Badge +14

@Henrikcox 

Keep in mind that the Path parameters for Adalo API are going to expect internal Adalo IDs for the appID, collectionID, and elementID.

Userlevel 1
Badge

That worked great! I went with the endpoint of getting all the collection records, and then changing the next filter step to the following:

Thank you so much @Troy Tessalone, your advice was incredibly healpful!