PHPackages                             spryker/app-webhook - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. spryker/app-webhook

ActiveLibrary

spryker/app-webhook
===================

AppWebhook module

1.2.0(1y ago)04.1k↑50%[1 PRs](https://github.com/spryker/app-webhook/pulls)2proprietaryPHPPHP &gt;=8.2

Since Jul 16Pushed 1y ago20 watchersCompare

[ Source](https://github.com/spryker/app-webhook)[ Packagist](https://packagist.org/packages/spryker/app-webhook)[ RSS](/packages/spryker-app-webhook/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (25)Versions (8)Used By (2)

AppWebhook Module
=================

[](#appwebhook-module)

[![Latest Stable Version](https://camo.githubusercontent.com/f5b958a3c0fca45f9afca58dcc083345615bbf2cbcfe6856a17f97c131ce330f/68747470733a2f2f706f7365722e707567782e6f72672f737072796b65722f6170702d776562686f6f6b2f762f737461626c652e737667)](https://packagist.org/packages/spryker/app-webhook)[![Minimum PHP Version](https://camo.githubusercontent.com/ec21f169d70b69344c67d6f18fa1a24d20476d2f0cd680e8c4a1534c22f34e5f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e322d3838393242462e737667)](https://php.net/)

Provides SyncAPI and AsyncAPI schema files and the needed code to make the Mini-Framework an App with Webhook capabilities.

Installation
------------

[](#installation)

```
composer require spryker/app-webhook

```

### Configure

[](#configure)

#### App Identifier

[](#app-identifier)

config/Shared/config\_default.php

```
use Spryker\Shared\AppWebhook\AppConstants;

$config[AppConstants::APP_IDENTIFIER] = getenv('APP_IDENTIFIER') ?: 'hello-world';

```

### Testing the AppWebhook

[](#testing-the-appwebhook)

You can test the AppWebhook as usual with Codeception. Before that you need to run some commands:

```
composer setup

```

With these commands you've set up the AppWebhook and can start the tests

```
vendor/bin/codecept build
vendor/bin/codecept run

```

### Documentation

[](#documentation)

### Webhook handling

[](#webhook-handling)

This package is responsible to receive and handle webhooks. The package provides a controller that can be used to handle incoming webhooks.

The API endpoint is `/webhooks` and the controller is `WebhooksController` inside the Glue Application. This package is not handling webhooks on its own, you must implement the logic to handle the webhooks via the provided `\Spryker\Zed\AppWebhook\Dependency\Plugin\WebhookHandlerPluginInterface`, see the description down below.

#### Process in a Nutshell

[](#process-in-a-nutshell)

- A webhook is received by the `WebhooksController` and the `WebhookRequestTransfer` is created.
- The webhook content is mapped to a `WebhookRequestTransfer`.
- The `WebhookRequestTransfer` is passed together with a `WebhookResponseTransfer` to the `\Spryker\Glue\AppWebhookBackendApi\Dependency\Facade\AppWebhookBackendApiToAppWebhookFacadeInterface::handleWebhook()` method.
- The `handleWebhook` method does:
    - Creates an identifier for this specific webhook.
    - When it is not a retried webhook the webhook will be persisted in the database.
    - In case of a retried webhook the webhook will be fetched from the database.
    - When the number of retries exceeds the configurable allowed number of retries the webhook will be removed from the database and an exception will be thrown.
    - Find the correct handler for the webhook and call the `handle` method of the handler.
    - When the handler returns a failed `WebhookResponseTransfer` the response will be persisted in the database.
    - When the handler returns a not handled `WebhookResponseTransfer` the response will be persisted in the database with a message that was provided by the implementation of the plugin.
    - When the handler throws an exception the exception message will be persisted in the database.
    - When the handler returns a successful `WebhookResponseTransfer` the webhook will be removed from the database.
    - It returns the `WebhookResponseTransfer` to the controller.
- The controller formats the `WebhookResponseTransfer` into a Glue response which will be either:
    - 200 OK in case everything went well.
    - 400 BAD REQUEST in case of a failed response.

#### Retry Mechanism

[](#retry-mechanism)

In a case when a webhook can not be handled it is persisted in the database and will be retried with the next incoming webhook. The number of retries is configurable and can be set in the `AppWebhookConfig::getAllowedNumberOfRetries()` method.

There are numerous reasons why a webhook may fail. An exception is thrown, the plugin implementation returns a failed response or the plugin implementation returns a not handled response.

Another case could be an event is sent to the application before it is ready to handle it. For example, in the PreOrder payment of a PSP the order has not persisted yet and has no order-reference, but the PSP sends a webhook request about a payment state, in this case, the system has to wait until it can process the webhook.

##### Future improvements for the Retry mechanism

[](#future-improvements-for-the-retry-mechanism)

It may be helpful in the future to provide a console command that can be used to retry failed webhooks. This command can be used to retry all failed webhooks or only a specific webhook.

### Configuration

[](#configuration)

Currently only the number of allowed retries can be configured. The configuration can be found in the `AppWebhookConfig` class.

### Plugins

[](#plugins)

### GlueApplication

[](#glueapplication)

#### \\Spryker\\Glue\\AppWebhookBackendApi\\Plugin\\GlueApplication\\AppWebhookBackendApiRouteProviderPlugin

[](#sprykerglueappwebhookbackendapipluginglueapplicationappwebhookbackendapirouteproviderplugin)

This plugin provides the routes for the AppWebhookBackendApi module.

### Extensions

[](#extensions)

#### \\Spryker\\Zed\\AppWebhook\\Dependency\\Plugin\\WebhookHandlerPluginInterface

[](#sprykerzedappwebhookdependencypluginwebhookhandlerplugininterface)

This plugin can be implemented by any other module and has two methods:

- `\Spryker\Zed\AppWebhook\Dependency\Plugin\WebhookHandlerPluginInterface::canHandle(WebhookRequestTransfer $webhookRequestTransfer): bool`
- `\Spryker\Zed\AppWebhook\Dependency\Plugin\WebhookHandlerPluginInterface::handle(WebhookRequestTransfer $webhookRequestTransfer): WebhookResponseTransfer`

The `canHandle()` method is used to check if a webhook can be handled by a specific module. F.e. you have two handlers one for `order.created` and one for `order.updated` you can check in the `canHandle()` method if the webhook can be handled by the module and return true or false.

The `handle()` method is used to handle the webhook. The method is called if the `canHandle()` method returns true. The method should return a `WebhookResponseTransfer` with the status of the webhook handling.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance41

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~54 days

Total

4

Last Release

491d ago

PHP version history (2 changes)1.0.0PHP &gt;=8.1

1.1.0PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10738957?v=4)[Spryker Bot](/maintainers/spryker-bot)[@spryker-bot](https://github.com/spryker-bot)

---

Top Contributors

[![vol4onok](https://avatars.githubusercontent.com/u/5063777?v=4)](https://github.com/vol4onok "vol4onok (9 commits)")[![stereomon](https://avatars.githubusercontent.com/u/1382877?v=4)](https://github.com/stereomon "stereomon (8 commits)")[![spryker-release-bot](https://avatars.githubusercontent.com/u/26904324?v=4)](https://github.com/spryker-release-bot "spryker-release-bot (1 commits)")

###  Code Quality

TestsCodeception

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/spryker-app-webhook/health.svg)

```
[![Health](https://phpackages.com/badges/spryker-app-webhook/health.svg)](https://phpackages.com/packages/spryker-app-webhook)
```

###  Alternatives

[spryker/search

Search module

152.8M64](/packages/spryker-search)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
