PHPackages                             as-cornell/as\_webhook\_entities - 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. [API Development](/categories/api)
4. /
5. as-cornell/as\_webhook\_entities

ActiveDrupal-custom-module[API Development](/categories/api)

as-cornell/as\_webhook\_entities
================================

Manage Drupal entities like people records and articles via webhook notifications.

v2.10.0(5d ago)01.1k↓39.3%GPL-3.0-or-laterPHP

Since Oct 14Pushed 4d ago2 watchersCompare

[ Source](https://github.com/as-cornell/as_webhook_entities)[ Packagist](https://packagist.org/packages/as-cornell/as_webhook_entities)[ Docs](https://communications.as.cornell.edu)[ RSS](/packages/as-cornell-as-webhook-entities/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)DependenciesVersions (21)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/f28ba7f5a5910db318bd652c05dd6718f52955fd0982c33f4b1519b999fd6137/68747470733a2f2f706f7365722e707567782e6f72672f61732d636f726e656c6c2f61735f776562686f6f6b5f656e7469746965732f76)](https://packagist.org/packages/as-cornell/as_webhook_entities)

AS WEBHOOK ENTITIES (as\_webhook\_entities)
===========================================

[](#as-webhook-entities-as_webhook_entities)

INTRODUCTION
------------

[](#introduction)

[![Touchdown!](https://camo.githubusercontent.com/9cb2ce68128a9e3296d873af569f2e11f46dfdaca4da98d87722f23fb83422ae/68747470733a2f2f6d65646961302e67697068792e636f6d2f6d656469612f76312e59326c6b505463354d4749334e6a45785a33686c5a576c7764325a6861485a354e5756354e6a52795a6d31784e574e6d4f47307a596a52324d6e4e6b635774334e57703062695a6c634431324d563970626e526c636d35686246396e61575a66596e6c666157516d593351395a772f337634376a6d6142396d4f316f466f47746a2f67697068792e676966 "catch it")](https://camo.githubusercontent.com/9cb2ce68128a9e3296d873af569f2e11f46dfdaca4da98d87722f23fb83422ae/68747470733a2f2f6d65646961302e67697068792e636f6d2f6d656469612f76312e59326c6b505463354d4749334e6a45785a33686c5a576c7764325a6861485a354e5756354e6a52795a6d31784e574e6d4f47307a596a52324d6e4e6b635774334e57703062695a6c634431324d563970626e526c636d35686246396e61575a66596e6c666157516d593351395a772f337634376a6d6142396d4f316f466f47746a2f67697068792e676966)

Receives webhook notifications from remote systems and creates, updates, or deletes local Drupal entities (people, articles, taxonomy terms) accordingly. Uses a Strategy pattern with per-type handler classes for maintainability and extensibility.

REQUIREMENTS
------------

[](#requirements)

### System Requirements

[](#system-requirements)

- Drupal 9.5+ or Drupal 10+
- PHP 8.0+

INSTALLATION
------------

[](#installation)

### New Installation

[](#new-installation)

1. **Enable the module:**

    ```
    drush en as_webhook_entities -y
    ```
2. **Configure the module settings:**

    - Navigate to `/admin/config/as_webhook_entities/settings`
    - Configure the authorization token and cron trigger settings
3. **Verify the queue worker is registered:**

    ```
    drush queue:list
    ```

    You should see `webhook_entities_processor` in the list.

### Upgrading from 1.x to 2.0

[](#upgrading-from-1x-to-20)

1. **Pull the updated code** and clear cache:

    ```
    drush cr
    ```
2. **Verify the module is functioning:**

    ```
    drush watchdog:show --type=as_webhook_entities --count=10
    ```

CONFIGURATION
-------------

[](#configuration)

- **Settings UI:** `/admin/config/as_webhook_entities/settings`
- Runs on cron (`webhook_entities_processor` queue, 30 seconds per cron run)
- Cron can be triggered on receipt via the `crontrigger` setting
- Logs create/update/delete operations as `as_webhook_entities`

ARCHITECTURE
------------

[](#architecture)

### Strategy Pattern (v2.0+)

[](#strategy-pattern-v20)

Per-type field logic is handled by dedicated handler classes. `WebhookCrudManager` is a thin dispatcher that handles shared logic (title, status, departments/domain access, save) and delegates to the appropriate handler.

```
as_webhook_entities/
├── src/
│   ├── WebhookCrudManager.php              - Thin dispatcher, shared CRUD logic
│   ├── WebhookUuidLookup.php               - Looks up existing entities by UUID
│   ├── WebhookHandler/
│   │   ├── WebhookHandlerInterface.php     - applyCreateFields / applyUpdateFields
│   │   ├── WebhookHandlerBase.php          - Shared lookup helpers
│   │   ├── PersonWebhookHandler.php
│   │   ├── ArticleWebhookHandler.php
│   │   ├── MediaReportEntryWebhookHandler.php
│   │   ├── MediaReportPersonWebhookHandler.php
│   │   └── TermWebhookHandler.php
│   └── Plugin/QueueWorker/
│       └── WebhookEntitiesQueue.php        - Queue processor, event dispatcher

```

### Supported Entity Types

[](#supported-entity-types)

Payload typeDrupal entityHandler`person``node:person``PersonWebhookHandler``article``node:article``ArticleWebhookHandler``media_report_entry``node:media_report_entry``MediaReportEntryWebhookHandler``media_report_person``node:person``MediaReportPersonWebhookHandler``term``taxonomy_term``TermWebhookHandler`### Adding a New Entity Type

[](#adding-a-new-entity-type)

1. Create a class in `src/WebhookHandler/` extending `WebhookHandlerBase`
2. Implement `getType()`, `applyCreateFields()`, and `applyUpdateFields()`
3. Register it in `WebhookCrudManager::__construct()`: ```
    'my_type' => new MyTypeWebhookHandler($entity_type_manager),
    ```

MAINTAINERS
-----------

[](#maintainers)

Current maintainers for Drupal 10:

- Mark Wilson (markewilson)

TROUBLESHOOTING
---------------

[](#troubleshooting)

### Queue items not processing

[](#queue-items-not-processing)

1. **Check the queue size:**

    ```
    drush queue:list
    ```
2. **Run the queue manually:**

    ```
    drush queue:run webhook_entities_processor
    ```
3. **Check recent logs:**

    ```
    drush watchdog:show --type=as_webhook_entities --count=20
    ```

### Entity not created or updated

[](#entity-not-created-or-updated)

1. **Verify the UUID lookup is finding the entity:**

    ```
    lando drush php-eval "
    \$lookup = \Drupal::service('as_webhook_entities.uuid_lookup');
    \$entity = \$lookup->findEntity('YOUR-UUID-HERE', 'person');
    echo \$entity ? 'Found: ' . \$entity->id() : 'Not found';
    "
    ```
2. **Push a test payload directly into the queue:**

    ```
    lando drush php-eval "
    \$payload = json_encode([
      'event' => 'create',
      'type' => 'person',
      'uuid' => 'test-uuid-001',
      'status' => '1',
      'uid' => '1',
      'title' => 'Test Person',
      'field_departments_programs' => [],
      'field_overview_research' => [],
      'field_links' => [],
    ]);
    \Drupal::queue('webhook_entities_processor')->createItem(\$payload);
    echo 'Queued.' . PHP_EOL;
    "
    lando drush queue:run webhook_entities_processor
    ```
3. **Check for field errors** — if a field in the payload doesn't exist on the destination bundle, the update will fail. Verify field existence:

    ```
    lando drush php-eval "
    \$fields = \Drupal::service('entity_field.manager')->getFieldDefinitions('node', 'article');
    echo implode(', ', array_keys(\$fields));
    "
    ```

CHANGELOG
---------

[](#changelog)

### 2.0

[](#20)

- Refactored `WebhookCrudManager` using the Strategy pattern — per-type field logic extracted into dedicated handler classes under `src/WebhookHandler/`
- Added `WebhookHandlerInterface` and `WebhookHandlerBase` with shared entity lookup helpers (`lookupTermTidsByName`, `lookupTermTidsByProperty`, `lookupNodeNidsByRemoteUuid`)
- Added handler classes: `PersonWebhookHandler`, `ArticleWebhookHandler`, `MediaReportEntryWebhookHandler`, `MediaReportPersonWebhookHandler`, `TermWebhookHandler`
- `WebhookCrudManager` is now a thin dispatcher; shared logic (departments/domain access, node creation, save) remains centralised
- Simplified `WebhookUuidLookup::findEntity()` to a type-keyed lookup map, eliminating duplicate if blocks
- Cleaned up `WebhookEntitiesQueue`: removed redundant UUID ternary, extracted `dispatchCreate()` helper, removed dead code
- Fixed two bugs in `MediaReportEntryWebhookHandler`: `field_news_date` was incorrectly read from `field_outlet_name`, and `field_media_report_public_cat` had a variable typo
- Moved `field_portrait_image_alt` out of shared update logic into `ArticleWebhookHandler` where it belongs

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance99

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~32 days

Recently: every ~5 days

Total

20

Last Release

5d ago

Major Versions

v1.0.8 → v2.0.02026-04-08

### Community

Maintainers

![](https://www.gravatar.com/avatar/f17dcdbbef5d086a5058ec138bc2f825149a5711e83709868f43494eef805b51?d=identicon)[markewilson](/maintainers/markewilson)

---

Top Contributors

[![markewilson](https://avatars.githubusercontent.com/u/7050965?v=4)](https://github.com/markewilson "markewilson (58 commits)")

### Embed Badge

![Health badge](/badges/as-cornell-as-webhook-entities/health.svg)

```
[![Health](https://phpackages.com/badges/as-cornell-as-webhook-entities/health.svg)](https://phpackages.com/packages/as-cornell-as-webhook-entities)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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