In this tutorial, we will subscribe to a specific event emitted by fulfillmenttools. We will use the Eventing mechanism.
Create the event listener
First, we need to create a web endpoint that is publicly available on the internet. For the sake of this tutorial, we will leverage a service called https://webhook.site/. It allows you to create a web endpoint in a few seconds to print out the incoming requests.
This tool is just a suggestion. You can also set up a webhook on your local machine using, for example, https://ngrok.com/ or even create a fully running service in your infrastructure.
In the end, we need to have an exposed endpoint. In this example, we will use the callbackURLhttps://webhook.site/1c90a559-dd18-4e45-95ec-04821d705466, which is provided by webhook.site.
Create the subscription at fulfillmenttools
Now that we have our service up and running, we can create a subscription to fulfillmenttools to receive events. We will register for the ORDER_CREATED event by issuing the following call:
Please take note of the x-my-auth header, which we supplied when creating the subscription. Also, the event includes an eventId, the event name and, of course, the entity itself as payload.
Success!
You just finished this tutorial showing how to connect to specific events asynchronously. The event can be used, for example, to trigger further processes on the provided service or to integrate into existing infrastructure.
To learn more about eventing on the fulfillmenttools platform, please check out the following pages: