Testing: replay signed webhooks
A script that signs Shopify-style webhooks the way Shopify does and posts them to your n8n production URLs, plus the matrix of what it produced against n8n 2.46.6.
What a replay proves, and what it does not
It proves the front of each workflow: signature, shop domain and topic are checked, a bad request is answered 401, a good one 200. By looking at HubSpot and at n8n’s execution list afterwards you can also see whether the right writes happened and whether a repeated delivery changed anything. It does not prove that your HubSpot or Shopify settings are right, and it never exercises Shopify itself.
How the signature is built
Shopify computes HMAC-SHA256 over the raw request body with the webhook secret and sends the base64 result in X-Shopify-Hmac-Sha256. With openssl:
SIG=$(openssl dgst -sha256 -hmac "$SECRET" -binary < tests/fixtures/customer.json | openssl base64 -A)
curl -sS -i -X POST "$N8N_BASE_URL/webhook/shopify-client" \
-H "Content-Type: application/json" \
-H "X-Shopify-Hmac-Sha256: $SIG" \
-H "X-Shopify-Topic: customers/create" \
-H "X-Shopify-Shop-Domain: your-shop.myshopify.com" \
--data-binary @tests/fixtures/customer.json
Use --data-binary: -d @file strips line breaks, the body then differs from what was signed, and you get a 401 you caused yourself. The secret appears in the process list while openssl runs, so use a test secret on your own machine.
The replay script
export N8N_BASE_URL="https://n8n.example.com"
export SHOPIFY_WEBHOOK_SECRET="the secret in the Crypto credential"
export SHOP_DOMAIN="your-shop.myshopify.com"
bash tests/replay.sh list # the cases and their expected status
bash tests/replay.sh 01-bad-signature # rejection cases run without confirmation
bash tests/replay.sh --yes all # everything, including cases that write to HubSpot
Needs bash, curl and openssl. Cases with a valid signature reach HubSpot and write dummy contacts and deals on example.com addresses, so they only run with --yes. Point the script at an instance connected to a HubSpot test account, or delete the records afterwards. The script checks HTTP status codes only; it prints a reminder to check HubSpot and the execution list.
| Case | Webhook path | Sent | Expected HTTP |
|---|---|---|---|
01-valid | shopify-client | customer fixture, customers/create, right secret and shop | 200 |
01-bad-signature | shopify-client | same, wrong secret | 401 |
01-wrong-shop | shopify-client | right secret, another shop domain | 401 |
01-wrong-topic | shopify-client | right secret, topic orders/paid | 401 |
02-valid | shopify-commande-payee | paid order fixture | 200 |
02-replay | shopify-commande-payee | the same order twice | 200, 200 |
02-test-order | shopify-commande-payee | order with "test": true | 200 (ignored by the workflow) |
02-guest | shopify-commande-payee | order with no customer object | 200 |
03-valid | shopify-segmentation | paid order fixture | 200, then the run fails with “customer not found” against a real shop, unless that customer ID exists there |
03-bad-signature | shopify-segmentation | wrong secret | 401 |
The fixtures contain only the fields the workflows read, not a full Shopify payload. Every address is on example.com.
Results observed
Run on 6 November 2026 with bash tests/replay.sh --yes all against n8n 2.46.6 (Node.js 24), following the order of the setup page: the four credentials needed by 00 to 04 created first (apart from the placeholders, the workflow files were not edited to point at them: n8n linked each node by name and type), then workflows 00 to 04 imported (01, 02, 03 and 04 published, Error workflow of 01, 02 and 03 set to 04), a local fake server standing in for HubSpot and Shopify, and a fake SMTP server. The server logs every request it receives.
| Case | HTTP | Requests seen by the fake HubSpot / Shopify server | n8n run status |
|---|---|---|---|
01-valid | 200 | 1 contact upsert (email lowercased, empty fields removed) | success |
01-bad-signature | 401 | none | success (401 branch) |
01-wrong-shop | 401 | none | success (401 branch) |
01-wrong-topic | 401 | none | success (401 branch) |
02-valid | 200 | contact upsert, deal upsert keyed shopify_order_id, association | success |
02-replay, two deliveries | 200, 200 | the same three requests each time, with the same shopify_order_id | success, success |
02-test-order | 200 | none | success |
02-guest | 200 | contact upsert (no properties), deal upsert, association | success |
03-valid | 200 | token request (form-encoded), GraphQL call carrying that token, contact upsert | success |
03-bad-signature | 401 | none | success (401 branch) |
Two things to note. A rejected request is a normal run: it raises no error and sends no alert, so rejections show up only in n8n’s execution count (and, for webhooks registered by an app, in that app’s webhook metrics), not in your inbox. And the replay case shows that the same unique key is sent twice; whether HubSpot then keeps a single deal is its upsert at work, which a fake server cannot demonstrate. Run 02-replay against a test account and count the deals.
In 2.46.6 a successful run is still recorded (status, start time) but without node data, which is what saveDataSuccessExecution: none is for.
Error paths, outside the script
These need a server that answers on purpose with a 207, a 400 or a GraphQL error, so the script does not include them. They were run on 6 November 2026 against the same kind of fake servers, with signed requests:
| Workflow | Situation | Observed |
|---|---|---|
| 01 | HubSpot answers 207 with errors | Run fails (Stop and Error), alert email sent |
| 02 | Contact upsert answers 207 with errors | Deal still created, association skipped, run fails with “deal created but not associated”, alert sent |
| 02 | Contact upsert answers 400 | One request only to that node (no retry), deal created, association skipped, alert sent |
| 03 | Two orders in a row | Two different tokens, one per run |
| 03 | GraphQL answers 200 with an errors array | Run fails, alert sent |
| 04 | Three provoked failures (01, 02, 03) | Three emails, without the “sent automatically with n8n” footer |
To provoke an error on your own instance: put a wrong key in the HubSpot credential, run bash tests/replay.sh --yes 01-valid, and check that the alert arrives. Then put the right key back (credentials are not part of the published version, so no new publish is needed). Use the customer webhook for this: a Shopify Send test for orders/paid may carry test: true, which workflow 02 ignores without an error.
Do not test rejections through Shopify
Sending wrong signatures from Shopify’s own webhook page, or leaving a mistyped secret in place, produces repeated 401s on a live subscription, and Shopify can delete a webhook created in the admin after repeated failures. Run the rejection cases from your own machine with the script. If you do use Shopify’s Send test, send one, then fix the cause immediately. Note that Send test delivers sample data that is really written to HubSpot.
Checking the repository itself
python3 scripts/check_repo.py # structure checks
python3 scripts/check_repo.py --release # also fails on unfinished placeholders
The check parses every workflow file, refuses any Code or Function node, looks for token-shaped strings, confirms the expected placeholders are still present, verifies that connections point at existing nodes, and checks each page of this site: one h1, a title and description of sensible length, a canonical URL that points at the page itself, valid JSON-LD, and local links that resolve. The same check runs on every push through GitHub Actions.
Not covered
- Any call to a real HubSpot or Shopify account. Request bodies follow the vendors’ documentation, without a real response to compare.
- HubSpot’s exact behaviour on “partial upserts” keyed on email. HubSpot’s contacts guide says they are not supported with
emailas theidPropertyand does not define the term. In a test account, create a contact with all fields, replay a workflow that sends fewer fields for the same email, and check that no property is erased. closedwonon a real account (confirmed only by a community thread).- Bursts: a new customer can trigger
customers/createand one or twoorders/paidwithin the same second, so up to three upserts of one email in parallel. - Shopify Plus, multi-currency stores, refunds, cancellations, partial payments.