Skip to content

Android SDK for Deskpro Messenger (alpha)

Notifications You must be signed in to change notification settings

deskpro/messenger-sdk-android

Repository files navigation

Deskpro

DeskPro Android Messenger

Messenger SDK Android CI

DeskPro Android Messenger is a Chat/AI/Messaging product. You can embed a “widget” directly into native app, so that enables end-users to use the product. Similar implementation for iOS.

Requirements

  • minSDK 23
  • View binding enabled

Dependency installation

  • For detailed instructions about getting Git project into your build, check here.
  • Open the build.gradle file for the app module and add the following lines:
android {
    ...
    buildFeatures {
        viewBinding = true
    }
}

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

dependencies {
    ...
    implementation("com.github.deskpro:messenger-sdk-android:Tag")
}

Manual installation

Download latest .aar file

  • Open the build.gradle file for the app module and add the following lines:
android {
    ...
    buildFeatures {
        viewBinding = true
    }
}

dependencies {
    ...
    implementation(files("libs/messenger-sdk-android-Tag.aar")
}

Initialization (Kotlin)

val messengerConfig =
    MessengerConfig(appUrl: "APP_URL", appId: "APP_ID", appKey: "APP_KEY", appIcon: "APP_ICON")

Replace APP_URL, APP_ID, APP_KEY and APP_ICON with your app's URL, ID, KEY and drawable resource.

val messenger = DeskPro(applicationContext, messengerConfig)

To open a Messenger, paste this line example in the desired place:

messenger.present().show()

Initialization (Java)

MessengerConfig messengerConfig =
    new MessengerConfig("APP_URL", "APP_ID", "APP_KEY", "APP_ICON");

Replace APP_URL, APP_ID, APP_KEY and APP_ICON with your app's URL, ID, KEY and drawable resource. If there is no value for APP_KEY, put null.

DeskPro messenger = new DeskPro(getApplicationContext(), messengerConfig);

To open a Messenger, paste this line example in the desired place:

messenger.present().show();

Note: You can create multiple Messenger instances.

Setting user info

messenger.setUserInfo(userObject)

Note: User(name, firstName, lastName, email)

Authorize user

messenger.authorizeUser(jwtToken)

Push notifications

messenger.setPushRegistrationToken(fcmToken)

Prerequisite: The application should be connected to the notifications platform, enabled for receiving notifications and obtaining FCM tokens.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.