Epoisses (latest)

🆕 🚨 What's new?

This release brings a few changes to help better debug SDK error management and debugging.

1️⃣ Debug Info

This releases adds a new debugInfo API that returns the status of the SDK at any given moment. This API can be used for debugging purposes, providing you with a JSON string output that you can easily add to your log reporting tool payload. More info in the dedicated section.

2️⃣ Targeting failure callback

This release also adds a callback to notify the integrator when there are targeting rule trigger failures. This callback will be called when the targeting rule fails and also give the reason of the failure when it is known.

Please note that triggering a targeting rule may fail for standard reasons, for instance if there is no agent available to answer. In those cases this callback would not be called. You would be informed via the traditional availability update callback (sending a false value in this case).

interface TargetingListener {
    fun onActiveTargetingRuleAvailabilityUpdated(isActiveTargetingRuleAvailable: Boolean)

    fun onActiveTargetingRuleAvailabilityUpdateFailed(error: IAdvizeSDK.Error)
}

⚠️ To integrate this update you will have to update your code to add this new callback.

3️⃣ Error encapsulation

On Android, all the iAdvize Messenger SDK are now part of a generic IAdvizeSDK.Error object. This type now replaces the argument of the failure method in all the IAdvizeSDK.Callback that are used widely across the SDK APIs as an asynchronous return callback.

⚠️ To integrate this update you will have to update your code wherever you use an IAdvizeSDK.Callback. This has no impact on the iOS and Flutter SDKs, but the React Native SDK must change its initiate method (in the Android code).

object : IAdvizeSDK.Callback {
  override fun onSuccess() {
    // Success
  }
  
  override fun onFailure(t: Throwable) {
    // Error
  }
}

becomes

object : IAdvizeSDK.Callback {
  override fun onSuccess() {
    // Success
  }
  
  override fun onFailure(error: IAdvizeSDK.Error) {
    // Error
  }
}

⚙️ Prerequisites

There are a few steps required before you start integrating the iAdvize Messenger SDK.

💬 Setting up your iAdvize environment

Before integrating the SDK, you need to check that your iAdvize environment is ready to use (i.e. you have an account ready to receive and answer to conversations from the SDK). You will also need some information related to the project for the SDK setup. Please ask your iAdvize administrator to follow the instructions available on the SDK Knowledge Base and to provide you with the Project Identifier as well as a Targeting Rule Identifier.

Your iAdvize administrator should already have configured the project on the iAdvize Administration Desk and created an operator account for you. If it is not yet the case please contact your iAdvize Technical Project Manager.

💻 Connecting to your iAdvize Operator Desk

Using your operator account please log into the iAdvize Desk.

If you have the Administrator status in addition to your operator account, you will be directed to the Admin Desk when logging in. Just click on the Chat button in the upper right corner to open the Operator Desk.

The iAdvize operator desk is the place where the conversations that are assigned to your account will pop up. Please ensure that your status is “Available" by enabling the corresponding chat or video toggle buttons in the upper right corner:

If the toggle button is yellow, it means you have reached your maximum simultaneous chat slots, please end your current conversations to free a chat slot and allow the conversations to be assigned to you. If the toggle is red you are not available to chat.

🔐 Ensuring the SDK integrity

Before downloading the iAdvize Messenger SDK artifacts you can verify their integrity by generating their checksums and comparing them with the reference checksums available.

Reference checksums are available:

The Android SDK consists of an archive (aar file) and a Maven project description (pom file), you can generate their checksums using the following commands (replace x.y.z by the SDK version you are checking):

curl -sL https://github.com/iadvize/iadvize-android-sdk/raw/master/com/iadvize/iadvize-sdk/x.y.z/iadvize-sdk-x.y.z.aar | openssl sha256

curl -sL https://github.com/iadvize/iadvize-android-sdk/raw/master/com/iadvize/iadvize-sdk/x.y.z/iadvize-sdk-x.y.z.pom | openssl sha256

This ensures that the online packages are valid. In order to check those checksums on the fly, this process can be automated via Gradle by adding a metadata verification xml file at $PROJECT_ROOT/gradle/verification-metadata.xml:

<?xml version="1.0" encoding="UTF-8"?>
<verification-metadata ...>
   <configuration>
      <verify-metadata>true</verify-metadata>
      <verify-signatures>false</verify-signatures>
   </configuration>
   <components>
      <component group="com.iadvize" name="iadvize-sdk" version="x.y.z">
         <artifact name="iadvize-sdk-2.8.2.aar">
            <sha256 value="checksum value" origin="iAdvize website" />
         </artifact>
         <artifact name="iadvize-sdk-x.y.z.pom">
            <sha256 value="checksum value "origin="iAdvize website" />
         </artifact>
      </component>
   </components>
</verification-metadata>

With this file present in your project structure, Gradle will automatically check the artifacts checksums before integrating them into your app. Please note that you will have to do this for all dependencies used in your project. To help you with that, verification-metadata.xml for the SDK sub-dependencies is delivered alongside the SDK. Those subdependencies checksums have been generated through the Gradle generation feature and not verified.

⚙️ Setting up the SDK

1️⃣ Setting up the SDK into your project configuration

First of all, to be able to use the SDK you need to add the SDK dependency into your project. Some configuration steps will also be needed in order to use it.

Add the iAdvize repository to your project repositories inside your top-level Gradle build file:

// Project-level build.gradle.kts

allprojects {
  repositories {
    maven(url = uri("https://raw.github.com/iadvize/iadvize-android-sdk/master"))
    maven(url = uri("https://jitpack.io"))
  }
}

Add the iAdvize Messenger SDK dependency inside your module-level Gradle build file (replace x.y.z by the latest SDK version available):

// Module-level build.gradle.kts

configurations {
  all {
    exclude(group = "xpp3", module = "xpp3")
  }
}

dependencies {
  implementation("com.iadvize:iadvize-sdk:x.y.z")
}

The exclude configuration is required because the iAdvize Messenger SDK uses Smack, an XMPP library that is built upon xpp3, which is bundled by default in the Android framework. This exclude ensures that your app does not also bundle xpp3 to avoid classes duplication errors.

In that same file, you also need to ensure that you are using the right Android target to build (iAdvize Messenger SDK is built with Android target 33):

// Module-level build.gradle.kts

android {
  buildToolsVersion "33.0.1"

  defaultConfig {
    minSdk = 21
    targetSdk = 33
    compileSdk = 33
  }
}

iAdvize Messenger SDK requires a minSdkVersion >= 21.

After syncing your project you should be able to import the iAdvize dependency in your application code with import com.iadvize.conversation.sdk.IAdvizeSDK

You will then need to provide a reference to your application object and initialize the SDK with it.

In your AndroidManifest.xml declare your application class:

<application android:name="my.app.package.App">
  <!-- your activities etc... -->
</application>

This class should then initialize the SDK:

package my.app.package.App

class App : Application() {
  override fun onCreate() {
    super.onCreate()
    IAdvizeSDK.initiate(this)
  }
}

⌨️ In-context example:

The SDK supports video conversations using a third-party native (C++) binaries. If you are delivering your app using an APK you will note a size increase as the default behavior of the build system is to include the binaries for each ABI in a single APK. We strongly recommended that you take advantage of either App Bundles or APK Splits to reduce the size of your APKs while still maintaining maximum device compatibility.

2️⃣ Activating the SDK

Now that the SDK is available into your project build, let's integrate it into your app, first by activating it. Activation is the step that logs a user into the iAdvize flow.

You can choose between multiple authentication options:

Anonymous

For an unidentified user browsing your app.

Simple

For a logged in user in your app. You must pass a unique string identifier so that the visitor will retrieve his conversation history across multiple devices and platforms. The identifier that you pass must be unique and non-discoverable for each different logged-in user.

Secured

Use it in conjunction with your in-house authentication system. You must pass a JWE provider callback that will be called when an authentication is required, you will then have to call your third party authentication system for a valid JWE to provide to the SDK. For a full understanding of how the secured authentication works in the iAdvize platform you can refer to this section.

To activate the SDK you must use the activate function with your projectId (see the Prerequisites section above to get that identifier). You have access to callbacks in order to know if the SDK has been successfully activated. In case of an SDK activation failure the callback will give you the reason of the failure and you may want to retry later.

IAdvizeSDK.activate(
  projectId = projectId,
  authenticationOption = authOption,
  gdprOption = gdprOption,
  callback = object : IAdvizeSDK.Callback {
    override fun onSuccess() {
      Log.d("iAdvize SDK", "The SDK has been activated.")
    }
    override fun onFailure(error: IAdvizeSDK.Error) {
      Log.e("iAdvize SDK", "The SDK activation failed with:", error)
    }
  }
)

⌨️ In-context example: SDK Activation

Once the iAdvize Messenger SDK is successfully activated, you should see a success message in the console:

✅ iAdvize conversation activated, the version is x.y.z

3️⃣ Logging the user out

You will have to explicitly call the logout function of the iAdvize Messenger SDK when the user sign out of your app.

IAdvizeSDK.logout()

4️⃣ Displaying logs

To have more information on what’s happening on the SDK side you can change the log level.

// VERBOSE, INFO, WARNING, ERROR, NONE
// Default is WARNING
IAdvizeSDK.logLevel = Logger.Level.VERBOSE

You can get a description of the SDK status at any time by using the debugInfo API:

IAdvizeSDK.debugInfo()

This will generate a JSON object with the SDK status information, encoded into a string that you can easily add into your bug reporting tool payload:

{
  "targeting": {
    "screenId": "67BA3181-EBE2-4F05-B4F3-ECB07A62FA92",
    "activeTargetingRule": {
      "id": "D8821AD6-E0A2-4CB9-BF45-B2D8A3CF4F8D",
      "conversationChannel": "chat"
    },
    "isActiveTargetingRuleAvailable": false,
    "currentLanguage": "en"
  },
  "device": {
    "model": "iPhone",
    "osVersion": "17.5",
    "os": "iOS"
  },
  "ongoingConversation": {
    "conversationChannel": "chat",
    "conversationId": "02012815-4BDA-42EF-87DC-5C6ED317AF7F"
  },
  "chatbox": {
    "useDefaultFloatingButton": true,
    "isChatboxPresented": false
  },
  "activation": {
    "activationStatus": "activated",
    "authenticationMode": "simple",
    "projectId": "7260"
  },
  "connectivity": {
    "wifi": true,
    "isReachable": true,
    "cellular": false
  },
  "visitor": {
    "vuid": "d4a57969c7fc4e2a9380f3931fdcee3a965650eb9c6b4",
    "tokenExpiration": "2025-02-27T08:14:11Z"
  },
  "sdkVersion": "2.15.4"
}

💬 Starting a conversation

To be able to start a conversation you will first have to trigger a targeting rule in order for the default chat button to be displayed. The Chatbox will then be accessible by clicking on that chat button.

1️⃣ Configuring the targeting language

The targeting rule configured in the iAdvize Administration Panel is setup for a given language. This means that if, for example, you setup a targeting rule to be triggered only for EN language and the current user’s device is setup with a different targeting language (for instance FR), the targeting rule will not trigger.

By default, the targeting rule language used is the user’s device current language. You can force the targeting language to a specific value using:

IAdvizeSDK.targetingController.language = LanguageOption.Custom(Language.FR)

This language property is NOT intended to change the language displayed in the SDK. It is solely used for the targeting process purpose.

2️⃣ Activating a targeting rule

Using a targeting rule UUID (see the Prerequisites section above to get that identifier), you can engage a user by calling:

IAdvizeSDK.targetingController.activateTargetingRule(
  TargetingRule(
    targetingRuleUUID,
    ConversationChannel.CHAT // or ConversationChannel.VIDEO
  )
)

⌨️ In-context example: Targeting rule activation

If all the following conditions are met, the default chat button should appear:

  • the targeting rule exists and is enabled in the administration panel

  • the targeting rule language set in the SDK matches the language configured for this rule

  • an operator assigned to this rule is available to answer (connected and with a free chat slot)

After you activate a rule and it succeeds (by displaying the button), those conditions are checked every 30 seconds to verify that the button should still be displayed or not.

Upon the first encountered failure from this periodic check, the button is hidden and the SDK stops verifying the conditions. It means that if the rule cannot be triggered (after the first call, or after any successive check), you will have to call the activateTargetingRule (or registerUserNavigation) method again in order to restart the engagement process.

3️⃣ Initiating the conversation

Once the default chat button is displayed, the visitor tap on it to access the Chatbox. After composing and sending a message a new conversation should pop up in the operator desk.

Chat button is displayed. Visitor composes a message & send it.
Conversation appears in the operator desk

4️⃣ Following user navigation

While your user navigates through your app, you will have to update the active targeting rule in order to engage him/her with the best conversation partner at any time. In order to so, the SDK provides you with multiple navigation options to customize the behavior according to your needs:

// To clear the active targeting rule and thus stopping the engagement process (this is the default behavior)
val navOption = NavigationOption.ClearActiveRule

// To keep/start the engagement process with the same active targeting rule in the new user screen
val navOption = NavigationOption.KeepActiveRule

// To keep/start the engagement process but with another targeting rule for this screen
val navOption = NavigationOption.ActivateNewRule(newRule)

// Register the user navigation through your app
IAdvizeSDK.targetingController.registerUserNavigation(navOption)

Please note that calling registerUserNavigation with the CLEAR NavigationOption will stop the engagement process, and calling it with other options will start it if it is stopped.

👋 Configuring GDPR and welcome message

1️⃣ Adding a welcome message

As seen above, the Chatbox is empty by default. You can configure a welcome message that will be displayed to the visitor when no conversation is ongoing.

val configuration = ChatboxConfiguration()
configuration.automaticMessage = "Any question? Say Hello to Smart and we will answer you as soon as possible! 😊"
IAdvizeSDK.chatboxController.setupChatbox(configuration)

⌨️ In-context example: Welcome message

When no conversation is ongoing, the welcome message is displayed to the visitor:

When no conversation is ongoing, the welcome message is displayed to the visitor

2️⃣ Enabling GDPR approval

If you need to get the visitor consent on GDPR before he starts chatting, you can pass a GDPROption while activating the SDK. By default this option is set to Disabled.

If enabled, a message will request the visitor approval before allowing him to send a message to start the conversation:

GDPR approval request

This GDPR option dictates how the SDK behaves when the user taps on the More information button. You can either:

  • provide an URL pointing to your GPDR policy, it will be opened on user click

  • provide a listener/delegate that will be called on user click and you can then implement your own custom behavior

If your visitors have already consented to GDPR inside your application, you can activate the iAdvize SDK without the GDPR process. However, be careful to explicitly mention the iAdvize Chat part in your GDPR consent details.

// Disabled
val gdprOption = GDPROption.Disabled

// URL
val gdprOption = GDPROption.Enabled(GDPREnabledOption.LegalUrl(URI.create("http://my.gdpr.rules.com")))

// Listener
val gdprOption = GDPROption.Enabled(GDPREnabledOption.Listener(object : GDPRListener {
  override fun didTapMoreInformation() {
    // Implement your own logic
  }
}))
val configuration = ChatboxConfiguration()
configuration.automaticMessage = "Any question? Say Hello to Smart and we will answer you as soon as possible! 😊"
configuration.gdprMessage = "Your own GDPR message."
IAdvizeSDK.chatboxController.setupChatbox(configuration)

⌨️ In-context example:

🎨 Branding the Chatbox

The ChatboxConfiguration object that we used in the previous section to customize the welcome and GDPR messages can also be used to change the Chatbox UI to better fit into the look and feel of your application.

You should setup the configuration before presenting the chatbox. If you call this method while the chatbox is visible, some parameters will only apply for new messages or after closing/reopening the chatbox.

1️⃣ Updating the font

The font used in the Chatbox can easily be updated using your own font:

val configuration = ChatboxConfiguration()
configuration.fontPath = "fonts/comic_sans_ms_regular.ttf"
IAdvizeSDK.chatboxController.setupChatbox(configuration)

The font should be placed inside the assets folder. Here the file is located at src/main/assets/fonts/comic_sans_ms_regular.ttf

2️⃣ Styling the navigation bar

Some parts of the he toolbar/navigationbar appearing at the top of the Chatbox can also be customized:

  • the background color

  • the main color

  • the title

val configuration = ChatboxConfiguration()
configuration.toolbarBackgroundColor = Color.BLACK,
configuration.toolbarMainColor = COLOR.WHITE,
configuration.toolbarTitle = "Conversation"
IAdvizeSDK.chatboxController.setupChatbox(configuration)

3️⃣ Changing the Chatbox colors

The displayed messages colors can be customized, either the ones from the agent (incomingMessages) or the ones from the visitor (outgoingMessages):

  • the message bubble background color

  • the message text color

  • the message bubble stroke/border color

  • the accent color, used for all message controls (same color for both agent & visitor): quick answers, file messages, send button, typing indicator...

val configuration = ChatboxConfiguration()
configuration.incomingMessageBackgroundColor = Color.BLACK
configuration.incomingMessageTextColor = Color.YELLOW
configuration.incomingMessageStrokeColor = Color.YELLOW
configuration.outgoingMessageBackgroundColor = Color.YELLOW
configuration.outgoingMessageTextColor = Color.BLACK
configuration.outgoingMessageStrokeColor = Color.BLACK
configuration.accentColor = Color.MAGENTA
IAdvizeSDK.chatboxController.setupChatbox(configuration)

4️⃣ Using a brand avatar

The operator avatar displayed alongside his messages can be updated for branding purposes. You can specify a drawable either via an URL or a local resource.

val configuration = ChatboxConfiguration()

// Update the incoming message avatar with a Drawable resource.
configuration.incomingMessageAvatar = IncomingMessageAvatar.Image(
  ContextCompat.getDrawable(context, R.drawable.ic_brand_avatar)
)

// Update the incoming message avatar with an URL.
configuration.incomingMessageAvatar = IncomingMessageAvatar.Url(URL("http://avatar.url"))

IAdvizeSDK.chatboxController.setupChatbox(configuration)

GIFs are not supported.

🎨 Branding the Default Floating Button

By default, the SDK uses its own Default Floating Button for the user to engage in the conversation. This Default Floating Button display process is automated by the SDK and works out of the box. You have however limited possibilities to brand it to your needs.

The Default Floating Button can be parametrized, both in its look (colors / icon) and position (anchor / margins) using the appropriate configuration:

val configuration = DefaultFloatingButtonConfiguration(
  anchor = Gravity.START or Gravity.BOTTOM,
  margins = DefaultFloatingButtonMargins(),
  backgroundTint = ContextCompat.getColor(this, R.color.colorPrimary),
  iconResIds = mapOf(
    ConversationChannel.CHAT to R.drawable.chat_icon,
    ConversationChannel.VIDEO to R.drawable.video_icon
  )
  iconTint = Color.WHITE
)
val option = DefaultFloatingButtonOption.Enabled(configuration)
IAdvizeSDK.defaultFloatingButtonController.setupDefaultFloatingButton(option)

⌨️ In-context example: Default Floating Button Configuration

✨ Using a custom chat button

If you are not satisfied with the Default Floating Button look and feel or if you want to implement a specific behavior related to its display you may need to use a custom conversation button.

With a custom button it is your responsibility to:

  • design the floating or fixed button to invite your user to chat

  • hide/show the button following the active targeting rule availability and the ongoing conversation status

  • open the Chatbox when the user presses your button

1️⃣ Disabling the Default Floating Button

IAdvizeSDK.defaultFloatingButtonController.setupDefaultFloatingButton(DefaultFloatingButtonOption.Disabled)

2️⃣ Displaying/hiding the chat button

The chat button is linked to the targeting and conversation workflow and should update its visibility each time the status of those workflows is changed. First of all you need to implement the appropriate callbacks:

IAdvizeSDK.targetingController.listeners.add(object : TargetingListener {
  override fun onActiveTargetingRuleAvailabilityUpdated(isActiveTargetingRuleAvailable: Boolean) {
    // SDK active rule availability changed to isActiveTargetingRuleAvailable
    updateChatButtonVisibility()
  }
  override fun onActiveTargetingRuleAvailabilityUpdateFailed(error: IAdvizeSDK.Error) {
    // SDK active rule availability failed
    updateChatButtonVisibility()

    // You may launch the targeting again based on the error type
  }
})

IAdvizeSDK.conversationController.listeners.add(object : ConversationListener {
  override fun onOngoingConversationUpdated(ongoingConversation: OngoingConversation?) {
    // SDK ongoing conversation has updated
    updateChatButtonVisibility()
  }
  override fun onNewMessageReceived(content: String) {
    // A new message was received via the SDK
  }
  override fun handleClickedUrl(uri: Uri): Boolean {
    // A message link was tapped, return true if you want your app to handle it
    return false
  }
})

The chat button gives access to the Chatbox so it should be visible:

  • at all times when a conversation is ongoing to allow the visitor to come back to the current conversation

  • when the active targeting rule is available, to engage the visitor to chat

fun updateChatButtonVisibility() {
  val sdkActivated = IAdvizeSDK.activationStatus == IAdvizeSDK.ActivationStatus.ACTIVATED
  val chatboxOpened = IAdvizeSDK.chatboxController.isChatboxPresented()
  val ruleAvailable = IAdvizeSDK.targetingController.isActiveTargetingRuleAvailable()
  val hasOngoingConv = IAdvizeSDK.conversationController.ongoingConversation() != null

  if (sdkActivated && !chatboxOpened && (hasOngoingConv || ruleAvailable)) {
    showChatButton()
  } else {
    hideChatButton()
  }
}

3️⃣ Opening the Chatbox

When the visitor taps on your custom chat button you should open the Chatbox by calling the following method:

IAdvizeSDK.chatboxController.presentChatbox(context)

⌨️ In-context example: Full custom chat button implementation

You can be informed of the Chatbox opening/closing by subscribing to the right listener:

IAdvizeSDK.chatboxController.listeners.add( object : ChatboxListener {
    override fun onChatboxOpened() {
        Log.d("TEST", "Chatbox has opened")
    }

    override fun onChatboxClosed() {
        Log.d("TEST", "Chatbox has closed")
    }
})

🔔 Handling push notifications

Before starting this part you will need to configure push notifications inside your application. You can refer to the following resources if needed:

You will also need to ensure that the push notifications are setup in your iAdvize project. The process is described in the SDK Knowledge Base.

1️⃣ Registering the device token

For the SDK to be able to send notifications to the visitor’s device, its unique device push token must be registered:

class NotificationService : FirebaseMessagingService() {
  override fun onNewToken(token: String) {
    super.onNewToken(token)
    IAdvizeSDK.notificationController.registerPushToken(token)
  }
}

⌨️ In-context example: Device token register

2️⃣ Enabling/disabling push notifications

Push notifications are activated as long as you have setup the push notifications information for your app on the iAdvize administration website (process is described in the SDK Knowledge Base). You can manually enable/disable them at any time using:

IAdvizeSDK.notificationController.enablePushNotifications(object : IAdvizeSDK.Callback {
  override fun onSuccess() {
    // Enable succeded
  }
  override fun onFailure(error: IAdvizeSDK.Error) {
    // Enable failed
  }
})

IAdvizeSDK.notificationController.disablePushNotifications(object : IAdvizeSDK.Callback {
  override fun onSuccess() {
    // Disable succeded
  }
  override fun onFailure(error: IAdvizeSDK.Error) {
    // Disable failed
  }
})

3️⃣ Handling push notifications reception

Once setup, you will receive push notifications when the operator sends any message. As the SDK notifications are caught in the same place than your app other notifications, you first have to distinguish if the received notification comes from iAdvize or not.

class NotificationService : FirebaseMessagingService() {
  override fun onMessageReceived(remoteMessage: RemoteMessage) {
    if (IAdvizeSDK.notificationController.isIAdvizePushNotification(remoteMessage.data)) {
      // This is an iAdvize SDK notification
    }
  }
}

Notifications will be received in your app for all messages sent by the agent. It is your responsibility to display the notification and to check whether or not it is relevant to display it. For instance, you don’t need to show a notification to the visitor when the Chatbox is opened

fun shouldDisplayNotification(remoteMessage: RemoteMessage) =
  IAdvizeSDK.notificationController.isIAdvizePushNotification(remoteMessage.data) 
  && !IAdvizeSDK.chatboxController.isChatboxPresented()

4️⃣ Customizing the notification

You are responsible for displaying the notification so you can use any title / text / icon you want. The text sent by the agent is available in the content part of the notification data received.

override fun onMessageReceived(remoteMessage: RemoteMessage) {
  if (IAdvizeSDK.notificationController.isIAdvizePushNotification(remoteMessage.data)) {
    val agentMessageReceived = remoteMessage.data["content"] ?: "Default text"
  }
}

⌨️ In-context example: Handling received notification

5️⃣ Clearing push notifications

The iAdvize SDK notifications are automatically cleared from the Notification Tray / Notification Center when the Chatbox is opened. If you want to clear them at any other given time you can call this API:

IAdvizeSDK.notificationController.clearIAdvizePushNotifications()

However, as notifications display depends on the Notification Channel, some configuration is needed in order for this behavior to work correctly:

First of all create the Notification Channel:

IAdvizeSDK.notificationController.createNotificationChannel(context)

Then, when receiving the notification, send it through the SDK Notification Channel if the notification is from iAdvize:

if (IAdvizeSDK.notificationController.isIAdvizePushNotification(remoteMessage.data)) {
  val notification = NotificationCompat.Builder(this, IAdvizeSDK.notificationController.channelId)
    ... // notification config
    .build()
} else {
    // Host app notification handling
}

📈 Adding value to the conversation

1️⃣ Registering visitor transactions

You can register a transaction made within your application:

IAdvizeSDK.transactionController.register(
  Transaction(
    "transactionId",
    Date(),
    10.00,
    Currency.EUR
  )
)

2️⃣ Saving visitor custom data

The iAdvize Messenger SDK allows you to save data related to the visitor conversation:

IAdvizeSDK.visitorController.registerCustomData(listOf(
  CustomData.fromString("Test", "Test"),
  CustomData.fromBoolean("Test2", false),
  CustomData.fromDouble("Test3", 2.0),
  CustomData.fromInt("Test4", 3)
),
object : IAdvizeSDK.Callback {
  override fun onSuccess() {
    // Success
  }
  override fun onFailure(error: IAdvizeSDK.Error) {
    // Failure
  }
})

As those data are related to the conversation they cannot be sent if there is no ongoing conversation. Custom data registered before the start of a conversation are stored and the SDK automatically tries to send them when the conversation starts.

The visitor data you registered are displayed in the iAdvize Operator Desk in the conversation sidebar, in a tab labelled Custom data:

Custom data tab shows registered data from the SDK

👍 Fetching visitor satisfaction

The satisfaction survey is automatically sent to the visitor at the end of the conversation, as long as it is activated in the iAdvize administration website. The survey is presented to the visitor in a conversational approach, directly into the Chatbox.

Satisfaction survey

Only the CSAT, NPS and COMMENT steps of the survey are supported.

Last updated