const CleverTap = require ( 'clevertap-react-native' ) ;
Update User Profile(Push Profile)
CleverTap . profileSet ( { "Identity" :11102008 , "Name" :"React-Test Profile" , "Email" :"[email protected] " , "Gender" :"Male" , "DOB" :"1995-10-14" , "custom" :1.73 } ) ;
CleverTap . profileSetMultiValuesForKey ( [ 'a' , 'b' , 'c' ] , 'letters' ) ;
Remove Multi Value For Key
CleverTap . profileRemoveMultiValueForKey ( 'b' , 'letters' ) ;
CleverTap . profileAddMultiValueForKey ( 'd' , 'letters' ) ;
Create a User profile when user logs in (On User Login)
CleverTap . onUserLogin ( { 'Name' : 'React-Test' , 'Identity' : '11102008' , 'Email' : '[email protected] ' , 'custom1' : 43 } ) ;
Get CleverTap Reference id
CleverTap . profileGetCleverTapID ( ( err , res ) => {
console . log ( 'CleverTapID' , res , err ) ;
} ) ;
Set Location to User Profile
CleverTap . setLocation ( 34.15 , - 118.20 ) ;
Increment a User Profile property
CleverTap . profileIncrementValueForKey ( 1 , "score" ) ;
Decrement a User Profile property
CleverTap . profileDecrementValueForKey ( 1 , "score" ) ;
CleverTap . recordEvent ( 'testEvent' ) ;
CleverTap . recordChargedEvent ( { 'totalValue' : 20 , 'category' : 'books' } , [ { 'title' : 'book1' } , { 'title' : 'book2' } , { 'title' : 'book3' } ] ) ;
Initialize the CleverTap App Inbox Method
CleverTap . initializeInbox ( ) ;
CleverTap . showInbox ( { 'tabs' :[ 'Offers' , 'Promotions' ] , 'navBarTitle' :'My App Inbox' , 'navBarTitleColor' :'#FF0000' , 'navBarColor' :'#FFFFFF' , 'inboxBackgroundColor' :'#AED6F1' , 'backButtonColor' :'#00FF00'
, 'unselectedTabColor' :'#0000FF' , 'selectedTabColor' :'#FF0000' , 'selectedTabIndicatorColor' :'#000000' ,
'noMessageText' :'No message(s)' , 'noMessageTextColor' :'#FF0000' } ) ;
CleverTap . getInboxMessageCount ( ( err , res ) => {
console . log ( 'Total Messages: ' , res , err ) ;
} ) ;
CleverTap . getInboxMessageUnreadCount ( ( err , res ) => {
console . log ( 'Unread Messages: ' , res , err ) ;
} ) ;
CleverTap . getAllInboxMessages ( ( err , res ) => {
console . log ( 'All Inbox Messages: ' , res , err ) ;
} ) ;
Get all Inbox unread messages
CleverTap . getUnreadInboxMessages ( ( err , res ) => {
console . log ( 'Unread Inbox Messages: ' , res , err ) ;
} ) ;
CleverTap . getInboxMessageForId ( 'Message Id' , ( err , res ) => {
console . log ( "marking message read = " + res ) ;
} ) ;
CleverTap . deleteInboxMessageForId ( 'Message Id' ) ;
Mark a message as Read for inbox Id
CleverTap . markReadInboxMessageForId ( 'Message Id' ) ;
pushInbox Notification Viewed Event For Id
CleverTap . pushInboxNotificationViewedEventForId ( 'Message Id' ) ;
push Inbox Notification Clicked Event For Id
CleverTap . pushInboxNotificationClickedEventForId ( 'Message Id' ) ;
Creating Notification Channel
CleverTap . createNotificationChannel ( "CtRNS" , "Clever Tap React Native Testing" , "CT React Native Testing" , 1 , true ) ;
Delete Notification Channel
CleverTap . deleteNotificationChannel ( "RNTesting" ) ;
Creating a group notification channel
CleverTap . createNotificationChannelGroup ( String groupId , String groupName ) ;
Delete a group notification channel
CleverTap . deleteNotificationChannelGroup ( String groupId ) ;
CleverTap . setPushToken ( "<Replace with FCM Token value>" , CleverTap . FCM ) ;
CleverTap . getDisplayUnitForId ( 'Unit Id' , ( err , res ) => {
console . log ( 'Get Display Unit for Id:' , res , err ) ;
} ) ;
CleverTap . getAllDisplayUnits ( ( err , res ) => {
console . log ( 'All Display Units: ' , res , err ) ;
} ) ;
Set Product Configuration to default
CleverTap . setDefaultsMap ( { 'text_color' : 'red' , 'msg_count' : 100 , 'price' : 100.50 , 'is_shown' : true , 'json' : '{"key":"val"}' } ) ;
Activate the most recently fetched product config
Fetch And Activate product config
CleverTap . fetchAndActivate ( ) ;
Fetch Minimum Time Interval
CleverTap . fetchWithMinimumIntervalInSeconds ( 60 ) ;
Set Minimum Time Interval for Fetch
CleverTap . setMinimumFetchIntervalInSeconds ( 60 ) ;
CleverTap . getProductConfigBoolean ( 'is_shown' , ( err , res ) => {
console . log ( 'PC is_shown val in boolean :' , res , err ) ;
} ) ;
CleverTap . getNumber ( 'msg_count' , ( err , res ) => {
console . log ( 'PC is_shown val in number(long) :' , res , err ) ;
} ) ;
CleverTap . getNumber ( 'price' , ( err , res ) => {
console . log ( 'PC price val in number :' , res , err ) ;
} ) ;
CleverTap . getProductConfigString ( 'text_color' , ( err , res ) => {
console . log ( 'PC text_color val in string :' , res , err ) ;
} ) ;
CleverTap . getProductConfigString ( 'json' , ( err , res ) => {
console . log ( 'PC json val in string :' , res , err ) ;
} ) ;
Delete all activated, fetched and defaults configs
CleverTap . resetProductConfig ( ) ;
Get last fetched timestamp in millis
CleverTap . getLastFetchTimeStampInMillis ( ( err , res ) => {
console . log ( 'LastFetchTimeStampInMillis in string: ' , res , err ) ;
} ) ;
CleverTap . getFeatureFlag ( 'is_dark_mode' , false , ( err , res ) => {
console . log ( 'FF is_dark_mode val in boolean :' , res , err ) ;
} ) ;
CleverTap . getCleverTapID ( ( err , res ) => {
console . log ( 'CleverTapID' , res , err ) ;
} ) ;
CleverTap . enablePersonalization ( ) ;
CleverTap . disablePersonalization ( ) ;
CleverTap . profileGetProperty ( 'Name' , ( err , res ) => {
console . log ( 'CleverTap Profile Name: ' , res , err ) ;
} ) ;
CleverTap . setDebugLevel ( 3 ) ;
Get CleverTap Attribution Identifier
CleverTap . profileGetCleverTapAttributionIdentifier ( ( err , res ) => {
console . log ( 'CleverTapAttributionIdentifier' , res , err ) ;
} ) ;
InApp Notification Controls
Suspend InApp Notifications
CleverTap . suspendInAppNotifications ( ) ;
Discard InApp Notifications
CleverTap . discardInAppNotifications ( ) ;
Resume InApp Notifications
CleverTap . resumeInAppNotifications ( ) ;