Android SDK for Chatwoot
Add the JitPack repository to your project's settings.gradle
or build.gradle
:
dependencyResolutionManagement {
repositories {
// ... other repositories
maven(url = "https://jitpack.io")
}
}
Add the dependency in your app's build.gradle
:
dependencies {
implementation("com.github.chatwoot:android-agent-sdk:1.0.0")
}
If you're managing dependencies directly in your build.gradle
:
allprojects {
repositories {
// ... other repositories
maven(url = "https://jitpack.io")
}
}
dependencies {
implementation("com.github.chatwoot:android-agent-sdk:1.0.0")
}
To enable photo capture or image upload features in the chat interface, you must add the following permissions to your app's AndroidManifest.xml
:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
For Android 10 (API level 29) and above, you should also add:
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
Parameter | Type | Required | Description |
---|---|---|---|
accountId |
Int |
✅ | Unique ID for the Chatwoot account |
apiHost |
String |
✅ | Chatwoot API host URL |
accessToken |
String |
✅ | Access token for authentication |
pubsubToken |
String |
✅ | Token for real-time updates |
websocketUrl |
String |
✅ | WebSocket URL for real-time communication |
val config = ChatwootConfiguration(
accountId = 1,
apiHost = "https://your-chatwoot.com",
accessToken = "YOUR_ACCESS_TOKEN",
pubsubToken = "YOUR_PUBSUB_TOKEN",
websocketUrl = "wss://your-chatwoot.com"
)
ChatwootSDK.setup(config)
// In your Activity or Fragment
val conversationId = 123 // Required: conversation ID to load
ChatwootSDK.loadChatUI(this, conversationId)
The conversationId
is required to load the chat UI. Make sure you have a valid conversation ID before calling loadChatUI
.
Before building or publishing, please run:
./gradlew wrapper --gradle-version 8.5
This will generate the required Gradle wrapper JAR file in the gradle/wrapper directory.