Create Bosta shipments from paid Shopify orders
Every paid order becomes a Bosta delivery automatically — no more typing addresses.
How it works
- Receive the paid order from Shopify.
- Build the Bosta delivery: receiver, phone, address, items and cash-on-delivery amount.
- Create the delivery through Bosta's API.
- Log the tracking number in your Shipments sheet.
Diagram
Code
JavaScript used in the Code step — already included in the template below.
// Mode: Run Once for Each Item
// Turns a paid Shopify order into a Bosta "create delivery" request body.
// Check the field names against Bosta's API docs for your account before going live.
const o = $json;
const a = o.shipping_address || {};
const isCod = (o.payment_gateway_names || []).some((g) => /cash|cod/i.test(g));
return {
json: {
order: o.name,
body: {
type: 10, // standard delivery
businessReference: o.name,
cod: isCod ? Number(o.total_price) : 0,
notes: o.note || "",
specs: {
packageDetails: {
itemsCount: o.line_items.reduce((n, i) => n + i.quantity, 0),
description: o.line_items.map((i) => `${i.quantity}x ${i.title}`).join(", "),
},
},
receiver: {
firstName: a.first_name || "",
lastName: a.last_name || "",
phone: String(a.phone || o.phone || "").replace(/[^0-9+]/g, ""),
},
dropOffAddress: {
city: a.city || "",
firstLine: [a.address1, a.address2].filter(Boolean).join(", "),
},
},
},
};Build it
Pick your tool — same automation, step by step.
Copy and paste straight into an n8n canvas (Ctrl+V), or download and use Import from File. Then connect your own credentials and replace every YOUR_… placeholder.
Show code (151 lines)
{
"name": "Create Bosta shipments from paid Shopify orders (Flowngn)",
"nodes": [
{
"parameters": {
"content": "## Create Bosta shipments from paid Shopify orders\nEvery paid order becomes a Bosta delivery automatically — no more typing addresses.\n\n**Setup**\n1. Open each node and connect your own credentials.\n2. Replace every YOUR_… placeholder.\n3. Test once, then activate.\n\nFree template from Flowngn",
"height": 260,
"width": 340
},
"id": "458210f1-f980-4989-a1ec-07858e8eaece",
"name": "Setup notes",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-420,
-60
]
},
{
"parameters": {
"topic": "orders/paid"
},
"id": "458210f1-f980-4989-a1ec-07858e8eaece",
"name": "Order paid",
"type": "n8n-nodes-base.shopifyTrigger",
"typeVersion": 1,
"position": [
0,
0
],
"webhookId": "458210f1-f980-4989-a1ec-07858e8eaece"
},
{
"parameters": {
"jsCode": "// Mode: Run Once for Each Item\n// Turns a paid Shopify order into a Bosta \"create delivery\" request body.\n// Check the field names against Bosta's API docs for your account before going live.\nconst o = $json;\nconst a = o.shipping_address || {};\nconst isCod = (o.payment_gateway_names || []).some((g) => /cash|cod/i.test(g));\n\nreturn {\n json: {\n order: o.name,\n body: {\n type: 10, // standard delivery\n businessReference: o.name,\n cod: isCod ? Number(o.total_price) : 0,\n notes: o.note || \"\",\n specs: {\n packageDetails: {\n itemsCount: o.line_items.reduce((n, i) => n + i.quantity, 0),\n description: o.line_items.map((i) => `${i.quantity}x ${i.title}`).join(\", \"),\n },\n },\n receiver: {\n firstName: a.first_name || \"\",\n lastName: a.last_name || \"\",\n phone: String(a.phone || o.phone || \"\").replace(/[^0-9+]/g, \"\"),\n },\n dropOffAddress: {\n city: a.city || \"\",\n firstLine: [a.address1, a.address2].filter(Boolean).join(\", \"),\n },\n },\n },\n};",
"mode": "runOnceForEachItem"
},
"id": "458210f1-f980-4989-a1ec-07858e8eaece",
"name": "Build Bosta delivery",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
300,
0
]
},
{
"parameters": {
"method": "POST",
"url": "https://app.bosta.co/api/v2/deliveries",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "YOUR_BOSTA_API_KEY"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify($json.body) }}",
"options": {}
},
"id": "458210f1-f980-4989-a1ec-07858e8eaece",
"name": "Create Bosta delivery",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
600,
0
]
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "YOUR_SPREADSHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "Shipments",
"mode": "name"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"date": "={{ $now.toISO() }}",
"order_id": "={{ $('Build Bosta delivery').item.json.order }}",
"tracking": "={{ $json.data?.trackingNumber ?? $json.trackingNumber }}",
"cod": "={{ $('Build Bosta delivery').item.json.body.cod }}"
}
},
"options": {}
},
"id": "458210f1-f980-4989-a1ec-07858e8eaece",
"name": "Log shipment",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [
900,
0
]
}
],
"connections": {
"Order paid": {
"main": [
[
{
"node": "Build Bosta delivery",
"type": "main",
"index": 0
}
]
]
},
"Build Bosta delivery": {
"main": [
[
{
"node": "Create Bosta delivery",
"type": "main",
"index": 0
}
]
]
},
"Create Bosta delivery": {
"main": [
[
{
"node": "Log shipment",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"meta": {
"templateCredsSetupCompleted": false
},
"tags": []
}In Make, create a new scenario and add these modules in order:
- Shopify › Watch Events
- Tools › Set variable / Iterator + Array aggregator (same logic as the Code step)
- HTTP › Make a request
- Google Sheets › Add a Row
- Every module run uses Make operations — the free plan includes a monthly quota.
- Make's built-in functions (map, sum, formatDate…) can replace most Code steps; for complex logic use a code module.
- Module and step names can differ slightly as Make and Zapier update their apps.
In Zapier, create a new Zap and add these steps in order:
- Shopify — New Event
- Code by Zapier — Run JavaScript (paste the code from the Code section)
- Webhooks by Zapier — GET
- Google Sheets — Create Spreadsheet Row
- Zaps with more than two steps need a paid Zapier plan.
- Webhooks, Filters/Paths and Code by Zapier are premium features on some Zapier plans.
- Code by Zapier runs JavaScript: reuse the code shown above, reading inputs from inputData instead of $json.
- Module and step names can differ slightly as Make and Zapier update their apps.
Tips
- Get your API key in the Bosta dashboard, and check the request fields against Bosta's API docs before going live.
- Test with one order first — city names must match Bosta's list.
Related flows
Bosta delivery updates to customers on WhatsApp
Customers get a WhatsApp message when their Bosta shipment is picked up, out for delivery or delivered.
Mark Bosta deliveries as delivered in your sheet
When Bosta delivers an order, its row in your sheet is updated with the status and COD amount.
Ask for a review 2 days after delivery
When Bosta delivers an order, wait two days, then ask the customer for a review on WhatsApp.