https://github.com/woosignal/wp-notify-flutter
Send push notification from WordPress using Firebase Cloud Messaging. This package automatically pushes your fcm token to WordPress to start sending notifications. Featues inlcude assigning a WordPress user to a fcm token, sending basic push notifications for IOS and Android.
https://github.com/woosignal/wp-notify-flutter
dart flutter notifications notify token wordpress wp-notify
Last synced: about 1 year ago
JSON representation
Send push notification from WordPress using Firebase Cloud Messaging. This package automatically pushes your fcm token to WordPress to start sending notifications. Featues inlcude assigning a WordPress user to a fcm token, sending basic push notifications for IOS and Android.
- Host: GitHub
- URL: https://github.com/woosignal/wp-notify-flutter
- Owner: woosignal
- License: other
- Created: 2020-07-02T22:10:50.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-07T13:12:34.000Z (about 2 years ago)
- Last Synced: 2024-05-07T14:30:55.277Z (about 2 years ago)
- Topics: dart, flutter, notifications, notify, token, wordpress, wp-notify
- Language: Dart
- Homepage: https://woosignal.com
- Size: 34.2 KB
- Stars: 5
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# WP Notify for Flutter - Send push notifications from WordPress using Firebase Cloud Messaging
[Official WooSignal package](https://woosignal.com)
## API features:
**Notifications**
* Automatically sends the device token to your WordPress site for a given user/device
* You can assign a token to a WordPress user
* Send notifications from WordPress with our API
To use this Flutter package you must have the [WP Notify Plugin](https://woosignal.com/plugins/wordpress/wp-notify) installed first on your WordPress site, you can download it via the WooSignal website.
### Getting Started #
In your flutter project add the dependency:
``` dart
dependencies:
...
wp_notify: ^2.0.3
```
### Usage example #
Import wp_notify.dart
``` dart
import 'package:wp_notify/wp_notify.dart';
```
### Example using WP Notify
``` dart
import 'package:wp_notify/wp_notify.dart';
...
void main() {
WPNotifyAPI.instance.initWith(baseUrl: "https://mysite.com");
...
```
### Available API Requests
#### WordPress - wpNotifyStoreToken
- Used for storing an FCM token
``` dart
WPStoreTokenResponse wpStoreTokenResponse;
try {
wpStoreTokenResponse = WPNotifyAPI.instance.api((request) => request.wpNotifyStoreToken(token: token, userId: usersId));
} on Exception catch (e) {
print(e);
}
```
#### WordPress - Updating a tokens status (e.g. if you want to turn off notifications)
- Used for updating the status of an FCM token
``` dart
WPUpdateTokenResponse wpUpdateTokenResponse;
try {
wpUpdateTokenResponse = WPNotifyAPI.instance.api((request) => request.wpNotifyUpdateToken(token: token, status: true));
} on Exception catch (e) {
print(e);
}
```
For help getting started with WooSignal, view our
[online documentation](https://woosignal.com/docs/flutter/wp-notify), which offers a more detailed guide.
## Usage
To use this plugin, add `wp_notify` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins).
## Note
Install WordPress plugin "WP Notify" 2.0.x or later for version 2.0.0
Disclaimer: This plugin is not affiliated with or supported by Automattic, Inc. All logos and trademarks are the property of their respective owners.