I am syncing contacts between NetSuite and Infusionsoft. I have an express server that listens for requests from NetSuite and InfusionSoft and then updates the other.
I am getting stuck in an infinite ‘update’ loop because…
- NetSuite publishes and event
- The express server sends an API request to InfusionSoft to update the related entity
- This causes a rest hook to fire on InfusionSoft
- The express server sends an API request to NetSuite to update the related entity
- This causes a rest hook to fire on NetSuite
- and on and on
I have found a way on NetSuite to only fire rest hooks if the action happens via the UI and not the API, is there a way to do this on InfusionSoft?
Personally I would take a different approach to what you are doing.
I would set up a Cron Job that runs a script every so often that checks if the Contact has been updated in both systems. If the Contact has been updated, then update things. You just need to keep track of when the last update was done. No need to rely on Rest Hooks.
Although the question here is, do you need to keep a track of this in real time?
If you do, then you would need to put in like a time exclusion in place. So if you need to update a Contact, then wait 60 seconds before doing it again. So ignore any requests happening in between. Although there is too many scenarios that come into play when dealing with Rest Hooks.