The problem - Integration Loops

In a two-way sync integration, a change in one app is reflected in the other app and vice versa. This brings some problems with it that cannot be left overlooked while creating integration templates. An update or addition of data in one app can cause continuous back and forth updates between the two synced apps, making it an infinite cycle. Let’s better understand this with an example.

Consider you have created an integration that syncs your contacts between HubSpot and GetResponse. Now let’s say you update a contact’s information in HubSpot. This will trigger a response from HubSpot in the integration that will cause the contact to be updated in GetResponse as well. However, the reflection of this update in GetResponse will once again trigger a response, and for the two-way sync to work, this update will again have to reflect in the first app. This is because the integration listens to all update events and the app sends these events to their respective triggers even if we’re the ones doing the updates. This will cause an infinite loop of back and forth updates of that contact in both apps. A similar problem will arise in the case of contact creation that is synced both ways.

The loop prevention feature

To make sure you don’t get hindered by loops in your integrations, we bring you the loop prevention feature in the template builder. With one single click, your template will become free of any potential loops that can be originated.

You can enable loop prevention for your template with the toggle button found in the template metadata configuration section as seen below.

When loop prevention is turned on, its corresponding backend algorithms become available to be used in templates. They are designed specifically to support the smooth execution of two-way sync use-cases in templates by making sure no loops are introduced.

Let’s see the mechanism behind this feature for the “Update” and “Create” operation examples for contacts in templates.

Requirements for loop prevention feature to work

Before you can use loop prevention in a specific template, you need to set up a few things. These are the core requirements without which loop prevention is impossible.

  1. Triggers for the required operations in a use-case should be present in the template for both apps. The “contact updated” and “contact created” triggers are to be used for the update and create use-cases respectively.
  2. The Actions and Triggers used in the template should be using Objects to handle the data. Learn more about using objects in your activities.
  3. The apps being used in your template should have a separate “Get Record” action implemented. This action applies a Get call on an input Object. This is the Object on which “Update” or “Create” is being performed in the template. The Get call fetches the latest information on the Object (e.g. contact) and the associated data from the respective app. This “Get Record” action is implicitly used on the back-end once you enable loop prevention in the template. You can set up this action activity in your app settings and configure the Get call in the Object section as shown below.

    4. The loop prevention toggle button in the template should be ON.

The “Update” use-case

The example mentioned above will have four major steps for the update use-case. There will be a trigger for when a contact is updated in HubSpot, and an action that will execute in response to this trigger that will update the contact in GetResponse. Since this is a two-way sync template, there will be steps for this process in the reverse direction as well. A trigger for contact being updated in GetResponse and an action to update that contact in HubSpot. Please note that only the relevant template steps are shown in the examples for this document for simplicity and user’s understanding.

  1. Contact Updated in HubSpot

When you update a contact in HubSpot, it will execute the trigger at Step 0 of the template in the image shown below. As a result of this trigger, the action to update that contact in GetResponse will be performed at Step 1. 

    2. Contact Updated in GetResponse

Continuing the above example, it has been already mentioned that this template is a two-way sync between apps. So there will also exist a trigger in this template for when a contact is updated in GetResponse and an action to update that contact in HubSpot. Let’s say these are Steps 8 and 9 respectively as shown below.

In our current example, the contact was updated in HubSpot and has already been updated in GetResponse. The trigger shown above at step 8 will now be executed. This time, however, the process will not continue to the action step as the update has already been performed. Thus, the loop will be discontinued. All of this is controlled through the back-end algorithm

The “Create” use-case

Along with the “update contact” use-case, loops can arise from the “create contact” use-case as well. For loop prevention in this use-case, we implement a similar type of algorithm as talked about above. This use-case will again have four major steps in the template. Let’s see the details below.

  1. Contact created in HubSpot

When you create a contact in HubSpot, it will execute a trigger for “contact created in HubSpot”. Let’s again make this the Step 0 of the template as shown in the image below. As a result of this trigger, the action to create that contact in GetResponse will be performed at Step 1.

     2.  Contact created in GetResponse

For two-way sync in contact creation, there will also exist a trigger in the template for when a contact is created in GetResponse and an action to create that contact in HubSpot. Again, let’s assume they are Steps 8 and 9 respectively as shown below.

Once again, as the contact has already been created in both the apps, the above trigger will not prompt the action step to run, and the processs will be discontinued after the contact is created in both apps once. So the loop will be prevented.

Similar to above examples, you can use the loop prevention feature in all your two-way operations in the template that might prompt a loop to occur. Just make sure you have fulfilled the requirements for it mentioned in this article.

Using the loop prevention feature may affect your task usage for the integration. Visit here for details around that.

Learn about the storage app’s role in template here. You can also set up your own template with the help of this guide.

Did this answer your question?