Skip to Content
Learning API Styles
book

Learning API Styles

by Lukasz Dynowski, Marcin Dulak
July 2025
Intermediate to advanced
414 pages
10h 22m
English
O'Reilly Media, Inc.
Book available
Content preview from Learning API Styles

Chapter 9. Webhooks

Before talking about webhooks, we need to explain the callback concept. In real life, you might experience a callback when calling a friend who is currently busy, and they promise to call you back. For APIs, a callback is an application’s interface (e.g., an HTTP endpoint) that is used to receive messages (calls).

The communication flow in callback APIs goes like this: a destination service that wishes to be notified registers its callback within the source service responsible for producing events. In callback APIs, every message sent by the source service is expected to be acknowledged by the destination service through a response.

Figure 9-1 shows the architecture of callback APIs.

Architecture of callback APIs
Figure 9-1. Callback architecture

A webhook is an HTTP request triggered by an event in the source service and sent to a callback URL defined in the destination service. The webhook payload data contains information about the event. The destination service then processes the data and responds to the event’s occurrence.

In this chapter, you’ll be introduced to webhooks, their origins, classification, and trade-offs. Completing this chapter will help you determine whether webhooks are the right choice for your use case. Besides conceptual knowledge, you’ll gain practical skills to implement, secure, and document webhook APIs.

What Are Webhooks?

Webhooks go by many names, such as ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

API Design Patterns

API Design Patterns

John J. Geewax
Designing APIs with Swagger and OpenAPI

Designing APIs with Swagger and OpenAPI

Lukas Rosenstock, Joshua Ponelat
Learning TypeScript

Learning TypeScript

Josh Goldberg

Publisher Resources

ISBN: 9781098153984Errata Page