cuoral-ionic 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -240,6 +240,65 @@ async login(email: string, firstName: string, lastName: string) {
|
|
|
240
240
|
- Create a new Cuoral instance for each user login
|
|
241
241
|
- Email, first name, and last name are all required for identified users
|
|
242
242
|
|
|
243
|
+
## Push Notifications
|
|
244
|
+
|
|
245
|
+
Cuoral integrates seamlessly with your existing push notification system using webhooks. When an agent sends a message, Cuoral sends a webhook to your backend, allowing you to send push notifications to users when the widget is closed.
|
|
246
|
+
|
|
247
|
+
**How it works:**
|
|
248
|
+
|
|
249
|
+
1. **Track widget state** in your app (open/closed)
|
|
250
|
+
2. **Configure webhooks** in your Cuoral dashboard
|
|
251
|
+
3. **Receive webhook** when agent sends message
|
|
252
|
+
4. **Send FCM/APNs push** if widget is closed
|
|
253
|
+
|
|
254
|
+
**Example Implementation:**
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
export class MyApp {
|
|
258
|
+
private isCuoralWidgetOpen = false;
|
|
259
|
+
|
|
260
|
+
// When user opens support
|
|
261
|
+
openSupport() {
|
|
262
|
+
this.isCuoralWidgetOpen = true;
|
|
263
|
+
this.cuoral.openModal();
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// When user closes support
|
|
267
|
+
closeSupport() {
|
|
268
|
+
this.isCuoralWidgetOpen = false;
|
|
269
|
+
this.cuoral.closeModal();
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Handle incoming push notifications (your existing FCM handler)
|
|
273
|
+
async handlePushNotification(message: any) {
|
|
274
|
+
if (message.data.type === 'cuoral_message') {
|
|
275
|
+
// Don't show notification if widget is already open
|
|
276
|
+
if (this.isCuoralWidgetOpen) {
|
|
277
|
+
return; // User already sees the message
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Show notification to user
|
|
281
|
+
await this.showNotification({
|
|
282
|
+
title: 'New message from Support',
|
|
283
|
+
body: message.data.text,
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
// When user taps notification, open widget
|
|
287
|
+
this.openSupport();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**Setup:**
|
|
294
|
+
|
|
295
|
+
1. Configure your webhook URL in Cuoral Dashboard → Settings → Webhooks
|
|
296
|
+
2. Cuoral sends webhooks for all new messages
|
|
297
|
+
3. Your backend decides whether to send push based on your app's state
|
|
298
|
+
4. User taps notification → your app calls `cuoral.openModal()`
|
|
299
|
+
|
|
300
|
+
This approach works with your existing FCM/APNs setup - no additional SDK configuration needed!
|
|
301
|
+
|
|
243
302
|
## Configuration
|
|
244
303
|
|
|
245
304
|
### CuoralOptions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cuoral-ionic",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Cuoral Ionic Framework Library - Proactive customer success platform with support ticketing, customer intelligence, screen recording, and engagement tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|