Webhooks are a lightweight, open, and effective way to work with events generated by 3rd party systems that you may want to integrate with.
Indeed one of the integration options you have as a developer integrating into Marketplacer is to subscribe to webhooks and listen for events including, but not limited to:
- Product Creation
- Order Updates
- Shipment notifications
However, despite the benefits of using webhooks to integrate, one drawback that you’ll encounter is their inability to be routed directly to your local development machine.
In this article we discuss 3 ways that allow you to work within that (understandable) constraint.
A typical Webhook set up
Just to clarify the issue a little further, when setting up a webhook on a 3rd party system you typically provide information on:
- The “event” that you want to receive, e.g. new order created
- The data to be sent, e.g. Order Id, Delivery Address, Order Amount etc.
- Where you want the data sent to (the HTTP endpoint destination)
It is this last point where you can become a little unstuck as a developer wanting to work with these events on your local machine — what destination do you configure in order to get events delivered to localhost?
While there isn’t really a webhook standard, for the most part webhooks are typically implemented as HTTP POST requests with a JSON body payload sent to the consuming system (in this case your local machine).
And while you may get a slightly different error on other platforms, the fundamental issue remains, the 3rd party platform cannot route webhook events to localhost…
The remainder of this article discusses how you can work within this constraint.