This plugin allows you to send and receive push notifications. Powered by Pushwoosh (www.pushwoosh.com).
npm install pushwoosh-cordova-plugin
Cross-platform push notifications, In-App messaging, and more for Cordova / PhoneGap applications.
- Documentation
- Features
- Installation
- AI-Assisted Integration
- Quick Start
- API Reference
- Plugin Preferences
- Support
- License
- Integration Guide — step-by-step setup
- API Reference — full API documentation
- Push Notifications — register, receive, and handle push notifications on iOS and Android
- In-App Messages — trigger and display in-app messages based on events
- Tags & Segmentation — set and get user tags for targeted messaging
- User Identification — associate devices with user IDs for cross-device tracking
- Message Inbox — built-in UI for message inbox with customization options
- Badge Management — set, get, and increment app icon badge numbers
- Local Notifications — schedule and manage local notifications
- VoIP Calls — CallKit (iOS) and ConnectionService (Android) integration for VoIP push calls
- Huawei Push — HMS push notification support
- TypeScript Support — full TypeScript definitions included
Using npm:
``bash`
cordova plugin add pushwoosh-cordova-plugin@8.3.61
Using git:
`bash`
cordova plugin add https://github.com/Pushwoosh/pushwoosh-phonegap-plugin.git#8.3.61
Integrate the Pushwoosh Cordova plugin using AI coding assistants (Claude Code, Cursor, GitHub Copilot, etc.).
> Requirement: Your AI assistant must have access to Context7 MCP server or web search capabilities.
Choose the prompt that matches your task:
---
#### 1. Basic Plugin Integration
`
Integrate Pushwoosh Cordova plugin into my Cordova project.
Requirements:
- Install pushwoosh-cordova-plugin via npm
- Initialize Pushwoosh with my App ID in deviceready event
- Register for push notifications and handle push-receive and push-notification events
Use Context7 MCP to fetch Pushwoosh Cordova plugin documentation.
`
---
#### 2. Tags and User Segmentation
`
Show me how to use Pushwoosh tags in a Cordova app for user segmentation.
I need to set tags, get tags, and set user ID for cross-device tracking.
Use Context7 MCP to fetch Pushwoosh Cordova plugin documentation for setTags and getTags.
`
---
#### 3. Message Inbox Integration
`
Integrate Pushwoosh Message Inbox into my Cordova app. Show me how to:
- Display the inbox UI with custom styling
- Load messages programmatically
- Track unread message count
Use Context7 MCP to fetch Pushwoosh Cordova plugin documentation for presentInboxUI.
`
---
`javascript
document.addEventListener('deviceready', function() {
var pushwoosh = cordova.require("pushwoosh-cordova-plugin.PushNotification");
pushwoosh.onDeviceReady({
appid: "YOUR_PUSHWOOSH_APP_ID",
projectid: "YOUR_FCM_SENDER_ID",
serviceName: "YOUR_SERVICE_NAME"
});
pushwoosh.registerDevice(
function(status) {
console.log("Registered with push token: " + status.pushToken);
},
function(error) {
console.error("Failed to register: " + error);
}
);
}, false);
`
`javascript
// Notification received while app is in foreground
document.addEventListener('push-receive', function(event) {
var notification = event.notification;
console.log("Push received: " + JSON.stringify(notification));
});
// Notification opened by user
document.addEventListener('push-notification', function(event) {
var notification = event.notification;
console.log("Push opened: " + JSON.stringify(notification));
});
`
`javascript
var pushwoosh = cordova.require("pushwoosh-cordova-plugin.PushNotification");
pushwoosh.setTags(
{ username: "john_doe", age: 25, interests: ["sports", "tech"] },
function() { console.log("Tags set successfully"); },
function(error) { console.error("Failed to set tags: " + error); }
);
`
`javascript
var pushwoosh = cordova.require("pushwoosh-cordova-plugin.PushNotification");
pushwoosh.setUserId("user_12345");
pushwoosh.postEvent("purchase_complete", {
productName: "Premium Plan",
amount: "9.99"
});
`
| Method | Description |
|--------|-------------|
| onDeviceReady(config) | Initialize the plugin. Call on every app launch |registerDevice(success, fail)
| | Register for push notifications |unregisterDevice(success, fail)
| | Unregister from push notifications |getPushToken(success)
| | Get the push token |getPushwooshHWID(success)
| | Get Pushwoosh Hardware ID |
| Method | Description |
|--------|-------------|
| setTags(tags, success, fail) | Set device tags |getTags(success, fail)
| | Get device tags |setUserId(userId)
| | Set user identifier for cross-device tracking |setLanguage(language)
| | Set custom language for localized pushes |setEmail(email, success, fail)
| | Register email for the user |setEmails(emails, success, fail)
| | Register multiple emails |
| Method | Description |
|--------|-------------|
| getRemoteNotificationStatus(success, fail) | Get push notification permission status |getLaunchNotification(success)
| | Get notification that launched the app |createLocalNotification(config, success, fail)
| | Schedule a local notification |clearLocalNotification()
| | Clear all pending local notifications (Android) |clearNotificationCenter()
| | Clear all notifications from notification center (Android) |
| Method | Description |
|--------|-------------|
| setApplicationIconBadgeNumber(badge) | Set badge number |getApplicationIconBadgeNumber(success)
| | Get current badge number |addToApplicationIconBadgeNumber(badge)
| | Increment/decrement badge |
| Method | Description |
|--------|-------------|
| postEvent(event, attributes) | Post event to trigger In-App Messages |addJavaScriptInterface(name)
| | Add JS interface for Rich Media communication |
| Method | Description |
|--------|-------------|
| presentInboxUI(params) | Open inbox UI with optional style customization |loadMessages(success, fail)
| | Load inbox messages programmatically |unreadMessagesCount(success)
| | Get unread message count |messagesCount(success)
| | Get total message count |readMessage(id)
| | Mark message as read |deleteMessage(id)
| | Delete a message |performAction(id)
| | Perform the action associated with a message |
| Method | Description |
|--------|-------------|
| setCommunicationEnabled(enable, success, fail) | Enable/disable all Pushwoosh communication |isCommunicationEnabled(success)
| | Check if communication is enabled |
| Event | Description |
|-------|-------------|
| push-receive | Fired when a notification is received while the app is active |push-notification
| | Fired when a notification is opened by the user |
Configure these in your config.xml:
`xml`
| Preference | Default | Description |
|-----------|---------|-------------|
| LOG_LEVEL | DEBUG | Logging level |IOS_FOREGROUND_ALERT_TYPE
| | ALERT | iOS foreground notification display type |ANDROID_FOREGROUND_PUSH
| | true | Show notifications when app is in foreground (Android) |PW_VOIP_IOS_ENABLED
| | false | Enable VoIP calling features on iOS |PW_VOIP_ANDROID_ENABLED
| | false` | Enable VoIP calling features on Android |
- Documentation
- Support Portal
- Report Issues
Pushwoosh Cordova Plugin is available under the MIT license. See LICENSE for details.
---
Made with ❤️ by Pushwoosh