Overview
Webhooks are a way for Loop to send updates to your application automatically. They work by sending an HTTP request to a URL you choose ahead of time.
Each webhook has a topic, which defines the type of information included in the message, and a trigger, which is the event in Loop that causes the webhook to be sent.
This means your application can get real-time updates from Loop without needing to constantly check for new information. Webhooks make it easier to keep everything in sync and up to date.
Topics & Triggers
A webhook’s topic determines the type of information included in the payload that Loop sends to your application.
Each topic is tailored to specific data, such as labels or returns, ensuring that you only receive the information relevant to your needs.
Not all topics will yield results for every trigger. For example, if you use the label topic with a return created trigger, the payload might be empty because the label isn’t generated yet. Make sure topics match trigger events to get meaningful data.
Available Topics
Topics:
Available Triggers
| Trigger | trigger property in payloads | Description |
|---|
| Return updated | return.updated | A return has been updated (for example, the return state has changed from open to closed). |
| Return created | return.created | A new return was submitted in the customer returns portal. |
| Return closed | return.closed | A return’s state has been updated to closed. |
| Label created | label.created | A shipping label has been created. |
| Label updated | label.updated | A shipping label has been updated (for example, the return’s status has changed from new to in transit). |
| Restock requested | restock.requested | An item in the return has been restocked in Shopify. |
| Gift card requested | giftcard.requested | A gift card has been requested as part of an exchange. |
| Shipment processed | shipment.processed | A Happy Returns shipment has been processed by Loop. |
Responding to Webhooks
Your webhook endpoint should respond with a successful HTTP status code (e.g. 200 OK, 202 Accepted, or 204 No Content) within 10 seconds. If you do not respond within that duration, the webhook delivery is treated as a failure and will be queued to retry. If you have complex processing like database queries or external API calls that may exceed this timeout, return the response before processing.