-
-
Notifications
You must be signed in to change notification settings - Fork 112
The Loop Problem
Luke Walsh edited this page Dec 18, 2022
·
1 revision
If you are using Webhooks to listen for changes, such as a new customer, and then using the API to update this customer, you can create an inadvertent loop. As an example:
- Your Laravel App listens for a customer update Shopify webhook.
- Your Laravel App receives this webhook from Shopify and processes it.
- Your Laravel App then makes a Shopify API call to update this same customer.
- Shopify then triggers another webhook to your Laravel App as the customer was updated.
And thus an infinite loop is created.
To combat this, it is recommended to implement some mechanism to avoid a loop. For example, don't perform a customer update on the same customer within 60 seconds. The Shopify Dev forums have a number of solutions to this problem but you must implement logic to avoid a loop or you risk hitting API limits, in addition to annoying your App users.