Customer Engagement
Learn to integrate Netcore CE Cordova SDK for customer engagement
The Customer Engagement functionality in the Cordova SDK helps app developers connect better with their users. It enables easy integration of push notifications and in-app messages, allowing developers to send targeted, and personalized communication. You can optimize user engagement, increase conversions, and build user loyalty. Customise messages based on user behavior to deliver timely and relevant content.
For detailed instructions on each step, refer to the following:
- Install Smartech Push Cordova
- Integrate Android SDK/iOS SDK
- Initialize the Smartech Push Cordova SDK
- Retrieve Deeplink Data
- Add Listener for Notification Received
Install Smartech Push Cordova
Install Netcore CE Cordova Smartech Push plugin by running below command from your project directory.
cordova plugin add smartech-push-cordova --save
For Android SDK
Refer to Android Customer Engagement steps to integrate the push notifications and In-App messages for Android platform.
- Define Latest SDK version: Add the version line to your
gradle.properties
.
// Version of smartech push SDK to use with Cordova
SMARTECH_PUSH_SDK_VERSION=<<push_sdk_android_version>>
- Integrate the latest Netcore CE SDK: Make the following changes in the app-level build.gradle.
api "com.netcore.android:smartech-push:${SMARTECH_PUSH_SDK_VERSION}"
For iOS SDK
Refer to iOS Customer Engagement for steps on integrating Push notifications and In-app messages on the iOS platform.
Import the Smartech SDK to make the following changes at the app level.
#import <Smartech/Smartech.h>
#import <SmartPush/SmartPush.h>
#import <UserNotifications/UserNotifications.h>
#import <UserNotificationsUI/UserNotificationsUI.h>
#import Smartech
#import SmartPush
#import UserNotifications
#import UserNotificationsUI
Implement the Smartech Delegate Method
#pragma mark - Smartech Delegate
- (void)handleDeeplinkActionWithURLString:(NSString *)deeplinkURLString andNotificationPayload:(NSDictionary *_Nullable)notificationPayload {
NSString *notificationIdentifier = @"SmartechDeeplinkNotification";
// Post a notification with the specified name and userInfo
[[NSNotificationCenter defaultCenter] postNotificationName:notificationIdentifier object:nil userInfo:notificationPayload];
}
// MARK: - Smartech Delegate Methods
func handleDeeplinkAction(withURLString deeplinkURLString: String, andNotificationPayload notificationPayload: [AnyHashable : Any]?) {
let notificationIdentifier = "SmartechDeeplinkNotification"
NotificationCenter.default.post(name: Notification.Name(rawValue: notificationIdentifier), object: nil, userInfo: notificationPayload)
}
Initialize the SDK
You need to initialize the Smartech Push Cordova SDK to the Netcore CE React Native library in your JavaScript file.
const SmartechPushCordova = window.pugins.SmartechPushCordova;
Retrieve Deeplink Data
You can provide the deep link value and the custom payload when a push notification is clicked.
const smartechBaseCordova = window.plugins.smartechBaseCordova;
const handleDeeplinkWithPayload = (smartechData) => {
console.log('Smartech Data :: ', smartechData);
console.log('Smartech Deeplink :: ', smartechData.smtDeeplink);
console.log('Smartech CustomPayload:: ', smartechData.smtCustomPayload);
};
// Deeplink callback for Push Notification, In-App message and App Inbox
smartechBaseCordova.addListener(smartechBaseCordova.SmartechDeeplink, handleDeeplinkWithPayload);
//Remove this listener on cleanup
smartechBaseCordova.removeListener(smartechBaseCordova.SmartechDeeplink);
Add Listener for Notification Received
You can provide the push notification payload that was received from Netcore CE.
const smartechPushCordova = window.plugins.SmartechPushCordova;
const handleNotificationReceived = (smartechData) => {
console.log('Smartech Data :: ', JSON.stringify(smartechData));
};
// Adding the Smartech Deeplink Notification received Listener
smartechPushCordova.addListener(smartechPushCordova.SmartechNotificationReceived, handleNotificationReceived);
//Remove this listener on cleanup
smartechPushCordova.removeListener(smartechPushCordova.SmartechNotificationReceived, handleNotificationReceived);
Updated about 1 month ago