Create Bosta shipments from paid Shopify orders

Every paid order becomes a Bosta delivery automatically — no more typing addresses.

Advanced Saves ~10 hours/month MENA & local appsBy Flowngn team

Works with n8n · Make · Zapier

How it works

Trigger: Shopify — order paid
  1. Receive the paid order from Shopify.
  2. Build the Bosta delivery: receiver, phone, address, items and cash-on-delivery amount.
  3. Create the delivery through Bosta's API.
  4. Log the tracking number in your Shipments sheet.

Diagram

SOrder paidShopify Trigger{ }Build Bosta deliveryCodeCreate Bosta delive…HTTP RequestGLog shipmentGoogle Sheets
Trigger App Code

Code

JavaScript used in the Code step — already included in the template below.

Build Bosta delivery · Code node
// 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.

Workflow JSON
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": []
}

Open in the playground to edit →

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