DEV Community

Cover image for Web Push & WhatsApp Alerts: Re-Engage Without an App
Muhammad Ali Mughal
Muhammad Ali Mughal

Posted on

Web Push & WhatsApp Alerts: Re-Engage Without an App

Most businesses that ask me for a mobile app do not need an app. They need one thing an app gives them: a way to tap a customer on the shoulder when an order ships, a quote is approved or a payment fails. In 2026 you can get that from the web you already have, with Web Push for engaged users and WhatsApp template messages for everyone else, without waiting on an app store review.

I run Loop Origin, where we build custom web platforms on Laravel and Nuxt. I wrote this with help from AI tools and checked every snippet and claim myself. This is the architecture I use for re-engagement alerts, the failure modes that bite in production and how I decide which channel carries which message.

Can you re-engage mobile customers without a native app?

Direct answer: Yes. Use Web Push (VAPID, a service worker and stored subscriptions) for users who opted in through your site or installed PWA, and WhatsApp Business template messages for transactional alerts to opted-in phone numbers. Route both through one notification service with per-user preferences, delivery tracking and fallbacks.

What each channel can actually do

Web Push is a browser standard: your server sends an encrypted message to the browser vendor's push service, and the service worker shows a notification even when your tab is closed. It works in Chrome, Edge and Firefox on desktop and Android, and in Safari. On iPhone and iPad it works from iOS and iPadOS 16.4 onward, but only for a web app the user has added to the Home Screen. That one rule shapes the whole strategy for iOS-heavy audiences.

WhatsApp Business Platform (Cloud API) sends messages to a phone number from a verified business number. Outside a 24-hour customer service window you can only send pre-approved templates, grouped into categories such as utility, marketing and authentication. It needs explicit opt-in from the customer, and Meta charges per template message, with rates that vary by country and category, so check the current rate card before you budget.

Factor Web Push WhatsApp templates Email SMS
Reach requirement Browser permission (iOS: installed PWA) Opt-in phone number Email address Phone number
App store review None None (Meta template review instead) None None
Per-message fee None beyond your hosting Yes, per template, by country/category Low via ESP Yes, per segment
Rich content Title, body, icon, image, actions Template text, media, buttons Full HTML Plain text
Delivery visibility Push service accepts; no read receipts Sent, delivered, read, failed webhooks Opens unreliable Delivery reports vary
Best for Engaged repeat users, staff dashboards Order, delivery and payment alerts Receipts, long content OTP fallback

The pattern I keep landing on: WhatsApp for "your order is out for delivery", Web Push for "your quote was approved, tap to review", email for the receipt. Marketing goes last and least.

Architecture: one notification service, many channels

The mistake I see most is sprinkling channel calls through controllers. Six months later nobody knows why a customer got three alerts for one event. I put every alert behind one Laravel notification class per business event and let preferences pick the channels.

// app/Notifications/OrderShipped.php
use NotificationChannels\WebPush\WebPushChannel;
use NotificationChannels\WebPush\WebPushMessage;

class OrderShipped extends Notification implements ShouldQueue
{
    use Queueable;

    public function __construct(public Order $order) {}

    public function via(object $user): array
    {
        return $user->alertChannelsFor('order_updates'); // e.g. ['whatsapp', WebPushChannel::class]
    }

    public function toWebPush(object $user, $notification): WebPushMessage
    {
        return (new WebPushMessage)
            ->title('Order #'.$this->order->number.' shipped')
            ->body('Track your delivery and expected time.')
            ->icon('/icons/icon-192.png')
            ->data(['url' => route('orders.show', $this->order)])
            ->options(['TTL' => 3600, 'urgency' => 'normal']);
    }

    public function toWhatsApp(object $user): array
    {
        return [
            'template' => 'order_shipped',      // approved utility template
            'language' => $user->locale ?? 'en',
            'params'   => [$user->first_name, $this->order->number],
        ];
    }
}
Enter fullscreen mode Exit fullscreen mode

The Web Push side uses the laravel-notification-channels/webpush package (built on minishlink/web-push), which stores subscriptions per user and signs requests with your VAPID keys. Generate keys once per environment and keep them in your secrets store, because rotating them invalidates every existing subscription.

The WhatsApp side is a small custom channel that calls the Cloud API:

// app/Channels/WhatsAppChannel.php
public function send(object $notifiable, Notification $notification): void
{
    $msg = $notification->toWhatsApp($notifiable);

    $res = Http::withToken(config('services.whatsapp.token'))
        ->timeout(10)->retry(2, 500, throw: false)
        ->post('https://graph.facebook.com/'.config('services.whatsapp.version')
              .'/'.config('services.whatsapp.phone_id').'/messages', [
            'messaging_product' => 'whatsapp',
            'to'       => $notifiable->whatsapp_e164,
            'type'     => 'template',
            'template' => [
                'name'     => $msg['template'],
                'language' => ['code' => $msg['language']],
                'components' => [[
                    'type' => 'body',
                    'parameters' => collect($msg['params'])
                        ->map(fn ($p) => ['type' => 'text', 'text' => (string) $p])->all(),
                ]],
            ],
        ]);

    NotificationLog::record($notifiable, $notification, 'whatsapp',
        $res->json('messages.0.id'), $res->successful() ? 'accepted' : 'failed', $res->body());
}
Enter fullscreen mode Exit fullscreen mode

Delivery and read statuses come back later on a webhook. Verify the signature header on every call, process it from a queue and update the log row by message ID. My checklist for that is in webhook security in production, and if you dispatch alerts from database transactions, the transactional outbox pattern in Laravel stops "order shipped" alerts for orders that rolled back.

A cardboard delivery parcel with a shipping label

Image: AI-generated.

The browser side: asking at the right moment

Browsers punish bad permission prompts. Safari requires the request to come from a user gesture, and users who click "Block" are very hard to win back. So I never prompt on page load.

// Nuxt composable: call from a button click, e.g. "Notify me when it ships"
export async function enablePush(vapidPublicKey) {
  if (!('serviceWorker' in navigator) || !('PushManager' in window)) return 'unsupported'
  const reg = await navigator.serviceWorker.ready
  const perm = await Notification.requestPermission()
  if (perm !== 'granted') return perm
  const sub = await reg.pushManager.subscribe({
    userVisibleOnly: true,
    applicationServerKey: urlBase64ToUint8Array(vapidPublicKey),
  })
  await $fetch('/api/push-subscriptions', { method: 'POST', body: sub.toJSON() })
  return 'granted'
}
Enter fullscreen mode Exit fullscreen mode
// service worker
self.addEventListener('push', (e) => {
  const d = e.data?.json() ?? {}
  e.waitUntil(self.registration.showNotification(d.title, {
    body: d.body, icon: d.icon, data: d.data, tag: d.data?.url,
  }))
})
self.addEventListener('notificationclick', (e) => {
  e.notification.close()
  e.waitUntil(clients.openWindow(e.notification.data?.url || '/'))
})
Enter fullscreen mode Exit fullscreen mode

On iOS, show the "Add to Home Screen" hint first and offer push only inside the installed app. The offline-first PWA notes cover the manifest and service worker groundwork.

Effort and running-cost comparison

These are my own planning estimates for a typical Laravel + Nuxt platform, not quotes; your numbers depend on scope.

Approach Build effort (estimate) Ongoing cost drivers Store dependency
Native iOS + Android apps for alerts Months, two codebases or a cross-platform layer Store fees, release cycles, device testing High
Web Push on existing site/PWA About 1–2 weeks Hosting and queue workers only None
WhatsApp templates via Cloud API About 1–2 weeks plus Meta verification Per-template fees, template approvals None (Meta policy instead)
Unified notification service (both + email) About 3–4 weeks Above combined, plus monitoring None

Failure modes I have hit

  • Dead subscriptions piling up. Push services answer 404 or 410 Gone for expired or revoked subscriptions. Delete them on that response, or your queue wastes time on ghosts.
  • VAPID keys regenerated on deploy. Every subscriber silently stops receiving. Keys belong in secrets, not in a build step.
  • Templates rejected or paused. Promotional wording in a "utility" template gets rejected or recategorised. Keep transactional templates factual, and have a fallback channel when a template is unavailable.
  • Alert storms. A retry loop or a bulk status update sends 40 pushes in a minute. Use a per-user rate limit and the notification tag so new alerts replace old ones.
  • Sending without consent. Store opt-in timestamp, source and channel per user, and honour opt-out instantly. That is both a policy requirement and good manners.
  • Quiet hours ignored. Respect the user's timezone for anything non-urgent; a 3 AM delivery update is how you earn a blocked permission.

Launch checklist

  1. Map each business event to channels: urgent transactional, useful update, marketing.
  2. Add a per-user preferences table with opt-in timestamp and source for each channel.
  3. Generate VAPID keys per environment and store them as secrets.
  4. Ship the service worker, a gesture-triggered permission prompt and an iOS install hint.
  5. Register a WhatsApp business number, verify the business and submit utility templates.
  6. Build one notification class per event, queued, with logging and per-user rate limits.
  7. Handle 404/410 push responses and WhatsApp failed statuses with cleanup and fallback.
  8. Test on real Android, iPhone (installed PWA) and desktop before launch.

FAQ

Do Web Push notifications work on iPhone?

Yes, on iOS and iPadOS 16.4 or later, for a web app the user has added to the Home Screen. Notifications in regular Safari tabs are not supported on iPhone, so iOS strategy starts with getting the PWA installed.

Is WhatsApp messaging free for businesses?

No. Meta charges for template messages, with rates that depend on the recipient's country and the template category. Replies within an open customer service window are handled differently, so check Meta's current pricing page before you budget.

Can I send marketing messages with Web Push?

Technically yes, but it is the fastest way to lose permission. I keep push for things the user asked to hear about, like orders, approvals and replies, and make marketing a separate, clearly opt-in preference.

What happens when a push subscription expires?

The push service returns 404 or 410 when you send to it. Delete that subscription immediately and let the browser re-subscribe on the next visit or permission check.

Should I build a native app instead?

Build one when you need deep device features, heavy offline use or app-store discovery. If the main goal is alerts and quick actions, Web Push plus WhatsApp usually covers it at a fraction of the effort.

How do I avoid duplicate alerts across channels?

Send every alert through one notification class per event, pick channels from user preferences, and record each send with a unique event ID. Check that ID before sending so retries never notify twice.

Conclusion

Re-engagement is a backend design problem dressed up as a mobile-app question. Put every alert behind one notification service, ask for push permission only when the user wants something, use approved WhatsApp templates for the alerts that must land, and log every send. You get most of what an app would have given you, and you can ship it this month.


Follow & Connect

Watch on YouTube: Resume Boost AI · PixelValut · Daily AI News By Ali

Top comments (0)