What is a Webhook?
Webhooks are "user-defined HTTP call backs." They are usually triggered by some event, such as pushing code to a repository, or a comment being posted to a blog. When that even occurs, the source site makes an HTTP request to the URL configured for the webhook. Users can configure them to cause events on one site to invoke behavior on another.
Common users are to trigger builds with continuous integration systems or to notify bug tracking systems. Because webhooks use HTTP, they can be integrated into web services without adding new infrastructure.
A webhook URL is provided by the receiving application, and acts as a phone number that the other application can call when an event happens. Only it’s more complicated than a phone number, because data about the event is sent to the webhook URL in either JSON or XML format. This is known as the “payload.”
A webhook URL is provided by the receiving application, and acts as a phone number that the other application can call when an event happens. Only it’s more complicated than a phone number, because data about the event is sent to the webhook URL in either JSON or XML format. This is known as the “payload.”
Example: if an order status changes in Vin-eRetail, Vin-eRetail triggers notification to external system (whose Webhook URL is configured in system) in the form of JSON so that the external system can perform action based on the status update that they have received like Sending Mail to customer to inform about the current order status.
Prerequisites to configure Webhook in Vin-eRetail
- Webhook URL to be taken from the client. This is the URL of the system on which client wants Vin-eRetail to trigger the notifications/Payload.
- Details of Headers to be added (If any).
How to configure Webhook in Vin-eRetail?
- For webhook configuration, user needs to navigate to the webhook register option available under: Admin > Miscellaneous > Manage API, then click on Register Webhook option as mentioned in the screenshot below:
- User needs to select the Source i.e., WMS/Seller Panel. Seller Panel Webhook is only used for a case where the Client works as Marketplace and sellers of that marketplace using our Vin Supplier Seller panel. For a normal OMS/WMS user, always the Source is WMS.
- Select the API Category for which client wants to subscribe the webhook notifications. Example: If client wants to subscribe any notification related to orders, the category needs to be selected as Orders.
- Select the Payload Type i.e., Full/Partial. (For Full payload case, Vin-eRetail sends the complete response as available in API response)
Example: If client wants to subscribe the Order Status Webhook in Full payload Mode, then client will get the complete response as mentioned in:
https://erp.vineretail.com/swagger/#/Orders/post_RestWS_api_eretail_v2_order_status
If the partial payload is selected, user will get attributes like: Order No., PO No., Inbound No. along with the status Name that is changed.
- Using the events section, User can select the events on which he needs the webhook notification. (If no event is selected, System will trigger notifications for all status).
- Webhook URL given by the client needs to be updated in Webhook URL option.
- Any Header that needs to be added to make sure that the receiving system can authorize the payload has to be added in headers section separated by Pipe Sign i.e., |.
Example: If the headers provided by the client is:
Content-Type: application/x-www-form-urlencoded
x-api-key : xhywhearesfghekdkskwkwcrrkckw
These headers must be added like (separated by Pipe sign highlighted in Red):
Content-Type:application/x-www-form-urlencoded|x-api-key:xhywhearesfghekdkskwkwcrrkckw
(Make sure there is no space in between).
- Check the Active flag to enable the webhook and Un-Check to disable the same.
- Once all these details are added, click on the save Button. Now the webhook is successfully configured in the system.
- Below is the screenshot of a webhook configured successfully in the system:
API document link: https://erp.vineretail.com/swagger/#/