DEV Community

ADEKOLA Abdwahab
ADEKOLA Abdwahab

Posted on • Edited on

How does webhook works

Here is a video link to this explanation: https://youtu.be/SP4x9VHNEC8

A quick analogy for a webhook is a SMS and email credit alert we (Nigerians) get. Instead of checking your account every second to know when someone pays you (when an event happens on your account), they send messages to your provided email / phone number.

In the Dev world, this would be easier for a developer who has developed and interacted APIs before to grasp.

APIs (URL) are called to ask for some information (resources) or perform some actions on some resources.

A simple example of API calling is that a front-end will call a backend API when a user wants to login (an event). Let say this happens on a platform called FlutterHook.

"I don't want to be checking myself to know when a particular event happens on your system/server, so when this event happens on your system/server let me know by calling this my URL"

That's what webhook system is all about. Instead of polling (asking and checking up by yourself) the system will alert you.

A more practical example is:

If you are treasurer of a big school which has merchant account on Flutterwave and the students pay school fees via Flutterwave, you don't want to be checking your Flutterwave dashboard every time to know who has paid then update the students' records on the school app.

In this case, what can be done is to provide an API URL (that points to the school server) on Flutterwave as a webhook. Flutterwave will then send you / call that API endpoint with the details of any payment (event). So you don't have to be checking yourself.

When Flutterwave calls that API endpoint you (a Dev) can then work on the logic and update the DB / students record accordingly.

API Trace View

How I Cut 22.3 Seconds Off an API Call with Sentry 🕒

Struggling with slow API calls? Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

Top comments (0)

Billboard image

Try REST API Generation for Snowflake

DevOps for Private APIs. Automate the building, securing, and documenting of internal/private REST APIs with built-in enterprise security on bare-metal, VMs, or containers.

  • Auto-generated live APIs mapped from Snowflake database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay