Category: Development

The use of Webhooks in APIs

Author(s)

Gilles
Gilles
A large part of our work involves integrating several applications together. The majority of these applications do not have any native integration planned by their authors, but expose what is known as an API (Application Programming Interface) to exchange information.
Let's imagine that we want to synchronise the data in our application with a CRM (contact and customer relationship management application). If this CRM exposes an API, we can regularly make a call to it that basically says "give me all the contacts that have been modified or created since yesterday". This is the API Polling strategy.
“ If you've ever travelled with children, it's the equivalent of "Are we there yet?" a million times. ”

Read on Internet (https://medium.com/swlh/an-alternative-strategy-to-api-polling-using-pub-sub-and-mqtt-40dc643dcf82)

Modern APIs offer an alternative strategy: being able to subscribe to changes and be notified quickly. This is the push strategy and the basis of webhooks.

Webhooks

Webhooks are based on an event system and use the HTTP protocol to transmit data. The nature of the events depends on the business logic of each application. For a CRM application, it is possible to subscribe to events such as "creation of a new contact", "modification of a contact", "deletion of a contact", etc.
The format of Webhooks is not standardised and there is no established specification. However, most players use the JSON format for data and apply security mechanisms or callback strategies (if our application is unavailable at the time of communication).
Here's a site I wish I'd discovered 4 years ago. It's a collection of best practices for Webhooks (security, documentation, examples, tests, operational) for both the sender and the customer/consumer:

Webhooks in Symfony coming soon?

It's still early days, but at SymfonyCon 2022, discussions are underway to create a component to simplify and standardise the management of Webhooks (more generically known as "Remote Events") in Symfony.
In conclusion, webhooks often make for smoother, faster integration, often generating simpler code (from the customer's point of view) and consuming less data on the network. How convenient!

More articles

Author(s)

Pierre
Pierre

Dark mode: necessity or trend

Nous faisons le tri entre idées reçues, réalités techniques et bonnes pratiques de design.
Nous faisons le tri entre idées reçues, réalités techniques et bonnes pratiques de design.
Dark mode: necessity or trend

Author(s)

Yann
Pierre
Yann and Pierre

Experiment #2 – Surway, a social experiments game

Pour notre deuxième expérimentation, nous avons relevé le défi de sortir de notre zone de confort en développant Surway, un jeu vidéo jouable directement dans le navigateur, où les actions de chaque joueur restent inscrites pour tous ceux qui suivront.
Pour notre deuxième expérimentation, nous avons relevé le défi de sortir de notre zone de confort en développant Surway, un jeu vidéo jouable directement dans le navigateur, où les actions de chaque joueur restent inscrites pour tous ceux qui suivront.
Experiment #2 – Surway, a social experiments game

Author(s)

Kevin
Yann
Kevin and Yann

Pixel Perfect… Almost

Comment optimiser vos formats d’images pour booster vos Core Web Vitals, réduire le poids de vos pages et améliorer votre SEO.
Comment optimiser vos formats d’images pour booster vos Core Web Vitals, réduire le poids de vos pages et améliorer votre SEO.
Pixel Perfect… Almost