This document describes how to integrate Kakao Talk Channel APIs into your service with the Kakao SDK for Android ("Android SDK").
To use the features of Kakao Talk Channel, you need to add v2-talk
(Kakao Talk module) that provides TalkApiClient
in the module-level build.gradle file by referring to Add modules. Because the ReactiveX Android SDK does not provide the Kakao Talk Channel API, you must use the Kakao Talk module that the Android SDK provides.
To use the Checking Kakao Talk Channel relationship API that requires Kakao Login, you must also add the Kakao Login module, v2-user
. Implement Kakao Login beforehand. After that, call this API with the access token issued after a user logs in.
Permission | Prerequisite | Kakao Login | User consent | Reference |
---|---|---|---|---|
- | Register platforms | - | - | addChannel() addChannelUrl() |
Launches Kakao Talk to let the user add the Kakao Talk Channel. Call addChannel()
in TalkApiClient
. Pass the profile ID of the Kakao Talk Channel.
Name | Type | Description | Required |
---|---|---|---|
channelPublicId | String |
Kakao Talk Channel ID. | O |
// Add Kakao Talk Channel
TalkApiClient.instance.addChannel(context, "_ZeUTxl") { error ->
if (error != null) {
Log.i(TAG, "Failed to add $error")
}
}
var disposables = CompositeDisposable()
// Add Kakao Talk Channel
TalkApiClient.rx.addChannel(context, "_ZeUTxl")
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
Log.i(TAG, "Success")
}, { error ->
Log.e(TAG, "Fail", error)
})
.addTo(disposables)
This API does not inform whether the user adds the Kakao Talk Channel. To check the added status, use the Checking Kakao Talk Channel relationship API that shows the relationship between a user and a Kakao Talk Channel.
ReactiveX Android SDK does not support this feature.
To send the user to a bridge page before launching Kakao Talk, use addChannelUrl()
. Pass the profile ID of the Kakao Talk Channel. To open the URL, use the openWithDefault()
method in KakaoCustomTabsClient
.
// Add URL of Kakao Talk Channel
val url = TalkApiClient.instance.addChannelUrl("_ABcdE")
// Open through CustomTabs
KakaoCustomTabsClient.openWithDefault(context, url)
Permission | Prerequisite | Kakao Login | User consent | Reference |
---|---|---|---|---|
- | Register platforms | - | - | chatChannel() chatChannelUrl() |
Starts a chat with Kakao Talk Channel. Call chatChannel()
in TalkApiClient
. Pass the profile ID of the Kakao Talk Channel.
Name | Type | Description | Required |
---|---|---|---|
channelPublicId | String |
Kakao Talk Channel ID. | O |
// Start Kakao Talk Channel chat
TalkApiClient.instance.chatChannel(context, "_ZeUTxl") { error ->
if (error != null) {
Log.i(TAG, "Failed to start a chat $error")
}
}
var disposables = CompositeDisposable()
TalkApiClient.rx.chatChannel(context, "_ZeUTxl")
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
Log.i(TAG, "Success")
}, { error ->
Log.e(TAG, "Fail", error)
})
.addTo(disposables)
ReactiveX Android SDK does not support this feature.
To send the user to a bridge page before launching Kakao Talk, use addChannelUrl()
. Pass the profile ID of the Kakao Talk Channel. To open the URL, use the openWithDefault()
method in KakaoCustomTabsClient
.
// Kakao Talk Channel chat URL
val url = TalkApiClient.instance.chatChannelUrl("_ABcdE")
// Open through CustomTabs
KakaoCustomTabsClient.openWithDefault(context, url)
Permission | Prerequisite | Kakao Login | User consent | Reference |
---|---|---|---|---|
- | Register platforms Activate Kakao Login Manage consent items Set Kakao Talk Channel |
Required | Required: Kakao Talk Channel addition status and details |
CommonChannel Android SDK channels() ReactiveX Android SDK channels() |
To check if a specific user has added or blocked your Kakao Talk Channel connected to your service app, call the channels()
method defined in the TalkApiClient
class.
Make sure that this API only informs the relationship between the user and the Kakao Talk Channel connected to the app that made a request. Thus, you cannot get all Kakao Talk Channels' information that the user has added but the channels related to your service only.
// Check Kakao Talk Channel relationship
TalkApiClient.instance.channels { relations, error ->
if (error != null) {
Log.e(TAG, "Failed to check channel relationship.", error)
}
else if (relations != null) {
Log.i(TAG, "Succeeded in checking channel relationship. \n${relations.channels}")
}
}
var disposables = CompositeDisposable()
// Check Kakao Talk Channel relationship
TalkApiClient.rx.channels()
.retryWhen(
// Request additional consent for InsufficientScope.
RxAuthOperations.instance.incrementalAuthorizationRequired(context)
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ relations ->
Log.i(TAG, "Succeeded in checking channel relationship. \n${relations.channels}")
}, { error ->
Log.e(TAG, "Failed to check channel relationship.", error)
})
.addTo(disposables)
If the request is successful, channels()
returns the Channels
object.
Name | Type | Description | Required |
---|---|---|---|
userId | Long |
Service user ID. | X |
channels | List<Channel> |
Kakao Talk Channel information. | X |
Name | Type | Description | Required |
---|---|---|---|
uuid | String |
Kakao Talk Channel ID for search purpose. | O |
encodedId | String |
Kakao Talk Channel profile ID. (Example: _ZeUTxl ) |
O |
relation | Relation |
Relationship between a Kakao Talk Channel and a user. - ADDED : a user has blocked the channel.- BLOCKED : a user has blocked the channel.- NONE : a user has not either added or blocked the channel. |
O |
updatedAt | Date |
Time when a Kakao Talk Channel is added or blocked in UTC*. Only returned if a Kakao Talk Channel is added ( ADDED ) or blocked (BLOCKED ). |
X |
* The time is based on Coordinated Universal Time(UTC), being 9 hours behind Korean Standard Time(KST). For the format of time, refer to RFC3339: Date and Time on the Internet.
To get a notification when a user adds or blocks one of your Kakao Talk Channels linked to you service, use the Kakao Talk Channel callback function.