n8n Masterclass IModule 4

4.2E-commerce Order Processing — Daraz/Shopify to WhatsApp

25 min 8 code blocks Practice Lab Quiz (4Q)

E-commerce Order Processing — Daraz/Shopify to WhatsApp

Pakistan's e-commerce market crossed $7 billion in 2025, and both Daraz sellers and Shopify store owners face the same operational bottleneck: order notifications are slow, customer communication is manual, and inventory updates happen too late. A Karachi-based fashion seller on Daraz was spending 3 hours every day copy-pasting order details into WhatsApp messages for her supplier and customers. With n8n, that entire process runs in under 30 seconds per order, automatically. This lesson builds the complete order processing pipeline that Pakistani e-commerce sellers need.

Section 1: Understanding the Integration Points

code
ORDER PROCESSING PIPELINE ARCHITECTURE
═══════════════════════════════════════════════════════════════

  ORDER SOURCE (Choose one):
  ├── Shopify Webhook → n8n Shopify Trigger (native node)
  ├── Daraz Seller API → n8n HTTP Request (polling every 30 min)
  ├── Daraz Email → n8n Gmail Trigger (parse order emails)
  └── WooCommerce → n8n WooCommerce Trigger (native node)
         │
         ▼
  DATA EXTRACTION (Set Node):
  ├── Order ID
  ├── Customer name + phone number
  ├── Product name + quantity + SKU
  ├── Total amount (PKR)
  ├── Shipping city + address
  └── Payment method (COD / JazzCash / Card)
         │
         ▼
  ROUTING (IF Nodes):
  ├── IF amount > PKR 5,000 → VIP notification to owner
  ├── IF payment = COD → Add to COD tracking sheet
  ├── IF city = Karachi → Same-day dispatch flag
  └── IF inventory < 5 → Low stock alert
         │
         ▼
  NOTIFICATIONS:
  ├── Customer → WhatsApp confirmation via WATI
  ├── Supplier → WhatsApp pick-list via WATI
  ├── Owner → Daily summary at 6 PM PKT
  └── Warehouse → Real-time Slack/WhatsApp alert
         │
         ▼
  LOGGING:
  ├── Google Sheets → Order database
  ├── Inventory sheet → Auto-decrement stock
  └── Monthly analytics → Revenue, city breakdown, AOV

═══════════════════════════════════════════════════════════════

Platform Integration Methods

PlatformIntegration MethodReliabilitySetup Time
ShopifyNative n8n Trigger node (webhook)Excellent15 min
DarazSeller API (HTTP Request) or Email parserGood30-45 min
WooCommerceNative n8n Trigger node (webhook)Excellent15 min
Custom storeWebhook (POST to n8n URL)Depends on store20 min

WhatsApp Integration Options for Pakistan

ProviderMonthly CostMessages/MonthSetup ComplexityBest For
WATIPKR 8,000-15,0001,000 free + PKR 0.50/msgMediumMost Pakistani sellers
Twilio WhatsAppPay per message ($0.005/msg)UnlimitedMediumHigh-volume sellers
WhatsApp Cloud APIFree (Meta hosted)1,000 free/monthComplexDevelopers
Twilio SandboxFree (testing only)LimitedEasyTesting/development

Section 2: Building the Shopify Order Workflow

Node 1 — Shopify Trigger: Add the Shopify Trigger node. Select your credential. Set topic to orders/create. This fires every time a new order comes in.

Node 2 — Set Node (Clean Data Extraction):

javascript
// Extract and rename fields for clarity
order_id: {{$json.id}}
customer_name: {{$json.billing_address.first_name}} {{$json.billing_address.last_name}}
customer_phone: {{$json.billing_address.phone}}
product_name: {{$json.line_items[0].name}}
quantity: {{$json.line_items[0].quantity}}
total_pkr: {{$json.total_price}}
city: {{$json.shipping_address.city}}
payment_method: {{$json.payment_gateway_names[0]}}
order_date: {{new Date().toLocaleString('en-PK', {timeZone: 'Asia/Karachi'})}}

Node 3 — IF Node (Routing Logic):

code
ROUTING RULES FOR PAKISTANI E-COMMERCE
═══════════════════════════════════════════════════════════════

  RULE 1: VIP ORDER (amount > PKR 5,000)
  ├── → WhatsApp to owner with VIP flag
  └── → Priority processing queue

  RULE 2: COD ORDER (payment = cash_on_delivery)
  ├── → Add to COD tracking sheet
  ├── → Customer gets "COD amount: PKR X ready at delivery"
  └── → Rider gets COD collection amount

  RULE 3: SAME-DAY ELIGIBLE (city = Karachi + order before 2 PM)
  ├── → Flag as same-day dispatch
  └── → Warehouse gets urgent alert

  RULE 4: LOW INVENTORY (remaining stock < 5)
  ├── → Alert to procurement team
  └── → Consider pausing product listing

═══════════════════════════════════════════════════════════════

Node 4 — WATI WhatsApp (Customer Notification):

code
HTTP Request Configuration:
  Method: POST
  URL: https://live-server-XXXXX.wati.io/api/v1/sendTemplateMessage
       ?whatsappNumber=92{{$json.customer_phone}}
  Headers: Authorization: Bearer YOUR_WATI_TOKEN
  Body (JSON):
  {
    "template_name": "order_confirmation",
    "broadcast_name": "order_{{$json.order_id}}",
    "parameters": [
      {"name": "customer_name", "value": "{{$json.customer_name}}"},
      {"name": "order_id", "value": "{{$json.order_id}}"},
      {"name": "total", "value": "PKR {{$json.total_pkr}}"},
      {"name": "dispatch_time", "value": "24-48 hours"}
    ]
  }

Customer receives:

code
Assalam o Alaikum {{customer_name}}!

Aapka order #{{order_id}} receive ho gaya hai.
Amount: PKR {{total}}
Dispatch time: {{dispatch_time}}

JazzCash/Easypaisa se payment confirm ho chuki hai.
Tracking details jald bheje jayenge. Shukriya!

Node 5 — Supplier WhatsApp (Pick-List): Send a separate HTTP request to your supplier's WhatsApp:

code
Naya Order!
Order #: {{$json.order_id}}
Product: {{$json.product_name}}
Qty: {{$json.quantity}}
Ship to: {{$json.city}}
Dispatch by: {{same_day ? "TODAY" : "Tomorrow"}}

Node 6 — Google Sheets (Order Log): Append to an "Orders" sheet with columns: Order ID, Date, Customer, Phone, Product, Qty, Amount PKR, City, Payment, Status.

Section 3: Building the Daraz Version

Daraz doesn't have a public webhook API for all sellers. Workarounds:

code
DARAZ INTEGRATION STRATEGIES
═══════════════════════════════════════════════════════════════

  STRATEGY 1: EMAIL PARSING (Most reliable for small sellers)
  ├── Gmail Trigger → Watch for emails from "noreply@daraz.pk"
  ├── Code Node → Parse order details from email HTML
  ├── Extract: order ID, customer, product, amount
  └── Feed into same WATI + Sheets pipeline

  STRATEGY 2: SELLER API (For registered API users)
  ├── HTTP Request → GET /orders?status=pending
  ├── Schedule Trigger → Poll every 30 minutes
  ├── Compare against existing orders in Sheet
  ├── New orders → trigger notification pipeline
  └── Requires: Daraz Open Platform developer account

  STRATEGY 3: APIFY SCRAPER (For Seller Center scraping)
  ├── HTTP Request → Apify's Daraz scraper actor
  ├── Returns order list as JSON
  ├── Schedule every 30 minutes
  └── Cost: Apify free tier (1,000 results/month)

═══════════════════════════════════════════════════════════════

Section 4: Daily Summary Report

Add a scheduled workflow at 6 PM PKT that reads today's orders from Google Sheets:

code
Daily Order Summary (WhatsApp to Owner):

*Orders Today — {{date}}*

Total orders: 12
Total revenue: PKR 87,500
Average order: PKR 7,292

*By City:*
Karachi: 7 orders (PKR 52,000)
Lahore: 3 orders (PKR 24,500)
Islamabad: 2 orders (PKR 11,000)

*Pending Actions:*
- 3 COD orders need rider assignment
- 1 order flagged as VIP (PKR 15,000)
- Low stock alert: Blue Kurta (2 remaining)
Practice Lab

Practice Lab

Exercise 1: Shopify Trigger Test — Set up a Shopify test store (free 3-day trial or Shopify Partner program — free forever for development). Create a test order. Confirm the Shopify Trigger fires in n8n. Explore the raw JSON output — find the customer phone number, product name, and total price fields.

Exercise 2: Data Extraction — Build the Set node to extract the 9 fields listed in Node 2. Activate the workflow, place a test order. Verify all fields appear correctly. Pay special attention to the phone number format — Pakistani numbers may need the +92 prefix added.

Exercise 3: Gmail-Based Daraz Integration — If you don't have a Shopify store, build the Daraz email parser version. Set up a Gmail Trigger to watch for emails from Daraz. Use a Code node to parse the order details from the email HTML. Log parsed orders to Google Sheets. This is the version most Pakistani Daraz sellers will actually use.

Exercise 4: End-to-End Test — Connect the full pipeline: Trigger → Set → IF (VIP check) → WATI/Email notification → Google Sheets log. Replace WATI with Gmail for testing (since WATI requires a paid account). Send yourself an email formatted like a WhatsApp message. This proves the logic works before investing in a WATI subscription.

Pakistan Case Study

Karachi Fashion Seller — From 3 Hours/Day to 30 Seconds/Order

Amna ran a women's clothing boutique in Gulshan-e-Iqbal, Karachi, selling on both Daraz and her own Shopify store. She was spending 3 hours every day on order management:

Before n8n:

TaskTime/DayMonthly Cost (at PKR 500/hour)
Copy order from Daraz/Shopify30 minPKR 7,500
WhatsApp customer confirmation45 minPKR 11,250
WhatsApp supplier pick-list30 minPKR 7,500
Update inventory spreadsheet30 minPKR 7,500
Daily summary calculation15 minPKR 3,750
Total2.5 hours/dayPKR 37,500/month

After n8n:

ComponentSetup TimeMonthly Cost
Shopify Trigger + Set Node30 minFree
Daraz Email Parser1 hourFree
WATI WhatsApp (customer + supplier)45 minPKR 10,000/month
Google Sheets logging15 minFree
Daily summary at 6 PM30 minFree
VPS (Contabo $7)Already runningPKR 1,960/month
Total setup3 hoursPKR 11,960/month

Results After 30 Days:

MetricBeforeAfterChange
Time on order management2.5 hours/day10 min/day (review only)-93%
Customer notification speed1-4 hours after orderUnder 30 secondsInstant
Missed/late notifications5-8/week0-100%
Supplier communicationManual WhatsApp, sometimes forgotAutomatic every orderPerfect
Monthly labor costPKR 37,500PKR 0 (automated)-100%
WATI + VPS costPKR 0PKR 11,960New cost
Net monthly savingsPKR 25,540

Amna's Key Insight: "Pehle har order ke liye manually WhatsApp karna padta tha — kabhi kabhi bhool jaati thi aur customer naraz ho jata. Ab order aata hai, 30 second mein customer ko confirmation aur supplier ko pick-list pohanch jaati hai. Mujhe sirf evening mein summary dekhna hota hai. 3 ghante ka kaam 10 minute mein."

Key Takeaways

  • Shopify's native n8n integration is the fastest path to order automation — it takes under 20 minutes to set up the basic trigger-to-WhatsApp flow
  • For Daraz sellers without API access, email parsing via Gmail Trigger is the most reliable integration method — it works for all seller tiers
  • WATI is Pakistan's most cost-effective WhatsApp BSP at PKR 8,000-15,000/month — the automation pays for itself within 1-2 weeks of saved manual work
  • Always build a Google Sheets logging step — it becomes your order database and enables daily/monthly analytics without extra software
  • The IF node routing logic (VIP orders, COD handling, same-day dispatch, low inventory) is what turns a basic notification into an intelligent order management system
  • Customer WhatsApp notifications should be in Roman Urdu for Pakistani audiences — "Aapka order receive ho gaya hai" converts better than formal English
  • A daily summary at 6 PM PKT gives the business owner visibility without requiring them to check n8n — send it via WhatsApp where they'll actually see it
  • For most Pakistani e-commerce sellers, this single workflow replaces 2-3 hours of daily manual work — PKR 25,000-40,000/month in labor savings
  • Build the Shopify version first (simplest), test thoroughly, then adapt for Daraz using the email parser strategy

Lesson Summary

Includes hands-on practice lab8 runnable code examples4-question knowledge check below

Quiz: E-commerce Order Processing — Daraz/Shopify to WhatsApp

4 questions to test your understanding. Score 60% or higher to pass.