[[{“value”:”
Introduction
n8n is an open-source workflow automation platform that enables developers to visually connect applications, APIs, and services to build automated workflows. With its flexible, node-based approach, it simplifies process orchestration while offering the ability to integrate custom logic wherever needed.
SAP Cloud Application Programming Model (CAP) provides a powerful framework for building enterprise-grade services. The cds-feature-n8n plugin bridges the two by integrating n8n directly into the CAP Java runtime, enabling applications to trigger external workflows in response to entity events without writing custom REST clients or integration handlers.
In this blog, we explore a hands-on Proof of Concept (PoC) where a SAP CAP Java service triggers an n8n workflow whenever a new order is created, with the workflow routing orders into different paths based on their status.
Prerequisites
– Java 21
– Maven 3.6.3+
– Node.js v22.15.0
– n8n running locally via npx n8n
Note: The cds-feature-n8n plugin requires CDS 5.2.0 and Spring Boot 4.1.2. Earlier versions will fail at startup.
Project Setup
Create the project using the SAP CAP CLI:
cds init cap-n8n-poc –java
Update the root pom.xml with the required versions:
<jdk.version>21</jdk.version>
<cds.services.version>5.2.0</cds.services.version>
<spring.boot.version>4.1.2</spring.boot.version>
Add the plugin to srv/pom.xml:
<dependency>
<groupId>com.sap.cds</groupId>
<artifactId>cds-feature-n8n</artifactId>
<version>0.0.1</version>
</dependency>
Data Model
Create the entity definition in db/schema.cds:
namespace com.example;
entity Orders {
key ID : UUID;
customer : String;
product : String;
quantity : Integer;
status : String default ‘NEW’;
}
Service Definition
Create the service in srv/orders-service.cds:
using { com.example as example } from ‘../db/schema’;
service OrdersService {
@n8n.process.start: [{ on: ‘CREATE’, path: ‘order-created’ }]
entity Orders as projection on example.Orders;
}
The @n8n.process.start annotation is all the integration code you need. It instructs the plugin to trigger the n8n webhook at the order-created path whenever a new Orders entity is created. The plugin takes care of everything else behind the scenes, including event detection, payload extraction, outbox queuing, and webhook delivery – eliminating the need for additional boilerplate code.
Configuration
Add the following to srv/src/main/resources/application.yaml:
spring:
config.activate.on-profile: default
sql.init.platform: h2
cds:
data-source.auto-config.enabled: false
outbox:
services:
N8nOutbox:
enabled: true
n8n:
base-url: http://localhost:5678
Two things to note here:
1. The N8nOutbox outbox service must be explicitly enabled – the plugin looks for a Spring bean qualified with that exact name.
2. The n8n.base-url points to your local n8n instance. In production, this would be replaced with the hosted n8n URL.
Building the n8n Workflow
The workflow consists of three nodes and requires no code.
Webhook – Create Order
A Webhook node listens for POST requests at /webhook/order-created – the path defined in the @n8n.process.start annotation. Every time an order is created in SAP CAP, the plugin delivers the payload here automatically.
Switch – Check Order Status
A Switch node in Rules mode routes execution based on the status field:
1. Valid Order – status is NEW
2. Invalid Order – status is INVALID
Downstream Nodes
Each branch connects to its own processing node. In this example we keep it simple, but these nodes could send notifications, call external APIs, or invoke AI agents – summarizing orders, classifying them, or triggering intelligent approval workflows – all without touching the SAP CAP Java code.
Important: The workflow must be Published before testing.
Testing the Integration
With the SAP CAP service running and the n8n workflow published, send a POST request to the OData endpoint using Bruno (or any HTTP client).
Valid Order:
POST http://localhost:8080/odata/v4/OrdersService/Orders
{
“customer”: “Alice”,
“product”: “Laptop”,
“status”: “NEW”
}
Invalid Order:
POST http://localhost:8080/odata/v4/OrdersService/Orders
{
“customer”: “Bob”,
“product”: “PC”,
“status”: “INVALID”
}
Within a few seconds, the plugin picks up the event from the outbox and delivers the payload to n8n. Opening the Switch node in n8n confirms the full order payload was received – including the CAP-generated ID, the entity fields, and the webhook URL.
Notice the user-agent: Java/21.0.7 header – implies the request originated from the CAP Java runtime.
Alice’s order with status NEW is routed to the Valid Order branch:
Bob’s order with status INVALID is routed to the Invalid Order branch:
Each branch receives exactly 1 item, correctly routed – confirming the payload was received, evaluated, and processed without any custom Java code.
What’s Next
What we have explored is a practical integration between two powerful platforms, achieved with minimal code and configuration. This is precisely where the cds-feature-n8n plugin adds value: by abstracting the integration complexity, it allows developers to focus on business logic and workflow design rather than building and maintaining custom integration code.
The example demonstrated here is just one of many possibilities. The same integration pattern can be extended to a wide range of enterprise use cases:
-
AI-powered workflows: Pass entity data to LLMs through n8n’s OpenAI or Anthropic nodes to classify records, generate summaries, identify anomalies, or initiate intelligent approval workflows – all without implementing custom integration logic.
-
Event-driven business processes: Extend the integration to different SAP CAP entities and events, enabling use cases such as invoice processing, customer onboarding, approval workflows, and document generation.
-
Production-ready deployments: Replace the local n8n URL with your hosted n8n instance, configure the required authentication, and leverage the persistent outbox mechanism for reliable webhook delivery and automatic retries.
The underlying architecture maintains a clear separation of responsibilities: SAP CAP manages the data model and business logic, while n8n handles workflow orchestration and automation. Together, they provide a flexible approach to extending enterprise applications with event-driven automation and AI capabilities.
For more details, refer to the SAP CAP n8n plugin documentation, n8n Workflow Documentation, n8n Integrations & Nodes to learn more about plugin configuration, workflow creation, and available integrations.
“}]]
[[{“value”:”Introductionn8n is an open-source workflow automation platform that enables developers to visually connect applications, APIs, and services to build automated workflows. With its flexible, node-based approach, it simplifies process orchestration while offering the ability to integrate custom logic wherever needed.SAP Cloud Application Programming Model (CAP) provides a powerful framework for building enterprise-grade services. The cds-feature-n8n plugin bridges the two by integrating n8n directly into the CAP Java runtime, enabling applications to trigger external workflows in response to entity events without writing custom REST clients or integration handlers.In this blog, we explore a hands-on Proof of Concept (PoC) where a SAP CAP Java service triggers an n8n workflow whenever a new order is created, with the workflow routing orders into different paths based on their status.Prerequisites- Java 21
– Maven 3.6.3+
– Node.js v22.15.0
– n8n running locally via npx n8nNote: The cds-feature-n8n plugin requires CDS 5.2.0 and Spring Boot 4.1.2. Earlier versions will fail at startup.Project SetupCreate the project using the SAP CAP CLI:cds init cap-n8n-poc –javaUpdate the root pom.xml with the required versions:<jdk.version>21</jdk.version>
<cds.services.version>5.2.0</cds.services.version>
<spring.boot.version>4.1.2</spring.boot.version>Add the plugin to srv/pom.xml:<dependency>
<groupId>com.sap.cds</groupId>
<artifactId>cds-feature-n8n</artifactId>
<version>0.0.1</version>
</dependency>Data ModelCreate the entity definition in db/schema.cds:namespace com.example;
entity Orders {
key ID : UUID;
customer : String;
product : String;
quantity : Integer;
status : String default ‘NEW’;
}Service DefinitionCreate the service in srv/orders-service.cds:using { com.example as example } from ‘../db/schema’;
service OrdersService {
@n8n.process.start: [{ on: ‘CREATE’, path: ‘order-created’ }]
entity Orders as projection on example.Orders;
}The @n8n.process.start annotation is all the integration code you need. It instructs the plugin to trigger the n8n webhook at the order-created path whenever a new Orders entity is created. The plugin takes care of everything else behind the scenes, including event detection, payload extraction, outbox queuing, and webhook delivery – eliminating the need for additional boilerplate code.ConfigurationAdd the following to srv/src/main/resources/application.yaml:spring:
config.activate.on-profile: default
sql.init.platform: h2
cds:
data-source.auto-config.enabled: false
outbox:
services:
N8nOutbox:
enabled: true
n8n:
base-url: http://localhost:5678Two things to note here:1. The N8nOutbox outbox service must be explicitly enabled – the plugin looks for a Spring bean qualified with that exact name.2. The n8n.base-url points to your local n8n instance. In production, this would be replaced with the hosted n8n URL.Building the n8n WorkflowThe workflow consists of three nodes and requires no code.Webhook – Create OrderA Webhook node listens for POST requests at /webhook/order-created – the path defined in the @n8n.process.start annotation. Every time an order is created in SAP CAP, the plugin delivers the payload here automatically.Switch – Check Order StatusA Switch node in Rules mode routes execution based on the status field:1. Valid Order – status is NEW2. Invalid Order – status is INVALIDDownstream NodesEach branch connects to its own processing node. In this example we keep it simple, but these nodes could send notifications, call external APIs, or invoke AI agents – summarizing orders, classifying them, or triggering intelligent approval workflows – all without touching the SAP CAP Java code.Important: The workflow must be Published before testing.Testing the IntegrationWith the SAP CAP service running and the n8n workflow published, send a POST request to the OData endpoint using Bruno (or any HTTP client).Valid Order:POST http://localhost:8080/odata/v4/OrdersService/Orders
{
“customer”: “Alice”,
“product”: “Laptop”,
“status”: “NEW”
}Invalid Order:POST http://localhost:8080/odata/v4/OrdersService/Orders
{
“customer”: “Bob”,
“product”: “PC”,
“status”: “INVALID”
}Within a few seconds, the plugin picks up the event from the outbox and delivers the payload to n8n. Opening the Switch node in n8n confirms the full order payload was received – including the CAP-generated ID, the entity fields, and the webhook URL.Notice the user-agent: Java/21.0.7 header – implies the request originated from the CAP Java runtime.Alice’s order with status NEW is routed to the Valid Order branch:Bob’s order with status INVALID is routed to the Invalid Order branch:Each branch receives exactly 1 item, correctly routed – confirming the payload was received, evaluated, and processed without any custom Java code.What’s NextWhat we have explored is a practical integration between two powerful platforms, achieved with minimal code and configuration. This is precisely where the cds-feature-n8n plugin adds value: by abstracting the integration complexity, it allows developers to focus on business logic and workflow design rather than building and maintaining custom integration code.The example demonstrated here is just one of many possibilities. The same integration pattern can be extended to a wide range of enterprise use cases:AI-powered workflows: Pass entity data to LLMs through n8n’s OpenAI or Anthropic nodes to classify records, generate summaries, identify anomalies, or initiate intelligent approval workflows – all without implementing custom integration logic.Event-driven business processes: Extend the integration to different SAP CAP entities and events, enabling use cases such as invoice processing, customer onboarding, approval workflows, and document generation.Production-ready deployments: Replace the local n8n URL with your hosted n8n instance, configure the required authentication, and leverage the persistent outbox mechanism for reliable webhook delivery and automatic retries.The underlying architecture maintains a clear separation of responsibilities: SAP CAP manages the data model and business logic, while n8n handles workflow orchestration and automation. Together, they provide a flexible approach to extending enterprise applications with event-driven automation and AI capabilities.For more details, refer to the SAP CAP n8n plugin documentation, n8n Workflow Documentation, n8n Integrations & Nodes to learn more about plugin configuration, workflow creation, and available integrations. “}]] Read More Technology Blog Posts by SAP articles
#SAPCHANNEL