Hello Drupal fanatics! Welcome to “Drupal & AI Adventures. In this series, we explore the fantastic world of Drupal modules powered by artificial intelligence. Our mission? We want to inspire and enlighten YOU. We'll dive in together! This time we're talking about adding ECA and ChatGPT in flows.

ECA logo

ECA?

ECA is a no-code solution that allows you to orchestrate your Drupal site. Integrated with graphical user interfaces such as BPMN.iO, Camunda, ECA Classic Modeller or other possible future modellers, ECA is a robust system for building conditionally triggered action sets.

ECA is triggered for each Drupal event. It validates these events against event-condition-action models and processes all models for the current event. ECA models are stored in config, so they can be imported and exported via the admin UI or Drush.

If you want to read more about ECA, be sure to check out the ECA guide.There is a lot of interesting information, as well as a library of downloadable ECA models and video tutorials.

https://ecaguide.org/

 

ECA is currently integrated with the following modellers:

  • BPMN.iO: JavaScript-based implementation for building models as two-dimensional diagrams, integrated into the Drupal admin UI
  • Camunda: user-friendly desktop client for designing and implementing automated processes
  • ECA Classic Modeller: “low-level” modeling tool using Drupal core's form API
     

So with ECA you can put together a lot of things that until now modules were made for. 
An example: 

“After login, if I have a certain role, I want users to be redirected to a certain dashboard. “ 

There are modules that do this (e.g. redirect_after_login or user_redirect or login_destination) that are used on a lot of sites (these 3 modules alone on 48000+ sites). 
We see in many places that developers build this custom. 

The need for this is completely eliminated with ECA. The functionalities in these modules or custom code can also be implemented in a no-code way with ECA. 
An example flow after login on ECA (this flow does the login redirect and much more, check the diagram). 

https://www.drupal.org/project/eca

 

 

ECA is enormously powerful. Once you master ECA, you can simply remove a lot of existing Drupal modules.

ECA & AI?

Thanks to the module prompt, you can add AI prompts as no-code actions. 
This allows you to do the following: 

  • Autocategorize content: Take the value of the body field, analyze the tags with ChatGPT and store the result in another field.
  • Title generation: Analyze a long text field with ChatGPT and generate a new title.
  • Summary generation: Analyze the text fields of an entity, generate a summary and save it in a field of the same entity.
  • Text translation: Use ChatGPT to translate the values of entity fields.
  • Transcribing audio files: Send the file uploaded to Drupal to the Gladia API, which returns the transcription.
  • Correct and rewrite spelling errors with ChatGPT.
  • Automatic content generation based on another field.
  • You can do anything you can think of. Use any ECA module event to launch the execution of a configured Prompt and then ECA to do things with the value returned by the API (save the node, create entities, send emails, and so on).
ECA prompt example
Ik liet ECA data ophalen uit InfluxDB en doorsturen naar ChatGPT om daar een beschrijving van te maken. "Schrijf een weerbericht voor toekomstige dagen en leg de focus op hernieuwbare energie"
Data: [json van influxdb]
Lammensj
 / 
Auteur van de InfluxDB en solcast modules’

Comments

ECA module

The ECA module is complex and certainly overwhelming at first. But it is enormously powerful. It is also supported by some very active people in the community. Definitely worth checking out! 

Prompt module

The Prompt module (which enables prompts in ECA) was built by a maintainer and is not yet stable. It is rather experimental and can be evaluated in limited use cases. There is still work to be done here to achieve a stable version. 

Openai module

De Openai module heeft ook een submodule "openai_eca" Je kan dus met de Openai module en de ECA module AI-powered flows maken. Dan is de prompt module niet nodig.
Deze module geniet overigens ook van betere community support.

Want to know more about AI?