1. Stubmation
  2. Custom Stubmations

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:

  1. Build the flow in n8n, starting from the Stubber reference flow.
  2. Add the stubmation in the Stubber Console, pointing at the flow's webhook.
  3. Run it from a template by its name.

Before you start

  • Your n8n server must be reachable on a public https address. Stubber does not call http addresses, 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)

  1. In n8n, create a new workflow and import the downloaded file (⋯ → Import from File).
  2. 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.
  3. 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.
  4. 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.
  5. 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

Node What it does
Stubmation Start The webhook Stubber calls. Responds through the Respond Stubmation node.
Input Gives the rest of the flow one place to read the request from, e.g. {{ $('Input').first().json.body.flow_data.action_params.my_param }}.
Switch action Routes on flow_data.action, so one flow can serve several related actions. An unknown action goes to the error output.
Format Standard Stubmation Return Wraps the result as { _stubmation, result }. One item is returned as an object, several as a list.
ARRAY always - Format Standard Stubmation Return The same, but result is always a list.
Format Standard Stubmation Error Wraps a failure as { _stubmation, error }. A returned error fails the task in Stubber.
Respond Stubmation Sends the formatted response back to Stubber.
Example HTTP Request with Token A disabled example of an API call that sends its errors to the error output.
Manual Stubmation Test, Example 1, Example 2 Run the flow by hand with pinned example input, without Stubber calling it.

What Stubber sends

Stubber sends a POST with a JSON body and the Basic Auth header:

        {
  "templateuuid": "85488fa3-8e3f-5678-90fd-df666b42f7b6",
  "orguuid": "96305d53-2fb0-512d-9d59-3f2b03aa679a",
  "branch": "live",
  "context": "default",
  "stubref": "2026-03-17-STUB-EDXT",
  "action_name": "sync_invoice",
  "stubpostuuid": "697f8499-f883-44f0-a12f-e4beca4ae01a",
  "flow_data": {
    "action": "create_invoice",
    "action_params": {
      "amount": 1500
    }
  }
}

      

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_id": "1234",
    "workflow": "VnDflNov1HpYXmKz",
    "url": "https://n8n.example.com/workflow/VnDflNov1HpYXmKz/executions/1234"
  },
  "result": {
    "invoice_number": "INV-0042"
  }
}

      
  • _stubmation.execution_id and _stubmation.workflow identify 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.
  • result is your flow's output.
  • error, instead of result, fails the task in Stubber. Return it for anything the template should treat as a failure.

2. Add the stubmation in the Stubber Console

  1. Open the Stubmations page of the Stubber Console (Platform → Stubmations).
  2. Click
    Add stubmation
    .
  3. Fill in the form:
Field Description
Name Lowercase letters, digits, hyphens and underscores. Your org's domain is put in front of it: invoice_sync in the org acme becomes acme_invoice_sync. That full name is what templates run.
n8n server The public https address of your n8n server, e.g. https://n8n.example.com, with its path if n8n is served under one. No query string, and no user and password in the address.
Webhook path The Path of the Stubmation Start webhook node, e.g. invoice_sync. The form shows the full URL Stubber posts to: https://n8n.example.com/webhook/invoice_sync.
Workflow ID Optional. The n8n workflow's ID, for your reference.
Basic auth A Basic Authentication credential with the same user and password as the webhook's Basic Auth. Choose an existing one, or click New Basic credential to create it from the form. It is saved under Credentials, where you can change it later.
  1. 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:

loading...

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:

        ~~stubpost.tasks.create_invoice.payload.stubmation_result.result.invoice_number

      

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 error key. The run is charged, since the flow ran.
  • The webhook responds with an error status. The message in 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.