Currently Available: Need a skilled Software Developer for your next project?
Categories
APIs

How Webhook Providers Route Events to Callbacks

Webhook providers route events by checking the subscriptions you configure. Each subscription tells the provider which event type to watch for, which optional filters to apply, and where to send the message. When an event happens, the provider checks which subscriptions match its rules and sends a request to each selected destination.

The callback is the destination the provider contacts, usually a URL. That URL often includes a path, yet the provider does not inspect paths on your receiving server to pick a route. Because each provider defines its own selection rules, you need to read the documentation for your specific product to see how it handles event selection, filters, overlapping subscriptions, and failures.

Standards define callbacks and events, while providers set routing rules

The OpenAPI Specification lets an API contract describe callbacks tied to API operations. With a runtime expression, an API contract can build a callback URL from values in a request, allowing the caller to supply the destination. OpenAPI gives teams a way to document that relationship, though it leaves out any universal rule for when a provider sends the callback or how it chooses among subscriptions.

CloudEvents standardizes how systems describe event data and requires every event to include a non-empty type attribute. That attribute names what happened, and providers can use it for routing or filtering. Still, CloudEvents stops at event metadata and leaves the delivery algorithm to each provider. The CloudEvents primer also separates event data from protocol-level routing details.

Both standards give you shared vocabulary, while each provider’s documentation tells you how that product uses event types, callback addresses, and filters.

How providers select subscriptions and send events

To understand webhook routing without tying yourself to one vendor, follow the path from an event to its destination:

  1. An event happens, such as a product update.
  2. The provider finds subscriptions that apply to the relevant account, repository, app, or other scope.
  3. The provider checks whether each subscription includes that event type or topic.
  4. If a subscription has extra filters, the provider evaluates them.
  5. The provider sends the event to the destination for every subscription that qualifies.

No standard forces every provider to follow this exact sequence, so check the provider’s documentation for its available scopes, checks, and behavior.

For example, GitHub’s webhook setup asks an administrator to enter a Payload URL and pick which events to receive. GitHub then sends requests to that URL whenever those subscribed events occur. Scope matters there too, because GitHub separates different webhook contexts across repositories, organizations, and GitHub Apps.

Shopify’s subscription documentation works in a similar way by linking topics to a delivery URI, which can be an HTTPS URL or a supported messaging-service destination. In Stripe’s endpoint example, a single endpoint holds one URL alongside multiple enabled event types. Each of these providers connects event selections to configured destinations, yet none of them establishes a shared routing policy across products.

How providers treat the path in a callback URL

A callback URL often includes a path that points to a specific webhook handler on your server. The provider sends the request to that exact URL, and your receiving service reads the path to handle the incoming request.

Because of that, you should not assume the provider inspects paths on your server or applies routing rules like “longest path wins,” wildcard matching, or first registered route. GitHub asks for a Payload URL, and Shopify describes a delivery URI. Those docs define a destination field. Unless a provider separately documents path patterns, prefixes, or normalization rules, assume it treats the URL as a plain address.

OpenAPI’s runtime expressions cover a different feature, where an API contract constructs a callback URL from a value inside a request. That does not mean a typical webhook subscription accepts a URL template. If a provider does document a dynamic destination, check which values it pulls from the request and how it resolves them.

How event filters narrow which events get delivered

An event topic or type selects a broad category of activity. A payload filter goes further by checking values inside the event data, also called the payload. A subscription might watch for product updates, for instance, and then deliver only the updates whose payload meets a condition the provider supports.

Shopify describes this as an additional gate: a subscription matches a topic first, and an optional filter can block delivery if its expression evaluates to false. Its filter documentation lists the supported expressions and shows how Shopify evaluates them against payload fields. Other providers take a different approach. Svix’s event-type documentation describes filtering by event type at the endpoint level, where endpoints receive all messages by default until you narrow that selection.

Before you rely on a filter, check which operators and fields the provider documents. Check how the provider handles missing or null values, and confirm whether it evaluates the original event or a transformed payload. Those rules decide which events make it through; the word “filter” by itself tells you very little.

What happens when multiple subscriptions match the same event

A provider can send a single event to more than one qualifying destination. Svix documents that, by default, all messages go to all endpoints, narrowed only by endpoint event-type filtering. That behavior is a provider-specific fan-out rule, meaning the provider sends the same event to every eligible destination.

Do not assume that a more specific URL, a newer filter, or an earlier registration wins. GitHub and Stripe document how you select events and destinations, but those examples do not create a general first-match rule. If a provider’s documentation does not say whether overlapping subscriptions fan out, deduplicate, or follow a precedence order, treat that behavior as unspecified and verify it for the exact product and setup you plan to use.

For a broader way to check what a provider’s documentation promises, see how to compare webhook provider documentation.

Separating failure events from failed deliveries

A failure event reports something that went wrong in the provider’s business domain. In Stripe’s endpoint example, charge.succeeded and charge.failed both appear as event types. If your subscription selects charge.failed, Stripe routes it using the same event-selection rules as any other event.

A failed HTTP delivery is a different problem: the provider tried to send a request to your destination and could not complete it. Having a failure event type does not mean the provider routes unsuccessful HTTP deliveries to a backup callback URL.

OpenAPI shows that an API contract can define separate success and failure callback destinations using runtime expressions. Even so, it sets no universal rule for choosing between them, and it does not mean webhook providers offer a separate error destination. Look for explicit provider documentation before you build a fallback or error-specific callback. To see how a provider’s routing rules line up with an API contract, read mapping webhook routing rules.

Questions to answer in the provider’s documentation

Before you pick a destination for the exact product and configuration surface you plan to use, look up the answers to these questions:

  • What scope does the subscription apply to, such as an account, app, repository, or individual resource?
  • Which field holds the destination, and what destination formats does the provider accept?
  • Does the provider select events by topics, event names, or an all-events setting?
  • Which filters does the provider support, and which event data do they evaluate?
  • What does the provider do when multiple subscriptions qualify for the same event?
  • Does “failure” mean a business event, a separate callback destination, or an unsuccessful delivery?

Keep your answers tied to the specific provider and product version in the documentation. Shopify’s subscription and filter rules describe Shopify’s webhook model, and they do not tell you how another provider handles the same setup.

What I'm building

Delegate tasks. Get software.

Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.

Take a look at vroni.com

Email updates

Usually a new article and a few links I found interesting.

No spam. Unsubscribe with one click.

Leave a Reply

Your email address will not be published. Required fields are marked *