How Drupal Site Builders Can Wield the Power of ChatGPT
Throughout 2023 we integrated OpenAI’s ChatGPT with Drupal 10 to create new and interesting ways of augmenting your content management tasks with artificial intelligence. What started as a small idea captured lightning in a bottle, sparking lots of inspiration and discussion around AI and its potential applications within Drupal.
For example, integrating ChatGPT into the CKEditor WYSIWYG proved to be a very popular idea:
Later, we expanded the CKEditor integration to have more features than just text generation. People began deploying the OpenAI module to production just for this feature alone. As a result, Drupal became one of the first major open-source CMS systems to have an integrated experience with ChatGPT that wasn’t based around chatbots or the extensive need for a user to submit lots of prompts to get a result.
Today several integrations are being worked on around search, Views generation, and other administrative applications with AI in Drupal. The future of Drupal with AI enhancements is promising, indeed.
But what about site builders and end users? How do we give them the power to wield AI too?
Integrating with Event, Condition, Actions (ECA) Module
We’ve certainly built a lot of features and proofs of concept for ChatGPT / AI in Drupal. But with so many people reaching out online and in person, it became clear that even with a team of 100 developers, you could never build out every possible feature or integration to satisfy user needs. At its core, AI integrations could be endless, bespoke to different users and organizations with different needs. You would wind up simply coding forever trying to keep on top of the asks — and then maintaining all that code.
Instead, we took a different approach. Starting with the latest beta releases of the OpenAI ChatGPT module for Drupal, we added tight integration with the Event, Condition, Actions module (known as ECA).
In short, the ECA module allows users to define or “draw” and diagram workflows that connect back to event, condition, and action plugins in Drupal. Without any code or any technical knowledge of Drupal required, a user can orchestrate custom functionality that triggers when they want (i.e., the events and conditions) and then do something that they’d like to do (i.e., the actions). If you’ve ever made a flowchart or a diagram, buckle up, because now you’ll be able to create custom functionality with one using ChatGPT in Drupal!
Behind the scenes, each step in the workflow maps back to an event, condition, or action plugin in Drupal that executes with the input and parameters provided by the user.
In our example image, a user is creating a simple workflow that when saving a node, if the “summary” field is empty, ChatGPT will read the body text and generate a summary value, then save that value to the summary field. Now when editors save content ChatGPT can fill in the summary if one wasn’t provided. This is just a single example. You can create dozens of workflows around this same basic concept.
So far, we’ve added the following action plugins for use with the ECA module:
- ChatGPT Completion
- Text Completion
- Speech to Text
- Content Moderation/Governance Check
- Generate a Text Embedding from Content
With these, you can plug into any part of Drupal and take advantage of these API endpoints in OpenAI. One example could be when you upload a document, have an ECA workflow take the document text, and use the Text to Speech action, then save the result as an audio file on the document, or reference to Audio media item. Or the opposite — when uploading audio or video, use Speech-to-Text to save the text representation back to their respective items. Another could be when submitting content, don’t allow it to be saved or moved to a different published state if the Content Moderation check does not pass.
There are a myriad of combinations and applications people can build with this. Democratizing access to using AI without needing technical knowledge of how it works will allow more people using Drupal to freely adopt and implement AI at their discretion while not requiring developers to write mountains of code to support them.
Users are already taking advantage of these features, like this video from Mike Anello demonstrating how it can work for you:
We hope to keep expanding on this in 2024 and encourage users to adopt the ECA module in conjunction with the OpenAI ChatGPT module. This will provide maximum flexibility and allow site builders and users to chart their destiny as they implement AI for their content needs.
Want to learn more about how our ECA Module for Drupal can help you wield the power of AI to streamline your site-building experience? Reach out. We’re excited to show you all its useful applications.
Get the Drupal 10 Development Cookbook
Drupal 9 is now the end of its life. Have you upgraded to Drupal 10 yet? Are you facing some difficulties? We have a great resource that can help you!
The "Drupal 10 Development Cookbook" is co-authored by Matt Glaman and me, Kevin Quillen. We cover a wide variety of topics with hands-on examples so you can get up and running with Drupal 10 in no time. These topics include running Drupal locally with Docker-based tools, content modeling, creating custom modules, how to do automated testing, and migrating data into Drupal from various data sources. The book will help you understand how to develop and build modules just like the ones we talk about often at Velir.
What others are saying:
The "Drupal 10 Development Cookbook" is highly regarded in the Drupal community, receiving favorable reviews for its advanced and detailed approach to updating one's Drupal needs. Released in February 2023, this edition is particularly notable for its timely publication following the release of Drupal 10, offering an updated and comprehensive guide for Drupal development. This book is a must-read for anyone looking to master Drupal 10 development.
You can pick up the book on Amazon as a physical copy or for Kindle.