Snapshots, credentials and verify

These commands talk to your n8n instance. Save it once:

integration-mock instances add sandbox https://your-n8n.example <API_KEY> --default

The URL and API key are stored in plain text in ~/.integration-mock/config.json.

Snapshot and retry

Run a workflow once for real, then keep working on it against that run.

integration-mock start
integration-mock ca install          # set the printed variables where n8n runs, then restart n8n

# run the workflow once for real in n8n, then:
integration-mock snapshot latest --workflow <id>

# edit the workflow in n8n and click Execute: it now runs against the snapshot
integration-mock log --follow
integration-mock diff

What snapshot does

How each node is handled

NodeResult
HTTP Request with a literal URLRoutes from its URL, method, query and output
HTTP Request with an expression URLA warning. Nothing is mocked
Slack, Google Sheets, Airtable, HubSpot, OpenAIThe service's response is rebuilt from the node's output
Other nodes that call a serviceA warning. The shipped pack answers, if there is one
Nodes that call nothingThey run again as normal

What diff shows

diff compares the active snapshot with a later execution and the calls the mock saw.

FindingMeaning
Changed nodesParameters that differ. Canvas position is ignored
Changed outputItem counts and changed paths per node
missingA call in the snapshot that was not made this time
addedA new call
changedThe same call with a different request
unmatchedA call no route answered

Placeholder credentials

n8n refuses to run a workflow whose credential does not exist, before it makes any call. creds push creates a credential with placeholder values, shaped by n8n's own schema for that type.

integration-mock creds push httpHeaderAuth --name "Acme (mock)"
integration-mock creds push httpHeaderAuth --dry-run          # show the payload first
integration-mock creds push httpHeaderAuth --field name=X-Api-Key --field value=placeholder

--field key=value sets any field. Use it to point a credential's base URL at the mock.

Pointing a workflow file at the mock

integration-mock creds swap workflow.json                 # preview
integration-mock creds swap workflow.json --in-place      # apply
integration-mock creds swap workflow.json --real --in-place   # back to the real URLs

Verify a pack against the real service

Once you have access to the real service, check the mock against it.

integration-mock verify salesforce \
  --base-url https://acme.my.salesforce.com \
  --header "Authorization: Bearer $TOKEN"

It compares the shape of each response, never the values.

FindingMeaning
inventedA field the pack has and the real service does not
missingA field the real service has and the pack does not
typeThe same field with a different type
statusA different HTTP status
unreachableThe call failed
FlagEffect
--param name=valueFill a :name segment in a path
--patchRewrite the pack's response bodies from what the service returned, for review as a git diff
--unsafeAlso run methods that change data

Caution

Without --unsafe, only GET, HEAD and OPTIONS run. With it, a Slack pack would post real messages.