The difference between Webhooks and API calls

Kasper-Niclas Andersen
SYNQ
Published in
2 min readNov 28, 2019

--

Most new web applications these days has an API, which is an excellent way for separate applications to communicate with each other. When you need to ask a question to an application, APIs are great. But what if you want real-time notifications when something changes?

What are webhooks?

In simple terms, webhooks are automated calls from example.com to a server, small code snippets linked to a web application that get triggered when a specific event occurs. They are very useful when you want a web application to notify another web application of an event that has occurred. When a webhook is triggered on the source site, it collects relevant data and sends it to a URL specified by you (called the “listener”) in the form of an HTTP request. An event in one application can be configured to trigger an action in a separate application.

For example, let’s say that you are running a subscription service. If a user fails to make a payment, the automated call may be configured to ask the server to send out a payment reminder email. It would be very inefficient to use API calls to accomplish the same thing, as you would have to make constant requests to check whether payments have been made, rather than just receiving a notification when a payment has not been made.

At SYNQ, we use webhooks to automate various tasks, some examples:

  • Trigger email notifications
  • Feed video assets into a transcoding service when they are uploaded
  • Remove/update video asset data from database when a video has been deleted/updated

The fundamental difference between API calls and webhooks are that API calls provide information based on requests, whereas webhooks provide information based on events.

--

--