Customer Engagement
Learn to integrate Netcore CE Ionic SDK for customer engagement
The Customer Engagement functionality in the Ionic SDK helps app developers better connect 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 Ionic
- Integrate Android SDK/iOS SDK
- Initialize the Smartech Push Ionic SDK
- Retrieve Deeplink Data
- Add Listener for Notification Received
Install Smartech Push Ionic
Install the Netcore CE Ionic Smartech Push plugin by running the below command from your project directory.
npm install 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 Ionic
SMARTECH_PUSH_SDK_VERSION=<<push_sdk_android_version>>
- Integrate the latest CEE 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 in 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 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 Ionic SDK to the Netcore CE React Native library in your JavaScript file.
import SmartechPushCordova from 'smartech-push-cordova';
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 which is 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 2 months ago