Problem/Motivation

Create a WebhookManager service in the submodule.
It should handle the webhook lifecycle in one place:

  • register
  • deregister
  • sync
  • ping
  • rotate

This avoids duplicating logic across hooks, the admin UI, and Drush.
As a developer, I want a WebhookManager service in the submodule.
The service should centralize all DAM webhook orchestration.

Acceptance criteria

  • registerAll(bool $force = FALSE): array
    • Registers per event type.
    • Skips stored IDs unless $force is TRUE.
    • Stores IDs in acquia_dam_webhooks.webhook_ids State key.
  • deregisterAll(): void
    • Performs a best-effort DELETE for each stored ID.
    • Deletes acquia_dam_webhooks.webhook_ids and all acquia_dam_webhooks.webhook_secret.* State keys.
  • syncFromDam(): array
    • Reconciles stored IDs with listWebhooks() response.
    • Re-registers missing webhooks.
      • Returns ['ok', 'repaired', 'failed'].
      • pingAll(): array
        • Returns [event_type => bool].
    • getOrCreateSecret(string $event_type): string
      • Generates bin2hex(random_bytes(32)).
      • Stores the secret in State.
    • rotateAndReregister(): void
      • Clears secrets and IDs.
      • Calls registerAll().
    • getDeliveryUrl(): string
      • Uses Url::fromRoute('acquia_dam_webhooks.webhook_receiver', [], ['absolute' => TRUE]).
    • getStoredWebhookIds(): array
      • Reads State.
    • Service registration
      • Service must be registered as acquia_dam_webhooks.webhook_manager.
      • Constructor injects AcquiaDamWebhookClient, not AcquiaDamClientFactory directly.
      • All DAM webhook API calls must route through acquia_dam_webhooks.api_client.

Issue fork acquia_dam-3611279

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rajeshreeputra created an issue. See original summary.

rajeshreeputra’s picture

Status: Active » Needs review

Requesting review.

  • rajeshreeputra committed 45ef2bba on 1.1.x-webhook
    Resolve #3611279 "Create WebhookManager for registration."
    
rajeshreeputra’s picture

Assigned: rajeshreeputra » Unassigned
Status: Needs review » Fixed

MR merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • rajeshreeputra committed 5429cb66 on 1.1.x-webhook
    Resolve #3611279 "Create WebhookManager for registration."
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.