Skip to main content

n8n workflows

AI-Corporate can start n8n workflows via a production webhook. This is useful when you want to start an automated process outside AI-Corporate, for example creating a task, updating a CRM record, starting a reporting flow, or forwarding form data to another system.

Example: news article on the company website

Suppose the organization has created an n8n workflow that publishes a news article on the company’s WordPress website. In AI-Corporate you then only fill in a short piece of text, for example a few sentences about a client case, event, or internal milestone. With that text you start the workflow in n8n.

The n8n workflow can then, for example:

  1. Create a clean draft text from the short text with an LLM node and a prompt that fits the organization’s tone.
  2. Generate a suitable illustration with a second LLM node, for example in the brand colors and in a recognizable illustrative style.
  3. Prepare or publish the text and image as a blog post on the WordPress website.

This is how AI-Corporate and n8n work together: in AI-Corporate the user selects the workflow and fills in the required information. n8n then performs the automated steps and ensures that the news article ends up neatly on the website.

What does this integration do?

You start an n8n workflow from the workflow overview. Only the production webhook, POST and Header Auth are required. Fields and feedback from n8n are optional and can be configured independently.

  • If the workflow has no fields, the webhook is called immediately.
  • If the workflow has fields, a form opens first. The user fills in the fields and then starts the workflow with the button.
  • The entered values are sent as JSON in a POST request to the n8n webhook.
  • Without feedback, AI-Corporate only confirms that the workflow has started and is running further in n8n. The window does not show a spinner and can be closed immediately.
  • If enabled in the registration, the workflow can send intermediate steps or the end back to AI-Corporate.
  • If approval is enabled in the registration, the user can make a choice directly in AI-Corporate. n8n then continues from the waiting step.

Create n8n workflow in AI-Corporate

An administrator registers the workflow as follows:

  1. Go to Assistants.
  2. Open Workflows.
  3. Choose New n8n workflow.
  4. Enter the workflow name and the n8n production URL.
  5. Configure Header authentication with a header name and secret header value.
  6. Under Feedback from n8n, check only the items that are actually built in this n8n workflow: progress, approval, and/or the end of the workflow.
  7. Optionally add the fields that must be sent in the POST request.
  8. Save the workflow.

All three feedback options are off by default. If you later set callbacks or an approval step in n8n, also update the registration in AI-Corporate. The editor will then know whether to show only a start confirmation or to wait for further signals.

Fields

  • Fields are optional.
  • Each field has one field name and a type.
  • Supported field types are short text, long text, number, yes/no, date, single choice, and multiple choices.
  • For Single choice and Multiple choices add the available options. Single choice is shown as a compact dropdown; Multiple choices shows checkboxes. The chosen value(s) are sent in the JSON body.
  • Required fields must be filled before the workflow can be started.
  • The field name becomes the key in the JSON body sent to n8n.

Create a compatible workflow in n8n

  1. Create a new workflow in n8n.
  2. Add a Webhook as the first node.
  3. Name this node exactly Start workflow. The example expressions below use this name.
  4. Set HTTP Method to POST.
  5. Choose Authentication: Header Auth and use the same header name and secret value as in AI-Corporate.
  6. Set Respond or Response Mode to Immediately.
  7. Copy the Production URL into the field n8n production URL in AI-Corporate. Do not use the test URL with /webhook-test/.
  8. Activate the workflow.

The received data are under body; the technical integration data are under body.integration. Do not remove them in an Edit Fields-, Set-, or Code-node.

Example of the JSON body

If you define fields with the names prompt, customerName, audiences, and date, n8n will receive this JSON body, for example. AI-Corporate automatically adds the integration object.

{
"prompt": "Create a short summary of the request.",
"customerName": "Example Organization",
"audiences": ["employees", "customers"],
"date": "2026-09-22",
"integration": {
"runId": "chat-document-id",
"tenant": "default",
"callbackUrl": "https://europe-west1-ai-corporate.cloudfunctions.net/n8nWorkflowCallback",
"callbackToken": "temporary-token-for-this-run"
}
}

The callback token is for a single execution. Do not store it in logs, fixed configuration, or other systems.

Optional: send progress and completion back

AI-Corporate can only show what n8n reports. Use these callbacks only if you have enabled in the registration Report Intermediate Progress and/or Report End of Workflow.

Configure each callback node as follows:

  1. Choose Method: POST.

  2. Click URL on Expression and paste:

    {{ $('Start workflow').first().json.body.integration.callbackUrl }}
  3. Choose Authentication: None.

  4. Enable Send Headers and add the headers below.

  5. Enable Send Body and choose Body Content Type: JSON and Specify Body: Using JSON.

Use these headers:

Authorization: Bearer {{ $('Start workflow').first().json.body.integration.callbackToken }}
Content-Type: application/json

Send this message, for example, when a step starts:

{
"tenant": "{{ $('Start workflow').first().json.body.integration.tenant }}",
"runId": "{{ $('Start workflow').first().json.body.integration.runId }}",
"eventId": "document-creation-started",
"type": "progress",
"executionId": "{{ $execution.id }}",
"step": {
"id": "document_create",
"label": "Create Document"
},
"message": "The document is being created."
}
  • Use a unique eventId for each event within the same execution.
  • Use a clear Dutch step.label; this text is shown in the app.
  • If you have enabled Report End of Workflow, then always send at the end type: "completed", type: "failed", or type: "rejected".
  • Optionally add an output object with the result for completed.
  • For failed, include a comprehensible error message. The execution will stop in the app.

Optional: ask for approval in the app

Use an n8n Wait node with On Webhook Call when the workflow should proceed only after a choice. Before the Wait node, send a callback with type: "approval_required":

Configure the Wait node to Resume: On Webhook Call, HTTP Method: POST and Authentication: Header Auth. Select the same Header Auth credential as for Start workflow. After the Wait node add a Switch node and check {{ $json.body.decision }}.

{
"tenant": "{{ $('Start workflow').first().json.body.integration.tenant }}",
"runId": "{{ $('Start workflow').first().json.body.integration.runId }}",
"eventId": "document-check",
"type": "approval_required",
"executionId": "{{ $execution.id }}",
"step": {
"id": "document_check",
"label": "Check Document"
},
"approval": {
"question": "Should the workflow continue?",
"context": "First review the generated document.",
"resumeUrl": "{{ $execution.resumeUrl }}",
"choices": [
{ "value": "approve", "label": "Approve" },
{ "value": "reject", "label": "Reject" }
]
}
}

The user sees the choices in the execution window. After a choice, the Wait node will provide, among other things, decision. Then use, for example, a Switch node to determine the next steps.

A choice value may contain only letters, numbers, _ and -. The label may contain plain readable text.

Production callback URL settings

The production callback URL for AI-Corporate is:

https://europe-west1-ai-corporate.cloudfunctions.net/n8nWorkflowCallback

Do not paste this URL as fixed text in every callback node. In the HTTP Request node URL field, choose Expression and use:

{{ $('Start workflow').first().json.body.integration.callbackUrl }}

AI-Corporate thus automatically provides the correct production URL with every start. The fixed URL above is used during testing to verify that the expression points to AI-Corporate and not to AI-School or AI-Public.

The callables triggerCustomN8nWorkflow, triggerN8nWorkflow, and resumeN8nWorkflow are invoked by the app itself. You do not need to configure these URLs in n8n.

Handling errors

Return expected errors with a callback of type failed. For unexpected node errors, create a central Error Workflow:

  1. Create a new workflow with an Error Trigger node.

  2. Then add an HTTP Request node with Method: POST.

  3. In URL enter this fixed production URL:

    https://europe-west1-ai-corporate.cloudfunctions.net/n8nWorkflowExecutionFailed
  4. Choose Authentication: None and add the header n8n-handihow-name with the platform administrator’s secret default value.

  5. Choose a JSON body and paste:

{
"executionId": "{{ $json.execution.id }}",
"workflowId": "{{ $json.workflow.id }}",
"workflowName": "{{ $json.workflow.name }}",
"lastNode": "{{ $json.execution.lastNodeExecuted }}",
"message": "{{ $json.execution.error.message }}"
}
  1. Enable the Error Workflow.
  2. In the settings of the normal workflow, select this under Error Workflow.

Send at least one callback with executionId: "{{ $execution.id }}" directly after Start workflow. Only then can AI-Corporate link an unexpected error to the correct execution.

Important limitations

  • Only webhook triggers are supported.
  • Only production webhook URLs are supported.
  • Test webhook URLs with /webhook-test/ are rejected.
  • Only POST is supported.
  • Only generic header authentication is supported.
  • The header value is treated as secret in the application.
  • Callback tokens and resume URLs are processed server-side and are not directly available to users.
  • The tenant is determined server-side from the logged-in user, not from a value sent by the browser.

Troubleshooting

  • 404 or webhook not registered: activate the workflow in n8n and use the production URL.
  • Authentication error: verify that the header name and value are exactly the same in both systems.
  • Missing data: check that the field names in the application match the keys n8n expects.
  • No request in n8n: verify that the workflow starts with a webhook trigger and uses POST.
  • The execution window keeps spinning: if you have enabled Report End of Workflow, check whether n8n sends a final completed, failed, or rejected callback. If you do not expect feedback, disable all three options in the registration.
  • No progress visible: verify that Report Intermediate Progress is enabled in the registration, or that the integration object is preserved and that each callback has a unique eventId.
  • Approval buttons do not work: check the Wait node, resumeUrl, header authentication, and the allowed characters in choices[].value.
WhatsApp