Stubmation
Custom Stubmations
Explains how to run flows on your own n8n server from your templates. Covers adding the stubmation in the Stubber Console, building the n8n flow from the Stubber reference flow, and calling it with the stubmation task.
A custom stubmation is a flow on your own n8n server that your org's templates run with the stubmation task, the same way they run Stubber's built-in stubmations. Only your org's templates can run it, and each run is charged like any other stubmation.
Setting one up takes three steps:
- Build the flow in n8n, starting from the Stubber reference flow.
- Add the stubmation in the Stubber Console, pointing at the flow's webhook.
- Run it from a template by its name.
Before you start
- Your n8n server must be reachable on a public
httpsaddress. Stubber does not callhttpaddresses, private or internal addresses, or addresses that redirect elsewhere. - You need the Edit Org permission in the org to add, change or delete stubmations, and the View Credentials permission to choose an existing credential.
- Your org needs a domain. Stubmation names start with it.
1. Build the flow in n8n
Start from the Stubber reference flow. It already receives Stubber's request, switches on an action name and returns the result in the shape Stubber expects.
Download the Stubber reference flow (n8n workflow JSON)
- In n8n, create a new workflow and import the downloaded file (⋯ → Import from File).
- Open the Stubmation Start webhook node:
- Change the Path to something unique on your server, for example
invoice_sync. This is the webhook path you enter in the Stubber Console. - Authentication is set to Basic Auth. Create or choose an n8n Basic Auth credential with a user and password of your choosing. You use the same user and password for the stubmation in the Stubber Console, so only Stubber can call the webhook.
- Change the Path to something unique on your server, for example
- Build your logic between Switch action and the format nodes. Add an output to Switch action for each action the flow handles, and connect each one to your nodes.
- End every successful path in Format Standard Stubmation Return (or ARRAY always - Format Standard Stubmation Return if the result must always be a list), and every failure in Format Standard Stubmation Error. Both lead to Respond Stubmation, which sends the response back to Stubber.
- Activate the workflow. Stubber calls the production webhook URL (
/webhook/...), which only works while the workflow is active. The test URL (/webhook-test/...) is not used.
The reference flow
What Stubber sends
Stubber sends a POST with a JSON body and the Basic Auth header:
flow_data is exactly what the task passes in its flow_data parameter. The reference flow expects an action and its action_params, but you can send any JSON object the flow needs.
What the flow returns
The flow must respond with JSON. The reference flow returns:
_stubmation.execution_idand_stubmation.workflowidentify the n8n execution. From them Stubber sets_stubmation.url, a link to that execution on your n8n server, so whoever looks at the stub can open the run straight away. The flow doesn't need to send the url; one it does send is replaced.resultis your flow's output.error, instead ofresult, fails the task in Stubber. Return it for anything the template should treat as a failure.
2. Add the stubmation in the Stubber Console
- Open the Stubmations page of the Stubber Console (Platform → Stubmations).
- Click Add stubmation.
- Fill in the form:
- Click Add stubmation.
The new stubmation is listed with its full name. The copy button next to the name copies a task snippet that runs it.
Changing or deleting a stubmation
Use the ⋯ menu next to a stubmation to Edit or Delete it.
- Renaming a stubmation changes the name templates run. Templates that use the old name fail until you update them.
- Deleting a stubmation makes the templates that run it fail. Your n8n workflow is not changed.
3. Run it from a template
Run the stubmation with the stubmation task, using the full name from the Stubber Console:
The task waits up to 60 seconds for the response. Set the task's timeout for flows that take longer.
Using the result
The flow's response is returned in the task's payload as stubmation_result, so later tasks in the same action can use it:
It is also saved on the stub under _<name>_response, e.g. ~~stub.data._acme_invoice_sync_response.result, for later actions.
The link to the n8n execution is at stubmation_result._stubmation.url.
When the task fails
The task fails when:
- The flow responds with an
errorkey. The run is charged, since the flow ran. - The webhook responds with an error status. The
messagein the response body, if there is one, becomes the error message. The run is not charged. - The flow takes longer than the timeout to respond. The run is not charged.
- The stubmation's address is not allowed (not public
https), or it redirects. The run is not charged. - The stubmation's Basic credential is missing or can't be read. Stubber doesn't call your server and the run is not charged.
Notes
- The org's credential is read when the task runs, so changing the credential's user and password in the Stubber Console takes effect straight away. Change the webhook's Basic Auth in n8n at the same time.
- Only your org's templates can run your custom stubmations.
- Keep each flow's webhook path unique on your n8n server. Two workflows can't share a path.