Networking world is brimful of concepts like APIs, API calls, Webhooks, Subscriptions, Request, Responses etc. especially when we talk about communication between two web services or apps. If you are a newbie and having a difficult time understanding these concepts, worry no more. Let’s draw an analogy between a real-life scenario and computing world, for better understanding.  

I am a very passionate shopper, who likes to stay up-to-date with her favorite brand's new catalog or any upcoming sales information. I am sure if you are as passionate as me you want the same too. Two years back, whenever I had to look for a new product or learn about an upcoming sale I had to visit the online store or call the salesperson at the outlet. A lot of hassle, I tell you!

The brand rolled out an update recently, where I subscribed to its services like automated text alert and emails regarding any new product launch or sales.  A sigh of relief. My inbox now bursts with all those texts, though. 

Both scenarios accomplished the same goal, but differently. In the first case, I had to request the required information. As in the second case, I was automatically informed whenever an event took place. Stating the obvious, the updated online store saved a lot of effort and time. 

When we translate these scenarios into networking, we can easily say the first method is request-based output-method whereas the second one is event-based output-method. How? The following table explains it better. 

Let us say, the online store is the API and whenever I visited the store I made an API call and in return, the API returned me a response. Or the salesperson at the store is a very efficient API and whenever I made a phone call (API call), I got the required info.

However, the second case is more efficient. Whenever a new product is added or a sale is announced I automatically receive a text-alert. We call these text-alerts Webhooks. Webhooks are actually HTTP-call backs which are triggered whenever an event occurs in an app (the online store). We subscribe to a particular event, as I subscribed for any new products or sales. There can be other events like a change in prices, a new addition to the shipping method or any other. Webhooks will only notify me whenever that event takes place to which I have subscribed. 

Webhooks POST a message to a URL. When users can create their own URLs in an app, they can customize them according to their own needs and integrate with apps around the world. Webhooks save their time, as the user does not need to poll every time for data and most of the times there is no new information. 

Where does Integry use Webhooks?

Webhooks play a very important role in the integrations you create. The integrations are a combination of triggers and actions.

Trigger: A trigger is an event which starts from your app and can then send data to other apps. Each template must have exactly one Trigger and it must be the first step. For example: if your app is a task management app then a trigger can be Task Created. We can then add another step like Push Message to Slack Channel or Create Google Calendar Event; both these steps will be triggered after the Task Created trigger. If you don’t have an API created in your app yet, we’ve written this guide to help you create a basic push API.

Let us say, we create a trigger "Contact Added" in HubSpot. How will we know that the contact was created? Of course, Webhooks. 

When we saved our integration, an endpoint (auto-generated URL) was sent to HubSpot which is as follows

https://apps.integry.io/endpoints/call/58881

We have subscribed to HubSpot “Contact Created” event. Whenever a contact item is created HubSpot will send us a Webhook on the URL mentioned above. We will extract the required information from the request received and save it for further use.  

So when the event happens, Webhook informs the subscriber. 

Happy Integrating!

Did this answer your question?