Desk360 Docs
Search…
React Native SDK
Desk360 React Native SDK helps you embedding customer support in your React Native mobile applications with ease.

Features

  • Turn all your customer support requests into tickets and interact with these messages using our powerful platform.
  • React Native SDK has highly customizable and flexible UI options.
  • Push notifications and deep linking support options are both available.
  • Give multilingual support for your customers: It supports 40+ languages.
  • React Native SDK supports different types of media and file formats.
  • It's easy to use and integrate. After writing only a few lines of code, you're ready to use!

Getting started

$ npm install Teknasyon-Teknoloji/desk360-react-native-sdk#1.0.0 --save
React Native 0.59 and below
Run $ react-native link react-native-desk360rn to link the library.

Installation Notes

  • IOS
  • Set ios version to 10.0 or higher in ios/Podfile like: platform :ios, '10.0'
  • Remove flipper from ios/Podfile if exists.
  • Add use_frameworks!for your target
  • Run $ cd ios && pod install
  • ANDROID
  • Set minSdkVersion to 21 or higher in android/build.gradle
  • Add maven { url 'https://jitpack.io/' } into android/build.gradle (Add into repositories under allprojects)
  • Make sure your min gradle version is "3.6.4" or higher in android/build.gradle. (Check troubleshooting section to see example)
Add Data and View Binding enable script
1
apply plugin: 'kotlin-kapt'
2
​
3
4
​
5
android {
6
​
7
buildFeatures {
8
​
9
dataBinding true
10
​
11
}
12
​
13
}
Copied!

Usage

Let's start

  • On application start you need to initialize sdk with api key and environment. Start Desk360 with appId -and an optinal deviceId, an optional language-
Note: If no deviceId is provided, Desk360 will use device's UUID, which might cause your app to lose tickets when the application is deleted. If use environment type .production, Desk360 will look at prod url. If no application language is provided, Desk360 will use device's language.
1
import RNDesk360, { Desk360Platform, Desk360Environment } from 'react-native-desk360rn';
2
​
3
RNDesk360.getInstance().initialize({
4
"appID": "APP KEY",
5
"deviceID": "DEVICE ID",
6
"appVersion": "1.0.0",
7
"languageCode": 'en',
8
"environment": Desk360Environment.SANDBOX,
9
"platform": Desk360Platform.GOOGLE,
10
"countryCode": 'tr',
11
"bypassCreateTicketIntro":true,
12
"name": "Username (ticket ownner)",
13
"jsonInfo":{
14
"key":"value"
15
}
16
});
17
​
18
RNDesk360.getInstance().start(); // shows Desk360
Copied!

Important footnot

You must add your info.plist file.
1
<key>NSPhotoLibraryUsageDescription</key>
2
​
3
<string>Allow the app to access your photos.</string>
Copied!
Permission text is optional. you can type whatever you want. But this permission not optional. If you didn't add this permission. Desk360 Images attachment property doesn't work.

Using Optional Notification System

If you need to send a notification when a message is sent to the users. You have to do this integration in ios.
1
import Desk360
2
​
3
4
​
5
@UIApplicationMain
6
​
7
final class AppDelegate: UIResponder, UIApplicationDelegate {
8
​
9
10
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
11
12
Desk360.setPushToken(deviceToken: deviceToken)
13
14
}
15
​
16
}
Copied!
After the above integration, it is sufficient to make the notification certificate settings in the Desk360 admin panel. You can now use notifications
Also if you want notification redirect deeplink system. You should some extra integration.
1
import Desk360
2
​
3
4
​
5
@UIApplicationMain
6
​
7
final class AppDelegate: UIResponder, UIApplicationDelegate {
8
​
9
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
10
​
11
Desk360.applicationLaunchChecker(launchOptions)
12
​
13
if #available(iOS 10.0, *) {
14
​
15
let center = UNUserNotificationCenter.current()
16
​
17
center.delegate = self
18
​
19
}
20
​
21
return true
22
​
23
}
24
​
25
}
26
​
27
28
29
​
30
// MARK: - UNUserNotificationCenterDelegate
31
​
32
extension AppDelegate: UNUserNotificationCenterDelegate {
33
​
34
35
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
36
​
37
completionHandler([.alert])
38
​
39
Desk360.willNotificationPresent(notification.request.content.userInfo)
40
​
41
}
42
​
43
44
​
45
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
46
​
47
Desk360.applicationUserInfoChecker(userInfo)
48
​
49
}
50
​
51
@available(iOS 10.0, *)
52
​
53
public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
54
​
55
Desk360.applicationUserInfoChecker(response.notification.request.content.userInfo)
56
​
57
}
58
​
59
}
60
​
61
Copied!
When you click on the notification when your application is closed, you need to add this code on which page you want Des360 to open.
1
...
2
​
3
RNDesk360.getInstance().showWithPushDeeplink();
4
​
5
...
6
​
7
Copied!

Getting the unread tickets

If you would like to get a list of the unread tickets you can do so like follows:
1
RNDesk360.getInstance().getUnreadTickets().then( (results) {
2
​
3
print(results);
4
​
5
});
6
​
7
Copied!
You can show the unread tickets the way that fits your app design and expierence. If you want to navigate to a specific ticket
detail you can do so so by following:
1
RNDesk360.getInstance().ticketDetailsViewController(unreadTicket);
2
​
3
Copied!

Support

For further information, please with contact us [email protected]​
​
Visit our GITHUB page for usage, technical setup and detailed info.