Blog/Use Cases

WhatsApp API for Logistics: Real-Time Shipment Tracking Notifications

Use WhatsApp API to send real-time shipment tracking notifications, delivery alerts, and exception notifications to customers in logistics and shipping. Rapiwa API ($5/month) for logistics companies.

by Mahi
WhatsApp API for Logistics: Real-Time Shipment Tracking Notifications

WhatsApp API for logistics lets shipping companies, courier services, and 3PLs automatically send shipment tracking notifications, delivery windows, exception alerts, and proof of delivery confirmations to recipients via WhatsApp. Using Rapiwa API ($5/month, no per-message fees), logistics companies reduce "where is my shipment?" customer service calls by 50–70% and improve first-attempt delivery rates.

Why WhatsApp is Critical for Logistics

Logistics has a delivery failure problem: 15–30% of deliveries fail on the first attempt because the recipient wasn't home. Every failed delivery attempt costs $3–$10 (courier time + reattempt). WhatsApp solves this by:

  • Sending delivery window alerts so recipients know when to be home
  • Allowing recipients to reschedule via WhatsApp reply (no phone calls)
  • Sending proof of delivery confirmation immediately
  • Reducing "where is my package?" calls by up to 70%

Rapiwa is the cheapest WhatsApp API for logistics: $5/month flat. Compare to SMS tracking notifications at $0.05–$0.10/message — for a courier with 500 daily shipments, that's $25–$50/day in SMS fees vs $5/month for Rapiwa.

Top 6 WhatsApp Automation Use Cases for Logistics

1. Shipment Dispatched Notification

The problem: Recipients don't know their shipment is on the way.

The solution: WhatsApp notification when the shipment is dispatched.

curl -X POST https://app.rapiwa.com/send-message \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "number": "8801234567890",
    "message": "Your shipment is on its way! 🚚\n\nTracking: SHP-2026-789\nCarrier: DHL Express\nEstimated delivery: July 13, 2026\n\nTrack live: https://track.example.com/SHP-2026-789\n\nQuestions? Reply here."
  }'

Expected response:

{
  "status": "success",
  "messageId": "msg_logistics_abc123",
  "timestamp": "2026-07-11T10:30:00Z"
}

2. Delivery Window Alert (Morning of Delivery)

The problem: Recipients miss deliveries because they don't know the delivery window.

The solution: WhatsApp alert the morning of delivery with a 2-hour window.

import requests
from datetime import datetime

def send_delivery_window_alert(
    recipient_phone: str,
    recipient_name: str,
    tracking_id: str,
    delivery_window_start: str,
    delivery_window_end: str,
    driver_name: str,
    api_key: str
) -> dict:
    
    message = (
        f"Delivery Today! 📦\n\n"
        f"Hi {recipient_name}!\n\n"
        f"Your package will be delivered today:\n"
        f"⏰ Window: {delivery_window_start}{delivery_window_end}\n"
        f"📦 Tracking: {tracking_id}\n"
        f"🚗 Driver: {driver_name}\n\n"
        f"Not home? Reply:\n"
        f"• *SAFE* — leave in a safe place\n"
        f"• *NEIGHBOR* — leave with a neighbor\n"
        f"• *RESCHEDULE* — pick a new delivery date\n\n"
        f"We'll be there soon! 🚚"
    )
    
    return requests.post(
        'https://app.rapiwa.com/send-message',
        headers={'Authorization': f'Bearer {api_key}'},
        json={'number': recipient_phone, 'message': message}
    ).json()

# Usage
send_delivery_window_alert(
    recipient_phone='8801234567890',
    recipient_name='Sarah',
    tracking_id='SHP-2026-789',
    delivery_window_start='10:00 AM',
    delivery_window_end='12:00 PM',
    driver_name='Rahim',
    api_key='YOUR_API_KEY'
)

3. Delivery Attempt Failed

The problem: Delivery fails, recipient doesn't know, shipment sits in the depot.

The solution: Immediate WhatsApp alert with rescheduling link.

"Hi Sarah! 📦 Delivery attempt: Missed

Our driver tried to deliver your package (SHP-2026-789) today at 10:45 AM but no one was home.

Your package is now at our depot:
📍 City Depot, 45 Industrial Road

Options:
1️⃣ Reply *RESCHEDULE* to pick a new delivery date
2️⃣ Reply *PICKUP* to collect from our depot (Mon–Sat 9AM–6PM)
3️⃣ Reply *SAFE* to authorize leaving at your door next time

Quick response ensures faster redelivery! 🚚"

Processing replies via webhook:

def handle_delivery_reply(phone: str, message: str, tracking_id: str, api_key: str) -> None:
    """Handle recipient replies for delivery instructions."""
    message_lower = message.strip().upper()
    
    if message_lower == 'RESCHEDULE':
        booking_url = f"https://track.example.com/{tracking_id}/reschedule"
        reply = f"Great! Choose a new delivery date here:\n{booking_url}"
    
    elif message_lower == 'PICKUP':
        reply = (
            "Perfect! Your package will be held at our depot for 5 business days:\n\n"
            "📍 City Depot, 45 Industrial Road\n"
            "🕐 Hours: Mon–Sat, 9AM–6PM\n"
            "📋 Bring: Your ID and tracking number SHP-2026-789"
        )
    
    elif message_lower == 'SAFE':
        reply = "Noted! We'll leave your package in a safe place next time. Please ensure the area is secure. ✅"
    
    else:
        reply = "Thanks for your message! A customer service agent will be in touch shortly."
    
    requests.post(
        'https://app.rapiwa.com/send-message',
        headers={'Authorization': f'Bearer {api_key}'},
        json={'number': phone, 'message': reply}
    )

4. Proof of Delivery

The problem: Senders and recipients argue about whether a delivery was made.

The solution: Instant WhatsApp proof of delivery with timestamp.

"Package Delivered! ✅

Hi Sarah! Your package SHP-2026-789 was delivered:

📅 Delivered: July 13, 2026 at 11:23 AM
📍 Delivered to: Front door
🖊️ Signed by: Self
📷 Photo: https://track.example.com/pod/SHP-2026-789

Track your delivery history: https://track.example.com/SHP-2026-789

Any issues? Reply here within 48 hours."

5. Exception Alert (Delay, Damage, Customs Hold)

The problem: Shipments get delayed or held in customs — recipients find out when they call, not proactively.

The solution: Immediate WhatsApp exception notification.

EXCEPTION_MESSAGES = {
    'delay': (
        "Delivery Update — Slight Delay ⚠️\n\n"
        "Hi {name}, your package {tracking} has been delayed.\n\n"
        "New estimated delivery: {new_date}\n"
        "Reason: {reason}\n\n"
        "We apologize for the inconvenience. "
        "Track live: {tracking_url}"
    ),
    'customs': (
        "Customs Hold ⚠️\n\n"
        "Hi {name}, your package {tracking} is being held at customs.\n\n"
        "Required action: {action_required}\n\n"
        "Contact customs directly:\n"
        "📞 {customs_phone}\n"
        "Reference: {customs_ref}\n\n"
        "Estimated release: 2–5 business days after document submission."
    ),
    'damage': (
        "⚠️ Package Condition Alert\n\n"
        "Hi {name}, your package {tracking} may have been damaged in transit.\n\n"
        "Our driver noted visible damage before delivery.\n\n"
        "Please inspect the package upon receipt and:\n"
        "• Accept and report any damage: Reply DAMAGED\n"
        "• Refuse delivery: Reply REFUSE\n\n"
        "We'll open a claim immediately."
    )
}

6. Return Shipment Updates

The problem: Customers initiating returns don't know if their return was received.

The solution: WhatsApp notification at each stage of the return process.

Return initiated:
"Return Registered ✅
Hi Sarah! Your return for Order #12345 has been registered.
Return tracking: RTN-2026-456
Drop off at any DHL location with this reference.
Track: https://track.example.com/RTN-2026-456"

Return received at warehouse:
"Return Received! ✅
Your return (RTN-2026-456) arrived at our warehouse on July 13.
Refund will be processed within 3–5 business days.
We'll notify you when the refund is sent."

How to Set Up WhatsApp Tracking Notifications with Rapiwa

Step 1: Create Your Rapiwa Account

Sign up at rapiwa.com — 3-day free trial, no credit card.

Step 2: Connect to Your TMS or WMS

If your Transport Management System (TMS) or Warehouse Management System (WMS) supports webhooks, use n8n to receive events and send WhatsApp messages:

  1. TMS webhook → n8n → Rapiwa: dispatch notification
  2. GPS driver app event → n8n → Rapiwa: delivery window alert
  3. Delivery scan event → n8n → Rapiwa: proof of delivery

Step 3: Build the Notification Service

import requests

class LogisticsNotifier:
    def __init__(self, api_key: str):
        self.api_key = api_key
        self.base_url = 'https://app.rapiwa.com'
    
    def notify(self, phone: str, event: str, shipment: dict) -> dict:
        """Send WhatsApp notification for a shipment event."""
        message_builders = {
            'dispatched': self._build_dispatched_message,
            'out_for_delivery': self._build_delivery_window_message,
            'delivered': self._build_delivered_message,
            'failed_attempt': self._build_failed_attempt_message,
            'exception': self._build_exception_message,
        }
        
        builder = message_builders.get(event)
        if not builder:
            return {'status': 'skipped', 'reason': 'unknown_event'}
        
        message = builder(shipment)
        
        return requests.post(
            f'{self.base_url}/send-message',
            headers={'Authorization': f'Bearer {self.api_key}'},
            json={'number': phone, 'message': message}
        ).json()
    
    def _build_dispatched_message(self, s: dict) -> str:
        return (
            f"Shipment Dispatched! 🚚\n\n"
            f"Tracking: {s['tracking_id']}\n"
            f"ETA: {s['estimated_delivery']}\n\n"
            f"Track: {s['tracking_url']}"
        )
    
    def _build_delivered_message(self, s: dict) -> str:
        return (
            f"Delivered ✅\n\n"
            f"Tracking: {s['tracking_id']}\n"
            f"Delivered: {s['delivery_timestamp']}\n"
            f"Signed by: {s.get('signed_by', 'Self')}"
        )

Results You Can Expect

  • 50–70% reduction in "where is my package?" calls
  • 20–30% improvement in first-attempt delivery rates
  • 15–25% reduction in missed deliveries (delivery window alerts)
  • 95%+ notification open rate (WhatsApp vs 20% for email tracking updates)

FAQ

Can I send WhatsApp tracking notifications for multiple carriers? Yes. Rapiwa is carrier-agnostic — it sends WhatsApp messages. Integrate your TMS to trigger the Rapiwa API call regardless of which carrier is handling the shipment.

Does Rapiwa charge per shipment notification? No. Rapiwa charges $5/month flat with no per-message fees. A logistics company sending 500 shipment notifications/day pays $5/month.

Can recipients reply to reschedule deliveries via WhatsApp? Yes. Set up a Rapiwa webhook to receive incoming messages and process keywords (RESCHEDULE, PICKUP, SAFE) to update delivery instructions in your TMS.

What phone number format works for international shipments? International format without +: Bangladesh 8801234567890, UK 447700900123, USA 12125551234. Validate and format all recipient phone numbers at the time of shipment creation.

Does this work for last-mile delivery startups? Yes — especially well. At $5/month, even a small startup doing 50–100 deliveries/day can afford professional WhatsApp tracking notifications that compete with large courier brands.