n8n workflows
AI-Public can start n8n workflows via a production webhook. This is handy when you want to start an automated process outside AI-Public, 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 organization's website
Suppose the organization has created an n8n workflow that publishes a news article on the WordPress website. In AI-Public you only fill in a short piece of text, for example a few sentences about a meeting, project, or public announcement. With that text you start the workflow in n8n.
The n8n workflow can then, for example:
- Create a neat draft from the short text with an LLM node and a prompt that fits the organization's tone.
- Create a suitable illustration with a second LLM node, for example in brand colors and in a recognizable illustrative style.
- Prepare or publish the text and image as a blog post on the WordPress website.
This is how AI-Public and n8n work together: in AI-Public the user selects the workflow and fills in the required information. n8n then performs the automated steps and ensures the news article is neatly published 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 invoked 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 filled values are sent as JSON in a POST request to the n8n webhook.
- Without feedback, AI-Public only confirms that the workflow has started and continues in n8n. The window shows no spinner and can be closed immediately.
- If enabled at registration, the workflow can send intermediate steps or the end back to AI-Public.
- If approval at registration is enabled, the user can make a choice directly in AI-Public. n8n then continues from the waiting step.
Create an n8n workflow in AI-Public
An administrator registers the workflow as follows:
- Go to Assistants.
- Open Workflows.
- Choose New n8n workflow.
- Enter the workflow name and the n8n production URL.
- Configure Header authentication with a header name and secret header value.
- Under Feedback from n8n, tick only the parts that were actually built in this n8n workflow: progress, approval, and/or the end of the workflow.
- Optionally add the fields that should be sent in the POST request.
- Save the workflow.
All three feedback options are disabled by default. If you later add callbacks or an approval step in n8n, also update the registration in AI-Public. The dialog 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 or values 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 compatible workflow in n8n
- In n8n, create a new workflow.
- Add a Webhook node as the first node.
- Name this node exactly Start workflow. The example expressions below use this name.
- Set HTTP Method to POST.
- Choose Authentication: Header Auth and use the same header name and secret value as in AI-Public.
- Set Respond or Response Mode to Immediately.
- Copy the Production URL to the field n8n production-url in AI-Public. Do not use the test URL with
/webhook-test/. - Activate the workflow.
The received data is under body; the technical integration data is under body.integration. Do not remove those 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-Public automatically adds the integration object.
{
"prompt": "Create a short summary of the request.",
"customerName": "Example Organization",
"audiences": ["residents", "employees"],
"date": "2026-09-22",
"integration": {
"runId": "chat-document-id",
"tenant": "default",
"callbackUrl": "https://europe-west1-ai-public-pro.cloudfunctions.net/n8nWorkflowCallback",
"callbackToken": "temporary-token-for-this-run"
}
}
The callback token is valid for a single execution. Do not store it in logs, fixed configuration, or other systems.
Optional: send progress and completion back
AI-Public can only display what n8n reports back. Use these callbacks only if you have enabled in registration the options for Report intermediate progress and/or Report the end of the workflow.
Configure each callback node as follows:
-
Choose Method: POST.
-
Click on URL and select Expression and paste:
{{ $('Start workflow').first().json.body.integration.callbackUrl }} -
Choose Authentication: None.
-
Enable Send Headers and add the headers below.
-
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, for example, this message 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_creation",
"label": "Create Document"
},
"message": "The document is being created."
}
- Use a unique
eventIdfor every event within the same execution. - Use a clear Dutch
step.label; this text is shown in the app. - If you have enabled Report the end of the workflow, always send at the end
type: "completed",type: "failed", ortype: "rejected". - Optionally add an
outputobject with the result forcompleted. - For
failed, include a comprehensible error message. The execution will stop in the app as well.
Optional: request approval in the app
Use an n8n Wait node with On Webhook Call when the workflow should proceed only after a choice. Send a callback before the Wait node 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": "May 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 receive, among other things, decision. Then use, for example, a Switch node to determine the appropriate continuation.
A choice value may only contain letters, numbers, _, and -. The label may contain normal readable text.
Production callback URL setting
The production callback URL for AI-Public is:
https://europe-west1-ai-public-pro.cloudfunctions.net/n8nWorkflowCallback
Do not paste this URL as plain text in every callback node. In the HTTP Request node’s URL field, choose Expression and use:
{{ $('Start workflow').first().json.body.integration.callbackUrl }}
AI-Public will thus automatically provide the correct production URL at every start. The fixed URL above is for testing to verify the expression points to AI-Public and not to AI-School or AI-Corporate.
The callable endpoints 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, also create a central Error Workflow:
-
Create a new workflow with an Error Trigger node.
-
Add a HTTP Request node with Method: POST.
-
In URL, enter this fixed production URL:
https://europe-west1-ai-public-pro.cloudfunctions.net/n8nWorkflowExecutionFailed -
Choose Authentication: None and add the header
n8n-handihow-namewith the platform administrator’s secret default value. -
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 }}"
}
- Enable the Error Workflow.
- Open the settings of the regular workflow and select this as Error Workflow.
Right after Start workflow, send at least one callback with executionId: "{{ $execution.id }}". Only then can AI-Public associate an unexpected error with 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 header name and value are exactly the same in both systems.
- Missing data: check that the field names in the app match the keys n8n expects.
- No request in n8n: verify the workflow starts with a webhook trigger and uses POST.
- The execution window keeps spinning: if you enabled Report the end of the workflow, check whether n8n sends a final
completed,failed, orrejectedcallback. If you do not expect feedback, disable all three options at registration. - No progress visible: check whether Report intermediate progress is enabled at registration, whether the
integrationobject is preserved, and whether every callback has a uniqueeventId. - Approval buttons do not work: verify the Wait node,
resumeUrl, header authentication, and the allowed characters inchoices[].value.