@frontegg/client
Advanced tools
Comparing version 1.0.41-1 to 1.0.41-2
@@ -17,4 +17,4 @@ export declare class NotificationsClient { | ||
body?: string; | ||
url?: string; | ||
severity?: string; | ||
url?: string; | ||
actions?: INotificationAction[]; | ||
@@ -21,0 +21,0 @@ expiryDate?: Date; |
{ | ||
"name": "@frontegg/client", | ||
"version": "1.0.41-1", | ||
"version": "1.0.41-2", | ||
"description": "Frontegg Javascript Library for backend", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -124,2 +124,38 @@ # Frontegg Client | ||
``` | ||
### Notifications | ||
Allow your customers to be aware of any important business related event they need to pay attention to, both in the dashboard and even when offline. | ||
Frontegg’s Managed Notifications feature allows a SaaS company to embed an end-to-end working feature in just 5 lines of code. | ||
#### Sending notifications | ||
```javascript | ||
import { NotificationsClient } from '@frontegg/client' | ||
const notificationsClient = new NotificationsClient(); | ||
// First initialize the module | ||
await notificationsClient.init('YOUR-CLIENT-ID', 'YOUR-API-KEY'); | ||
// Set the notification you want to send | ||
const notification = { | ||
"title": "Notification Title", | ||
"body": "Notification Body", | ||
"severity": "info", | ||
"url": "example.com" // url to be opened when user clicks on the notification | ||
} | ||
// send the notification to a specific user | ||
await notificationsClient.sendToUser('RECEPIENT-USER-ID', 'RECEPIENT-TENANT-ID', notification) | ||
// send the notification to all tenant users | ||
await notificationsClient.sendToTenantUsers('RECEPIENT-TENANT-ID', notification) | ||
// send the notification to all users | ||
await notificationsClient.sendToAllUsers(notification) | ||
``` |
68756
160