Surendra Sharma

Surendra Sharma

Search This Blog

Showing posts with label webhooks. Show all posts
Showing posts with label webhooks. Show all posts

Wednesday, May 31, 2023

Webhooks in Sitecore 10.3




Today we are going to see new features of Sitecore called Web Hooks. Before understanding web hooks, let's try to understand the concept of hooks in general life. Just like we have hooks in our home to hang clothes or fishing hooks, these hooks can hold two different things and join them. Similarly, in programming, web hooks can allow interaction between different applications.

When two different web applications are present, they can be interacted through a callback function. One application can receive real-time notifications through an event. For instance, if something is happening in application one, it will trigger a notification for the other application, which will receive it in code terms. Web hooks can be used in two places: events and workflows. Whenever an item is created, deleted, copied, published or a workflow is submitted, these actions are considered events.

Web hooks can be used to track these events. Sitecore will send information about the event in terms of a JSON request payload to the other application. The Sitecore HTTP post request will be sent to the other application with the payload in JSON or XML format. The other application will receive the request and further process it. There are three types of web hooks that can be created: web hook event handler, workflow, and validation actions.

Here are the steps to implement

·       In Sitecore, web hooks can be created through the System section and Web Hooks option.

·       To create a web event handler, select a specific event (item added, copied, deleted, etc.).

·       Specify the URL for the other application and enable the event.

·       A demo was shown with a method created in the Target application to receive input from Sitecore and save it to a file.

·       When an item was added in Sitecore, the event was triggered and a file was created on the local machine with the input received from Sitecore.

Here is my YouTube video for the same

 



 

Stay tuned for more such articles, tips and tricks.