I suggest planning an ECA integration for D10

Created on 17 January 2024, over 1 year ago

Problem/Motivation

In the module page it's written that a Rules module integration is planned, but it looks like the successor to rules for Drupal 10 is ECA, which is already stable and with more features, so I suggest planning an integration with that 😊

🌱 Plan
Status

Active

Version

3.0

Component

Miscellaneous

Created by

🇮🇹Italy kopeboy Milan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @kopeboy
  • 🇩🇪Germany sanduhrs 🇪🇺 Heidelberg, Germany, Europe

    Patches welcome :)

  • 🇺🇸United States freelock Seattle

    All that needs to happen for this is creating some plugins -- and probably not many.

    Event plugin -- Webhook received
    Action plugin -- Send webhook

    ... since Webhooks are entities, much of the normal entity ECA plugins should already work. Are there any other plugins we need?

  • 🇩🇪Germany sanduhrs 🇪🇺 Heidelberg, Germany, Europe

    How would we gain access to the json serialized webhook payload and headers?

  • 🇺🇸United States freelock Seattle

    ECA largely uses the token system to access data. So if there's an Event plugin that is dispatched when a webhook is received, that plugin would define what tokens are available -- presumably the headers, payload, etc.

    Likewise, for sending a webhook, the action plugin(s) might have different options for taking a pre-serialized JSON string, or automatically serialize an object or array to JSON -- those are the main decisions that need to be made. Can start with a simple case...

  • 🇩🇪Germany sanduhrs 🇪🇺 Heidelberg, Germany, Europe
  • 🇺🇸United States freelock Seattle

    So I wanted to actually use this, and am vibe-coding a plugin -- and I see a bunch of work going into the 4.0.x-dev branch around the new webhook entities? That seems like a great improvement -- and I see the text on the project page saying this now works with standard entity events so we get ECA integration for free.

    How far along is this? Is it ready to go? Is a generic webhook handler event still useful?

    Have a prototype created, going ahead and sharing. This is probably more relevant for the 3.x branch, so setting back to that...

  • 🇺🇸United States freelock Seattle
  • 🇺🇸United States freelock Seattle

    Pushing up to a production instance for internal testing now.

  • Pipeline finished with Success
    about 1 month ago
    Total: 161s
    #584536
  • 🇺🇸United States freelock Seattle

    This is working as expected! Tested with two different inbound webhooks.

    New Webhook Received event, provides the full webhook structure as [event:webhook], with the payload under [event:webhook:payload]. You can use the "deserialize" action to turn the payload into a data structure for access to what's sent in the payload. And when you add the event, you can select from a dropdown which webhook to trigger on, or all webhooks.

Production build 0.71.5 2024