Tips > Data, APIs & Webhooks

Chain Webhooks Between Workflows for Microservice Architectures

For complex systems, split logic across multiple workflows that communicate via internal webhook calls.

TipIntermediate2 min read

For complex systems, split logic across multiple workflows that communicate via internal webhook calls. One workflow receives the external event, then triggers specialized sub-workflows via HTTP Request nodes pointing to other n8n webhooks. This gives you independent deployment, testing, and error handling per service.

Real-world example: An order processing system with separate workflows for payment, inventory, and notification logic.

Main workflow (Order Receiver):

// Code node: "Route Order Event"
const event = $input.first().json.body;
const baseUrl = 'https://your-n8n.example.com/webhook';

// Determine which downstream workflows to trigger
const targets = [];

if (event.type === 'order.created') {
  targets.push({ url: `${baseUrl}/internal/payment/charge`, data: event });
  targets.push({ url: `${baseUrl}/internal/inventory/reserve`, data: event });
  targets.push({ url: `${baseUrl}/internal/notifications/order-confirm`, data: event });
}

if (event.type === 'order.cancelled') {
  targets.push({ url: `${baseUrl}/internal/payment/refund`, data: event });
  targets.push({ url: `${baseUrl}/internal/inventory/release`, data: event });
}

return targets.map(t => ({ json: t }));
```text
Then use an **HTTP Request** node in batch mode to call each target:

```json
{
  "method": "POST",
  "url": "={{ $json.url }}",
  "sendBody": true,
  "bodyParameters": {
    "parameters": []
  },
  "jsonBody": "={{ JSON.stringify($json.data) }}",
  "options": {
    "timeout": 5000
  }
}
```text
Each sub-workflow has its own Webhook node:

```yaml

# Payment workflow

Path: internal/payment/charge
Auth: Header Auth (internal shared secret)

# Inventory workflow

Path: internal/inventory/reserve
Auth: Header Auth (internal shared secret)

# Notification workflow

Path: internal/notifications/order-confirm
Auth: Header Auth (internal shared secret)
```text
> **Tip: Use the Execute Workflow node for tighter coupling**
>
> If the sub-workflows are on the same n8n instance and you need synchronous results, the **Execute Workflow** node is simpler and avoids HTTP overhead. Use webhook chaining when workflows run on separate instances or when you need fire-and-forget behavior.

This pattern lets you update notification logic without touching payment logic, and each workflow has its own error handling and retry configuration.

**Related:** [Set a Unique Encryption Key and Back It Up](../security-best-practices/01-set-a-unique-encryption-key-and-back-it-up.md) | [Use the HTTP Request Node as a Universal Connector](../integration-patterns/01-use-the-http-request-node-as-a-universal-connector.md)

Want this running in your stack?

I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.