-

Drupal AI - How to Create Website Content Using Drupal AI Modules?

Drupal, as a system that focuses on flexibility and a modern approach to content publishing, is rapidly adopting AI solutions. It offers tools for integrating with artificial intelligence models (including OpenAI), which allows automating many processes: from content generation to translation and language analysis. In this article, I’ll introduce the operation of AI modules for Drupal, demonstrating their use with examples from a practical demo. I invite you to read the blog post or watch the “Nowoczesny Drupal” episode.


In this article:


Drupal AI modules - where to start?

To use the artificial intelligence feature, we need to install some AI modules in Drupal:

  • Drupal AI - a module that provides the main integration functionality.
    • AI Translate sub-module for translating content between languages,
    • The AI CKEditor integration sub-module that adds a plugin allowing users to operate prompts to generate content from within the editor.
    • AI Content Suggestions sub-module to support the content creation and optimization process.
  • OpenAI Provider - a module that connects Drupal to OpenAI services (e.g., ChatGPT for content and graphics generation and text translation).
  • Drupal AI Agents - a module that allows you to automate processes using so-called agents.
  • AI SEO Analyzer and AI Image Alt Text modules - supporting content editing and SEO optimization.
  • Drupal AI Chatbot - a module that enables you to add interactive chat to your website.

In addition, a Key module is required to provide the API key needed to connect to external services such as OpenAI.

Drupal admin panel view with a section with artificial intelligence-based modules.


AI configuration in Drupal - model selection and integration settings

Once the modules are installed, configuration begins with selecting a vendor (such as OpenAI for this article) and providing an API key. To do this, we go to settings: 

Home > Administration > Configuration > AI > AI Providers.

We save the selected configuration. Then we go to the section:

Home > Administration > Configuration > AI

We point out:

  • default model (e.g., for generating text, images, or speech),
  • content generation parameters (e.g., number of images, quality, language),
  • functions depending on the selected model (e.g., text-to-imageimage-to-videotext-to-speech).


Configuring AI in Drupal and selecting an artificial intelligence model for website activities.

Generating graphical content with AI in Drupal

One of the more interesting features of the artificial intelligence module in Drupal is the ability to generate images based on a text prompt. This process has been well integrated with the media system, so that the generated graphics can be immediately saved as elements in the media library and used, for example, in the content of articles.

Again, we go to the configuration:

Home > Administration > Configuration > AI

There you’ll find a list of available models for different types of operations, including:
 

  • Speech-to-text - text-based speech generation,
  • Text-to-image - generating images based on text,
  • Text-to-speech conversion.

For image generation, select Text-to-image and indicate:

  • model - e.g., Dall-E 3 (if available),
  • prompt - that is, a description of what we want to generate,
  • the number of images - how many variants the AI is to create.

In addition, we check the "Save as Media" option to have the images automatically saved to the media library in Drupal.

The process of generating graphics from ChatGPT directly in Drupal using the AI module.

Drupal AI Agents module - configuration automation in practice

The Drupal AI Agents module opens up new possibilities for automated Drupal configuration. Instead of clicking through form after form, we can complete many tasks with simple natural language commands - all thanks to ChatGPT integration.

Create a taxonomy dictionary with Drupal AI Agents

We start by calling an agent. We enter the agents panel and type a command, such as: "Please create a new dictionary named 'car brands'."

The AI Agents section in Drupal is used to create commands with a field to display the status of the task being performed.


The agent processes our request and displays the status of the task completion. After a while, we can go to the list of taxonomy dictionaries and immediately see the newly created item. Everything is done automatically - no need to click through forms in Drupal.

Taxonomy dictionary list, where you can see the dictionary generated by AI agents using the corresponding module.

Add terms to the dictionary

Having the dictionary ready, we can go a step further. We type another command: "Please create terms with a list of the five most popular car brands in the world."

After a while, we see the system perform operations like Manipulate Taxonomy Terms and Create Taxonomy Term. We switch back to our dictionary and see the finished entries: Toyota, Volkswagen, Hyundai, General Motors, Ford - all created automatically.

You can automatically generate dictionary entries in Drupal using the AI module.


If you want to add a hierarchical structure, just create another prompt, such as: "Add Ford models produced since 2010 as children of the term Ford." The agent will easily add the appropriate dependencies in the taxonomy tree.

What else can be done with AI agents?

In addition to operations on taxonomies, Drupal AI agents can do much more. As we work with the module, we see that there are different types of actions available that we can trigger with the prompt.

We have the option to:

  • create new fields in already existing content types,
  • add new types of content, which we can define verbally,
  • switch modules on and off,
  • create relationships between entities (e.g., a reference field linking a content type to a taxonomy).

AI Agents settings in Drupal, where you can see all available options for using this artificial intelligence feature.

Drupal AI chatbots and AI assistants - intelligent support in the system interface

AI modules available for Drupal allow us to generate content or manage data structures and use AI assistants, which we can embed directly into the website interface, for example, in the form of chatbots. This is a convenient way to get help, hints, or quick operations in the system using plain language.

Create your own AI assistant in Drupal

We enter the AI configuration and go to the Assistants tab. We add a new assistant - in our case, we name it "chatbot". In the form, we have the option to:

  • enter an action instruction (prompt, which defines its role),
  • specify which agents to use (we can select only selected ones or include all of them),
  • configure provider settings - that is, the AI models to use,
  • set the visibility of call history,
  • add user role restrictions (e.g., for administrators only),
  • type a pre-action prompt - the text that will be the introduction to each action,
  • and an advanced prompt system, which we can also set globally in the settings.php file.

The process of creating a chatbot in Drupal using the AI module for a website.

This gives us full control over how our assistant behaves and what it can be used for.

Put the AI chatbot on the website

After configuring the assistant, we can embed it as a block on the page. We go to "Block Layout", find the block - AI Chatbot module - and configure it.

In the block's settings, we select one of the available assistants - in our case, there is only one, so we assign it. The block has all functions enabled by default, but we can also limit them as needed.

After saving the changes, an interactive chat appears on the page, where we can write questions and give commands, just like in the classic GPT interface.

View of an interactive chat on a web page on Drupal, where you can enter commands for the robot.

We test how our chatbot works by asking it some sample questions:

  • "What is the name of our website?" - the chatbot returns the correct name from the Drupal configuration.
  • "Can you give me a list of enabled modules?" - we get a complete, alphabetical list of active modules.
  • "Can you activate the ban module?" - despite the error that appears, the chatbot activates the module, which can be confirmed with the list of modules.

With assistants and chatbots, we can intuitively use AI functions without going to the admin panel. This is a great solution, for example, for editors who want to quickly check the status of a page, as well as for administrators who need AI tools for simple system operations.

AI Translate - automatic translation of content

Among the possibilities that the AI modules in Drupal give us, one that is particularly useful when working with content on multilingual sites is the automatic content translation feature. Thanks to GPT integration, we can literally translate articles from one language to another with a single click, without needing to copy content to external tools.

Setting up translations using AI Translate

We start by going to the AI Translate configuration. In the settings, we indicate the languages we want to translate - for example, from Polish to English and vice versa.

We can also set dedicated prompts for each direction of translation, giving us more control over the style and tone of the translated content.

The default prompts are already prepared, but nothing prevents you from customizing them to your needs.

Prompts in the Drupal admin panel to translate content using the AI Translate module.

Translate the article step by step with AI Translate

We go into editing the article, which we’ve saved in Polish. For the purpose of the test, we use the entry titled "How to build a local server for Drupal 10 - a guide".

On the right, in the translation section, click next to the English language the option "Translate using GPT-4o" ("Translate using GPT").

The process of translating an article in Drupal using the AI Translate module.

The system processes the content, and after a while, we see that:

  • the title was translated automatically,
  • content in the new language was created and saved as a separate version of the article.

We go to the entry's preview, where we can see that everything has been transferred correctly: heading structure, paragraphs, and formatting.

Translating content to a website on Drupal using the AI Translate module.


The result is two articles in two languages, synchronized and ready for publication. What's more, the system allows you to add as many languages as you want.

GPT-assisted translation is a huge convenience for editors and teams publishing content in multiple languages. Its speed, lack of integration with external services, and ability to preserve content structure make it one of the most practical features available in the AI module set for Drupal.

AI Content Suggestion - intelligent support for content creation

The AI Content Suggestion module is one of the most interesting tools for supporting editors in Drupal. It allows you to analyze and optimize content based on the text entered in the form fields.

How to enable AI Content Suggestion?

To use the feature, we must first activate the module. We go to the list of modules, find AI Content Suggestion, where we can enable suggestions. Here we indicate which fields we want AI to handle (e.g., title, summary, tone of speech, categories).

AI Content Suggestion module settings for handling suggestions for content on a website on Drupal.

Suggestions in the side panel of the content form

When we edit an article, on the form's right side, we have additional options provided by the AI Content Suggestion module. This is where we can quickly get help in creating or improving an entry. The options available to us include:

  • Title suggestions - based on the article's content, AI suggests a better, more attractive title.
  • Category and tag suggestions - based on the content, GPT generates taxonomy suggestions. In our example, these are tags: Drupal, installation, environment, and local requirements.
  • Text readability assessment - the system returns content analysis and suggestions for corrections.
  • Modifying the tone of speech - we can ask AI to transform the text to make it sound, for example, professional or like a 5-year-old.
  • Summary suggestions - useful for populating teasers, meta descriptions, or leads.

Suggestions are generated live, with one click. Everything is done without reloading the page - you simply click, check, and possibly approve changes.

Generating content in CKEditor with the help of AI

The modules available for Drupal also integrate with the content editor, CKEditor. This allows us to generate entire articles or their fragments directly in the text box, without switching to external tools. Just click one icon, and AI will prepare a draft text based on the given topic.

How to enable AI integration in CKEditor?

To use the content generation function in CKEditor, we follow these steps:

  1. We go to Configuration > Content creation > Text formats and editors.
  2. We choose the "full HTML" format.
  3. In the settings of this format, we click on the AI icon on the CKEditor toolbar.
  4. We configure what features are to be available, such as:
    1. text generation,
    2. generating summaries,
    3. content translation,
    4. HTML code formatting.

The process of generating content using CKEditor in Drupal directly from the editor.

After saving the changes, the function is active and ready for use.

Using the "Generate with AI" function in CKEditor

When creating a new article, such as "New Drupal article about performance," we go to the body field, specify the text format as "Full HTML," and click the "AI Assistant" icon that appears in the editor toolbar. We select "Generate with AI" from the drop-down list. As a result, a window opens for entering an AI prompt.

After typing the command:

  • AI begins processing,
  • after a while, it inserts the finished text into the field with the HTML structure preserved,
  • we can already see the division into paragraphs, headings, lists - all ready for further editing or saving.

The process of automatically generating a blog article using the Generate with AI function in CKEditor.

In our example, the content was generated correctly and could be saved as a finished draft of the article. This is a huge convenience for editorial work, especially when we need to quickly prepare a working draft or start writing from a specific content scheme.

An example of a ChatGPT-generated blog article from within CKEditor in Drupal.

Thanks to AI's integration with CKEditor, we can use the power of GPT directly to create text. This is a convenient, fast, and efficient solution that will be especially appreciated by those who regularly prepare many articles or news pages.

Drupal AI and AI modules - summary

Drupal AI modules significantly extend the capabilities of this CMS, making it easier to create, translate, optimize, and automate content. Whether it's generating images, populating taxonomies, configuring content types, or working with content editors and chatbots, we can work faster and more efficiently thanks to integration with services like OpenAI.

If you want to better understand how the various AI modules in Drupal work or need help implementing and configuring these features on your website, contact Drupal development experts. We’ll be happy to help you realize the potential of artificial intelligence in your project.

-