How to Automate Magento Shipping with Royal Mail Using n8n
ยท @SHOAIB MAJEED
It is 4:45 on a Friday afternoon and your Magento store has just taken its fortieth order of the day. Someone on your team is still copying postcodes into Royal Mail Click & Drop, one parcel at a time, and the customer who ordered at 9 a.m. has not had a tracking number yet.
That scene plays out in a lot of UK online shops, and it does not have to. A small n8n workflow can pick up each paid order, create the Royal Mail shipment, and put the tracking number back into Magento and into the customer’s inbox without anyone touching a keyboard.
This guide walks you through building that workflow from scratch with n8n, the open-source automation tool. You will connect the Magento REST API to the Royal Mail Click & Drop API, add error alerts, and finish with a setup you own instead of a plugin you rent. It is written by the team at AutomateRoyal, who build n8n and AI automations for e-commerce stores, and it assumes you are comfortable with API keys and basic JSON.
What you need before you start
You need four things in place before you open n8n:
- A Magento 2 store with REST API access. In the admin, create an integration under System > Extensions > Integrations and copy the access token. Give it access to Sales (orders and shipments).
- A Royal Mail Click & Drop account with the API enabled. In Click & Drop go to Settings > Integrations, choose Click & Drop API, and copy the auth key. Only one API integration is allowed per account, and recreating it issues a new key. (Royal Mail: Integrating with the Click & Drop API)
- An n8n instance, either n8n Cloud or self-hosted on a VPS.
- An email or WhatsApp channel for tracking messages, such as SMTP, Gmail or the WhatsApp Business API.
Store both keys in n8n Credentials, never inside a node’s text field or a workflow you export.
Two account details change how your build looks. Fetching labels through the API (GET /orders/{id}/label) is limited to OBA customers, so if you are not on OBA you create the order through the API and print the label from Click & Drop. And Royal Mail’s API limits calls per second, so add a short wait when you process many orders at once. (Click & Drop API specification)
The workflow at a glance
The workflow polls Magento for paid orders, builds a Royal Mail order, collects the tracking number, and writes it back to Magento. Any order Royal Mail rejects goes to an alert instead of stopping the run.
Build the workflow in n8n, step by step
Build and test each step on one order before you connect the next. Use a test order with a real UK address and keep the workflow inactive until the end.
Step 1: Find new orders to ship
Magento Open Source has no built-in outgoing webhooks, so the simplest trigger is a Schedule Trigger that runs every 5 to 10 minutes. (Adobe Commerce and some extensions can push webhooks, in which case use n8n’s Webhook node instead.)
Add an HTTP Request node that calls your store’s order list, filtered to orders that are paid and waiting to ship:
GET https://your-store.com/rest/V1/orders
?searchCriteria[filter_groups][0][filters][0][field]=status
&searchCriteria[filter_groups][0][filters][0][value]=processing
&searchCriteria[filter_groups][0][filters][0][condition_type]=eq
Authorization: Bearer <magento-integration-token>
Add an IF node after it that lets through only orders using your Royal Mail shipping method, so collection or courier orders are left alone. Once the workflow creates a shipment in Step 5, Magento moves the order out of processing, so the same order is not picked up twice.
Step 2: Map the Magento order to a Royal Mail order
Use a Code or Edit Fields node to reshape each order. The delivery address sits under extension_attributes.shipping_assignments[0].shipping.address in the Magento response. Build a payload like this:
{
"items": [{
"orderReference": "000000123",
"orderDate": "2026-10-18T10:15:00Z",
"recipient": {
"address": {
"fullName": "Jane Smith",
"addressLine1": "12 High Street",
"city": "Leeds",
"postcode": "LS1 4AB",
"countryCode": "GB"
},
"phoneNumber": "07700900123",
"emailAddress": "jane@example.com"
},
"packages": [{ "weightInGrams": 450, "packageFormatIdentifier": "parcel" }],
"subtotal": 39.99,
"shippingCostCharged": 3.99,
"total": 43.98
}]
}
The Royal Mail API requires the recipient, order date, subtotal, shipping cost and total. Package weight is optional in the schema but you will want it for correct postage. Magento stores product weight in your configured unit (often kilograms), so convert to grams and multiply by quantity. Check the allowed packageFormatIdentifier values and service codes against your account with GET /services. (API specification)
Step 3: Create the order in Royal Mail Click & Drop
Add an HTTP Request node:
POST https://api.parcel.royalmail.com/api/v1/orders
Authorization: Bearer <click-and-drop-auth-key>
Content-Type: application/json
Send the payload from Step 2 as the JSON body. The response gives you an orderIdentifier for every order that was created and lists any that failed with their errors. Save the orderIdentifier, because you need it for the next step and for support questions later.
Step 4: Get the tracking number
This step depends on your Royal Mail account type:
- OBA account: call
GET /orders/{orderIdentifier}/label?documentType=postageLabelto download the label, and readtrackingNumberfrom the order. You can save the label PDF to Google Drive or email it to your packing team. - Account without OBA: the label API is not available, so someone prints the label in Click & Drop. Add a Wait node and a second schedule that calls
GET /orders/{orderIdentifier}untiltrackingNumberis filled in.
Test this with a real order to see exactly when the tracking number appears for your account. Do not assume it arrives in the create response.
Step 5: Send the tracking number back to Magento
Create the shipment in Magento with the tracking number attached, using another HTTP Request node:
POST https://your-store.com/rest/V1/order/{orderId}/ship
Authorization: Bearer <magento-integration-token>
{
"items": [{ "order_item_id": 456, "qty": 1 }],
"notify": true,
"tracks": [{
"track_number": "AB123456789GB",
"title": "Royal Mail",
"carrier_code": "custom"
}]
}
Set items from the order’s line items so every product is included. With notify set to true, Magento sends its standard shipment email to the customer with the tracking number, so you may already have your customer notification.
Step 6: Tell the customer (optional extras)
Magento’s shipment email covers the basics. Add an n8n notification only if you want something more:
- A WhatsApp message with the tracking link, using the WhatsApp Business API node. Many UK shoppers read WhatsApp faster than email.
- A branded email through Gmail or SMTP if you do not use Magento’s templates.
- A tracking link in the message:
https://www.royalmail.com/track-your-itemplus the tracking number.
If you turn on notify in Step 5 and also send your own email, customers get two messages. Pick one.
Handle errors before they reach customers
A workflow that works on a clean test order will still fail on real ones. Plan for these cases:
| Problem | What to do |
|---|---|
| Invalid or incomplete address | Check the Royal Mail response for failed orders, then send the order number and error to Slack or email so a person can fix it. |
| Royal Mail rate limit (HTTP 429) | Add a short Wait between calls and process orders in small batches. Royal Mail documents a limit of a few calls per second. |
| Duplicate shipments | Only fetch orders in processing, and save the orderIdentifier so a retry never creates a second Royal Mail order. |
| Partial shipments or multiple parcels | Send one package per parcel in packages, and only ship items that are in stock. |
| International orders | Add customs data (CN22 or CN23) for non-UK addresses, or filter them out and handle them manually. |
| API key changed | Recreating the Click & Drop integration issues a new key, so update the credential in n8n. |
Create a separate Error Workflow in n8n with an Error Trigger node. It should message you whenever any node fails, so a stuck order never sits unnoticed for a day.
How much time this saves
The saving is easy to work out for your own store. Take the minutes one order costs you by hand (copying the address, creating the label, pasting the tracking number, emailing the customer) and multiply.
As an example, if each order takes 3 minutes and you ship 40 orders a day, that is 2 hours a day, or about 40 hours over 20 working days. Your numbers will differ, but the pattern holds: the more orders you ship, the more the workflow pays back.
The other gain is accuracy. The address goes from Magento to Royal Mail without anyone retyping it, and customers get their tracking number straight away instead of whenever someone gets to it. Running costs are small: n8n can be self-hosted on a basic VPS, and the Magento and Royal Mail APIs are included with your accounts.
If you are still choosing a tool, our n8n vs Zapier comparison explains why we build on n8n. For more ideas that save a shop hours every week, read e-commerce automation workflows that save hours every week.
FAQ
Does Magento have a native Royal Mail integration?
Not out of the box. Some paid extensions exist, but an n8n workflow gives you control over the logic (which orders, which service, what happens on errors) and is not tied to one plugin.
Can I use this with Magento Open Source and Adobe Commerce?
Yes. Both expose the REST API used here. Adobe Commerce can also trigger the workflow by webhook, so you can skip polling.
Do I need an OBA account?
No, but with OBA you can fetch labels through the API. Without it you create the order through the API and print the label in Click & Drop.
Can n8n handle Royal Mail Tracked 24, Tracked 48 or Special Delivery?
Yes. Set the service code in postageDetails when you create the order, and map it from the shipping method on the Magento order. Get the valid codes for your account from GET /services.
Is it safe to store API keys in n8n?
Yes, if you use n8n Credentials, restrict access to your n8n instance, and give the Magento integration only the permissions it needs.
How long does setup take?
A basic version can be built in a day. Allow more time for testing with real orders, edge cases and error alerts.
Want this built for your store?
Whether you ship five orders a day or five hundred, the idea is the same: every minute your team spends retyping data is a minute not spent growing the shop. AutomateRoyal designs and runs n8n workflows for e-commerce stores, from Magento and Shopify shipping to order alerts, customer messages and AI assistants. Tell us how you ship today and we will tell you, honestly, what is worth automating.
Website: automateroyal.com
Email: automateroyal@gmail.com
For your CMS (SEO)
- Suggested URL: /automate-magento-shipping-royal-mail-n8n/
- Meta title: Automate Magento Shipping with Royal Mail and n8n
- Meta description: Step-by-step guide to automate Magento shipping with Royal Mail Click & Drop and n8n: create orders, get tracking, and update Magento automatically.
- Links already in the article: AutomateRoyal homepage (twice), n8n vs Zapier post, e-commerce workflows post, and the contact email.