Home SalesforceInterview Question Difference between WebHook and API Polling

Difference between WebHook and API Polling

by Dhanik Lal Sahni

We integrate external systems using different APIs in Salesforce. REST and Bulk API are quite popular to integrate two or more systems. Sometimes we need to update the target system after a few intervals or after some action is performed on the source system. In that kind of situation, we use Pooling or Webhook. This post will explain about the difference between WebHook and API Polling

API polling is a mechanism for an API client to repeatedly call the server to check for changes in data. This will consume so many resources to repeatedly call the server.

A webhook is a reverse API or server-to-client push notification. The server sends a notification that data is updated/added to the server.

Difference between WebHook and API Polling

PollingWebhook
Communication ModelPolling is Pull model of communication where a system pulls information from another system.Webhooks use the push model by pushing information from a source application to a destination application
Request OriginPolling requests are made by a client. Polling is set up to run at fixed intervals and runs whether there is a new event or not.Webhook requests are made by a server. Webhooks are also automatically triggered when an event occurs.
Resource EfficiencyPolling can be resource-intensive and we need to make calls on whether the efforts will be fruitful or not.Webhook requests are only made when there is new information.
Real-Time UpdatesWith polling, there will always be an interval between requests that creates a delay in receiving an updateWebhook is made by the server on a real-time basis. No delay in notification.
Webhooks vs Polling - SalesforceCodex

When to use polling

We should only use polling when updates are very frequent and no real-time updates are required. This could be a good fit in a situation where you need to pull information from social media activities. As these activities are very frequent, polling will be a good fit in this use case.

When to use webhooks

If we need updated data in real time and updates are not very frequent, webhooks are the perfect solution.

Related Video

References:

Webhook vs. API: How Do They Compare?

Related Posts

Difference between SOAP and REST API?

What is YAML?

Other Useful Posts

Shopify integration with Salesforce using Webhook

Data Transformation with DataWeave in Salesforce Apex

Generic Multi-Select Lookup Component

Secure Apex Code with User Mode Operation

Data Table in Screen Flow

Multi Select Lookup in Screen Flow

You may also like

Leave a Comment

Top 10 Salesforce Service Cloud Features Top 10 Best Practices for Lightning Flow Facts and Statistics for Salesforce’s Size and Market Share Top 5 Contract Management Salesforce Apps Top 10 Enterprise Integration Use Cases