Webhooks are HTTP callbacks processed and sent by Loop to a pre-defined URL. They allow your application to receive information from Loop without having to reach out to Loop via an API call. Each webhook has a topic, which defines the information payload, & a trigger, which determines the event which triggers the request to be sent from Loop.
Loop offers 3 webhook topics:
And 5 triggers:
- Return created: A new return was submitted in the Returns Portal
- Return updated: A return has been updated (e.g. state has changed from "open" to "closed")
- Label created: A shipping label has been created via EasyPost (or other shipping service)
- Label updated: A shipping label has been updated (e.g. status has changed from "new" to "in transit")
- Restock requested: An item in the return has been restocked in Shopify
To set up webhooks you can go to the Developers page in your Loop admin or sandbox account. There you can create a webhook and select the topic, trigger, and define the URL the payload will be sent to.
Webhooks can have several statuses:
- Deactivated: occurs when Loop hit too many consecutive failed attempts
- Inactive: manually deactivated by a user
- Active: Webhook is operating normally
Webhook topics & triggers can be combined to suit your desired outcome. There are also certain combinations that will not yield results. (For example, If you set up a webhook with a topic of "Label" & a trigger of "Return create", there will be no payload available, as a return needs to be created before a label is generated.)
Each of our webhooks expect a successful response and will, in the case of failure, reattempt up to 3 times.
Our webhooks will deactivate if they get a non-2xx response more than 10 times consecutively. You can reactivate the webhook in the Developers page of your Loop Admin. To prevent webhooks from disabling themselves after 10 failures you can turn on testing mode, which prevents this for 72 hours.
If you wish to see the information payload of a webhook before incorporating the webhook into your code, the webpage webhook.site is a wonderful resource. They provide you with a URL to use in the webhook and display the information you receive on their page, allowing you to examine the JSON structure of the payload when the webhook is fired (even as a test). Later on you can change the webhook URL for production use.
If you need additional support regarding webhooks, please Contact the Loop team.