Dries Buytaert

Connecting Drupal with Activepieces

This page is part of my digital garden. It is more like a notebook entry than a polished blog post. It's a space where I document learnings primarily for my own reference, yet share them in case they benefit others. Unlike my blog posts, these pages are works-in-progress and updated over time. Like tending to a real garden, I periodically refine its content. I welcome suggestions for improvements at dries@buytaert.net.

Activepieces is an open source workflow automation platform, similar to Zapier or n8n. It connects different systems so they can work together in automated workflows. For example, you might create a workflow where publishing a Drupal article automatically creates a social media post, updates a Google Sheet, and notifies your team in Slack.

There are two main ways to run Activepieces:

  • Activepieces Cloud: The easiest option for production use or for evaluating Activepieces. The limitation is that it cannot reach Drupal sites running on your localhost.

  • Run Activepieces locally: Useful when you are developing or testing Drupal integrations. There are two ways to do this:

    1. Docker environment: If you are developing Drupal sites locally with tools like DDEV, the easiest option is to run Activepieces locally using Docker so both can communicate easily. See running Activepieces locally with Docker.

    2. Development environment: If you want to modify the Activepieces codebase or contribute to the Drupal Piece, you will need the full development toolchain. See setting up the Activepieces development environment.

Once you have Activepieces running, you'll want to connect it to your Drupal site. This note explains two ways to do that: a basic integration using Drupal's built-in APIs, and an advanced setup that unlocks deeper automation capabilities.

Setting up basic integration

You can connect Drupal with Activepieces without installing any extra Drupal modules.

Drupal ships with JSON:API support, a REST API that exposes your content and data through HTTP requests. This means Activepieces can query your content, fetch individual nodes, explore field definitions, and follow entity relationships without any custom code.

While JSON:API is part of Drupal Core, it may not be enabled yet. You can enable it with:

drush pm-enable jsonapi -y 

Next, set up a dedicated Drupal user account with only the permissions needed for what you want Activepieces to do.

Activepieces can use Basic Authentication to connect to Drupal with the corresponding username and password.

Basic Auth sends credentials with each request, which makes it simple to set up. For production environments, I recommend using a more secure authentication method like OAuth, though I have not tried that yet.

Drupal Core comes with a Basic Auth module, but you might also need to enable it:

drush pm-enable basic_auth -y

Once both modules are enabled, you can create a connection to Drupal from within Activepieces. In the Activepieces interface, drag a Drupal trigger or action onto the canvas, and you'll be prompted to set up the connection.

Setting up advanced integration

For more advanced scenarios, we created the Orchestration module. It's an optional module. Installing this module unlocks deeper integrations that enable external systems to trigger Drupal ECA workflows, use Drupal AI agents, call Drupal Tools, and more.

The module is organized using specialized submodules, each connecting to a different part of Drupal's ecosystem. You can pick and choose the capabilities you want to use.

For starters, here is how to install the Drupal AI and ECA integrations:

composer require drupal/orchestration drupal/ai drupal/ai_agents drupal/tool drupal/eca
drush pm-enable ai ai_agents tool eca orchestration_ai_agents orchestration_ai_function orchestration_tool orchestration_eca -y

Before you can use any of the AI agents, you also need to install and configure one or more AI providers:

composer require drupal/ai_provider_anthropic drupal/ai_provider_openai drupal/ai_provider_ollama
drush pm-enable ai_provider_anthropic ai_provider_openai ai_provider_ollama -y

Clear the cache:

drush cache-rebuild

With these modules installed, you can build much more sophisticated workflows that leverage Drupal's internal automation and AI capabilities.