WP Web Push (VAPID)
Web Push notifications for WordPress with guest/user subscriptions, broadcasts, post and WooCommerce events. Uses VAPID via Minishlink/WebPush.
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/developertugrul/wordpress-free-web-push-notification/archive/refs/heads/main.zipWeb Push notifications for WordPress with guest/user subscriptions, broadcasts, new post notifications, and WooCommerce order updates. Implements browser Push API and VAPID using the PHP library minishlink/web-push.
—
WP Web Push (VAPID) — Türkçe ve İngilizce Kılavuz
Bu eklenti, WordPress sitenize Web Push bildirimleri ekler: ziyaretçiden izin isteme, guest ve oturum açmış kullanıcılar için ayrı abonelikler, giriş/registrasyon sonrası guest aboneliklerini kullanıcıya aktarma, admin panelinden toplu bildirim, yeni yazı bildirimi ve WooCommerce sipariş durum güncellemeleri.
- HTTPS zorunludur (Push API gereği).
- Gönderim için
minishlink/web-pushkullanılmaktadır (Composer gerektirir).
İçindekiler / Contents
- TR — Özellikler
- TR — Gereksinimler
- TR — Kurulum
- TR — Yapılandırma
- TR — Kullanım
- TR — REST API
- TR — WooCommerce
- TR — Sorun Giderme
- TR — Yol Haritası
- EN — Features
- EN — Requirements
- EN — Installation
- EN — Configuration
- EN — Usage
- EN — REST API
- EN — WooCommerce
- EN — Troubleshooting
- EN — Roadmap
TR — Özellikler
- Ziyaretçiden izin isteyen banner ve tek tıkla abonelik
- Guest ve oturum açmış kullanıcılar için ayrı abonelikler
- Guest → kullanıcı giriş/registrasyonunda aboneliklerin otomatik aktarımı
- Kullanıcı başına çoklu cihaz desteği
- Admin ekranları: Settings (VAPID), Send (toplu gönderim), Subscribers listesi
- Global bildirim ayarları: Default URL, Badge, Vibrate, RequireInteraction, Re‑notify
- Service Worker kök scope ile
/wp-webpush-sw.js - Mevcut PWA Service Worker ile uyumlu: Kök SW varsa eklenti plugin-scope SW’ye geçer veya WS‑PWA SW’ye push desteği ekler
- REST uçları ile subscribe/unsubscribe
- Yeni yazı yayınlanınca otomatik bildirim
- WooCommerce: yeni sipariş ve sipariş durumu değişikliği bildirimleri
- Send ekranında rol bazlı hedefleme ve kuyruk (WP‑Cron) ile parçalı gönderim
- Kullanıcı Tercihleri (kanallar: announcements, posts, woocommerce) ve Konular (kategori/ürün kategorisi)
- Frontend tercih yönetimi: [wpwp_preferences] (AJAX destekli)
- CTR takibi (isteğe bağlı): URL sarma ve tıklama log’u, Queue & Logs sayfasında özet
TR — Gereksinimler
- WordPress 5.8+
- PHP 7.4+ (OpenSSL önerilir)
- HTTPS (geliştirme için self-signed olabilir)
- Composer (sunucuda veya yerelde)
TR — Kurulum
- Eklentiyi kopyalayın veya klonlayın:
wp-content/plugins/wp-webpush
- Bağımlılıkları kurun:
cd wp-content/plugins/wp-webpush
composer install
-
WordPress Admin → Plugins → WP Web Push eklentisini etkinleştirin.
-
WP Admin → Web Push → Settings
- VAPID Public/Private key değerlerini girin ya da “Generate VAPID Keys” ile üretin.
- Default Icon URL ve Auto Prompt ayarlarını yapın.
Not: VAPID anahtarları üretiminde sorun yaşarsanız PHP ile şu komutu kullanabilirsiniz:
php -r "require 'vendor/autoload.php'; var_export(\Minishlink\WebPush\VAPID::createVapidKeys());"
Çıktıdaki publicKey ve privateKey değerlerini ayarlara girin.
TR — Yapılandırma
- VAPID Anahtarları: Gönderim için zorunlu.
- Default Icon URL: Bildirim simgesi.
- Auto Prompt: Ziyaret sırasında banner’ı otomatik gösterir.
Servis çalışanı: /wp-webpush-sw.js kök scope ile sunulur ve Service-Worker-Allowed: / başlığı eklenir.
TR — Kullanım
- Ziyaretçi siteye geldiğinde banner görünür (Auto Prompt açıksa).
- “Enable” ile izin verildiğinde abonelik yaratılır ve REST ile sunucuya kaydedilir.
- Giriş/registrasyon olduğunda guest abonelikleri ilgili kullanıcı hesabına aktarılır.
- Admin → Web Push → Send ekranından All/Guests/Users hedeflerine toplu gönderim yapılabilir.
- Rol seçerek kullanıcı segmentleri hedeflenebilir.
- Büyük kitleler için Queue (WP‑Cron) ile parçalı gönderim önerilir.
- Yeni yazı publish olduğunda tüm abonelere otomatik bildirim gider.
Programatik gönderim örneği (PHP):
$subs = new WPWP_Subscriptions();
$rows = $subs->get_all(['users_only' => true]);
$sender = new WPWP_Sender();
$sender->send_bulk($rows, [
'title' => 'Duyuru',
'body' => 'Yeni özellik yayında',
'url' => home_url('/'),
'tag' => 'broadcast',
]);
TR — REST API
POST /wp-json/wp-webpush/v1/subscribe
Gönderim:
{
"endpoint": "https://fcm...",
"keys": { "p256dh": "...", "auth": "..." },
"contentEncoding": "aesgcm",
"browser": "Chrome",
"device": "Desktop"
}
POST /wp-json/wp-webpush/v1/unsubscribe
Gönderim:
{ "endpoint": "https://fcm..." }
TR — WooCommerce
- Yeni sipariş ve sipariş durumu değişikliklerinde (processing, completed, cancelled, refunded, on-hold, shipped) siparişi veren kullanıcıya push gönderilir (abonesi varsa).
- Misafir siparişleri için e-posta ile eşleştirme bir sonraki sürüm hedefi.
- Misafir siparişlerde
wpwp_guestçerezi sipariş meta bilgisine yazılır; bu anahtara bağlı guest aboneliklere de bildirim gönderilir.
TR — Sorun Giderme
- Push gelmiyor: HTTPS, izin durumu, SW kaydı ve VAPID anahtarlarını kontrol edin.
WebPush library not available:composer installçalıştırın.Unauthorized/invalid VAPID: Public/Private anahtar eşleşmesini ve domain’i kontrol edin.- Safari: iOS/iPadOS’ta bildirimler sadece PWA kurulduğunda çalışır; macOS Safari 16+ destekler.
TR — Yol Haritası
- Rol/taksonomi bazlı segmentasyon, kullanıcı tercihleri
- WP-Cron kuyruk ve parti gönderim
- Teslim/CTR analitiği, dışa aktarım
- WooCommerce misafir sipariş e-posta eşleştirme
TR — Gelişmiş Opsiyonlar (İsteğe Bağlı)
- Kullanıcı Tercihleri: Kullanıcı profilinde hangi bildirimleri almak istediğini seçebilmesi (Yeni yazı, Duyuru, WooCommerce sipariş, vb.).
- Segmentasyon: Rol, taksonomi (kategori/etiket), özel hedef kitle tanımları ile gönderim.
- Analitik: Teslim/başarısızlık ölçümleri, tıklama oranı (CTR), UTM takibi ve rapor/CSV dışa aktarım.
- Kuyruk/Log Ekranı: Kuyrukta bekleyen/gönderilen işleri, parça ilerlemesini ve hata raporlarını gösteren admin ekranı.
- Woo Misafir Eşleme: Misafir sipariş e-postasını kullanarak mevcut guest aboneliklerini kullanıcıya bağlama; sonraki girişte otomatik birleştirme.
EN — Features
- Permission banner with one-click subscription
- Separate subscriptions for guests and logged-in users
- Auto-attach guest subscriptions on login/register
- Multiple devices per user
- Admin pages: Settings (VAPID), Send (broadcast), Subscribers
- Global notification defaults: Default URL, Badge, Vibrate, RequireInteraction, Re‑notify
- Service Worker at
/wp-webpush-sw.jswith root scope - Compatible with existing PWA SWs: falls back to plugin-scope SW or augments WS‑PWA SW with push handling
- REST endpoints for subscribe/unsubscribe
- Auto notification on post publish
- WooCommerce: new order and status change notifications
- Send page supports role targeting and queued delivery (WP‑Cron)
EN — Requirements
- WordPress 5.8+
- PHP 7.4+ (OpenSSL recommended)
- HTTPS (required by the Push API)
- Composer
EN — Installation
- Copy the plugin to
wp-content/plugins/wp-webpush. - Install dependencies:
cd wp-content/plugins/wp-webpush
composer install
- Activate the plugin in WP Admin → Plugins.
- Go to WP Admin → Web Push → Settings and input or generate VAPID keys. Set default icon and Auto Prompt as desired.
If you need to generate VAPID keys via CLI:
php -r "require 'vendor/autoload.php'; var_export(\Minishlink\WebPush\VAPID::createVapidKeys());"
Copy publicKey and privateKey to Settings.
EN — Configuration
- VAPID keys are required for delivery.
- Default Icon URL for notifications.
- Auto Prompt shows the banner automatically.
Service Worker is served at /wp-webpush-sw.js with Service-Worker-Allowed: /.
EN — Usage
- On visit, the banner is shown (if Auto Prompt is enabled).
- When accepted, the subscription is created and saved via REST.
- On login/register, guest subscriptions are attached to the user account.
- Use Admin → Web Push → Send to broadcast to All/Guests/Users.
- Target specific user roles if needed.
- For large audiences, enable Queue to deliver in chunks via WP‑Cron.
- On post publish, a push is automatically sent to all subscribers.
- Preferences: add [wpwp_preferences] shortcode to a page to let users manage channels and topics (AJAX enabled).
Programmatic send (PHP):
$subs = new WPWP_Subscriptions();
$rows = $subs->get_all(['users_only' => true]);
$sender = new WPWP_Sender();
$sender->send_bulk($rows, [
'title' => 'Announcement',
'body' => 'New feature is live',
'url' => home_url('/'),
'tag' => 'broadcast',
]);
EN — REST API
POST /wp-json/wp-webpush/v1/subscribe
Body:
{
"endpoint": "https://fcm...",
"keys": { "p256dh": "...", "auth": "..." },
"contentEncoding": "aesgcm",
"browser": "Chrome",
"device": "Desktop"
}
POST /wp-json/wp-webpush/v1/unsubscribe
Body:
{ "endpoint": "https://fcm..." }
EN — WooCommerce
- Sends push notifications for new orders and status changes (processing, completed, cancelled, refunded, on-hold, shipped) to the order’s user if they have active subscriptions.
- Guest order mapping by email is a planned enhancement.
- For guest orders, the
wpwp_guestcookie is stored in order meta and used to notify guest subscriptions.
EN — Troubleshooting
- No push received: check HTTPS, permission, SW registration, and VAPID keys.
WebPush library not available: runcomposer install.Unauthorized/invalid VAPID: ensure public/private pair matches and domain is correct.- Safari: on iOS/iPadOS, web push works for installed PWAs; macOS Safari 16+ supported.
EN — Roadmap
- Segmentation by roles/taxonomies and user preferences
- WP-Cron queue and batch delivery for large audiences
- Analytics (delivery, CTR), exports
- WooCommerce guest order email mapping
EN — Advanced Options (Optional)
- User Preferences: Let users choose which notifications to receive (New Post, Announcements, WooCommerce orders, etc.).
- Segmentation: Target by roles, taxonomies (categories/tags), or custom audiences.
- Analytics: Delivery/failure metrics, click-through rate (CTR), UTM tracking, and CSV exports.
- Queue/Log Screen: Admin UI to view queued/sent jobs, chunk progress, and error reports.
- Woo Guest Mapping: Use guest order email to associate guest subscriptions to user accounts; auto-merge on subsequent login.
EN — CTR Tracking (optional)
- When Settings → Track Clicks is enabled, URLs are wrapped through
/wp-webpush-clickand clicks are stored inwpwp_events. - Queue & Logs shows click counts per job with date/status filters.
TR — CTR Takibi (isteğe bağlı)
- Settings → Track Clicks işaretlenirse, gönderimlerdeki URL’ler
/wp-webpush-clicküzerinden sarılır ve tıklamalarwpwp_eventstablosuna kaydedilir. - Queue & Logs ekranında job başına click sayısı görüntülenir, tarih ve durum filtreleri vardır.