페이지 이동경로
  • Docs>
  • Kakao Talk Channel>
  • Android

Kakao Talk Channel

Android

This document describes how to integrate Kakao Talk Channel APIs into your service with the Kakao SDK for Android ("Android SDK").

Before you begin

Select Method to add Kakao Talk Channel

Follow Kakao Talk Channel and Add Kakao Talk Channel are available. Refer to Add Kakao Talk Channel and decide what to use. Follow Kakao Talk Channel is recommended because of the easy implementation.

Set Custom URL scheme

To use Follow Kakao Talk Channel, set an activity in AndroidManifest.xml to support the activity redirection. Refer to the sample below.

<activity 
  android:name="com.kakao.sdk.talk.FollowChannelHandlerActivity"
  android:exported="true">
  <intent-filter>
      <action android:name="android.intent.action.VIEW" />
      <category android:name="android.intent.category.DEFAULT" />
      <category android:name="android.intent.category.BROWSABLE" />
      
      <!-- Redirect URI: "kakao${NATIVE_APP_KEY}://channel" -->
      <data android:host="channel" android:scheme="kakao${NATIVE_APP_KEY}" />
    </intent-filter>
</activity>

Follow Kakao Talk Channel

Basic information
Reference App setting
[SDK, RxSDK] followChannel()
[SDK] FollowChannelResult
Install
Initialize
Set Custom URL scheme
Permission Prerequisite Kakao Login User consent
- Register platforms
Activate Kakao Login
Manage consent items
Set Kakao Talk Channel
- -
Note: Kakao Login

Follow Kakao Talk Channel is available without Kakao Login. However, to avoid an inconvenient login process, we recommend using Follow Kakao Talk Channel in a service with Kakao Login.

Requests adding Kakao Talk Channel to the user. Displays a screen for adding Kakao Talk Channel and returns the result in the response.

Request

Request followChannel() in TalkApiClient. Kakao Talk Channel profile ID is required. Refer to Services using Kakao Login and Services not using Kakao Login for the request process.

Response

If the request is successful, FollowChannelResult in the response includes the Kakao Talk Channel profile ID and the result. If the request fails, refer to Trouble shooting to figure out the reason.

Sample

Kotlin
RxKotlin
// Follow Kakao Talk Channel
TalkApiClient.instance.followChannel(context, "${CHANNEL_PUBLIC_ID}") { result, error ->
    if (result != null) {
        // Success
    } else {
        // Fail
    }
}
val disposables = CompositeDisposable()

// Follow Kakao Talk Channel
TalkApiClient.rx.followChannel(context, "${CHANNEL_PUBLIC_ID}")
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe({ result ->
        // Success
    }, { error ->
        // Fail
    })
    .addTo(disposables)

Add Kakao Talk Channel

Basic information
Reference App setting
[SDK, RxSDK] addChannel()
[SDK] addChannelUrl()
Install
Initialize
Permission Prerequisite Kakao Login User consent
- Register platforms - -

Launches Kakao Talk to let the user add the Kakao Talk Channel.

Request

Call addChannel() in TalkApiClient. Pass the profile ID of the Kakao Talk Channel.

Response

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.

Sample

Kotlin
RxKotlin
// 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)

Additional feature

Bridge page

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)

Start Kakao Talk Channel chat

Basic information
Reference App setting
[SDK, RxSDK] chatChannel()
[SDK] chatChannelUrl()
Install
Initialize
Permission Prerequisite Kakao Login User consent
- Register platforms - -

Starts a chat with Kakao Talk Channel.

Request

Call chatChannel() in TalkApiClient. Pass the profile ID of the Kakao Talk Channel.

Response

This API does not inform whether the user enters the chat room successfully.

Sample

Kotlin
RxKotlin
// 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)

Addtional feature

Bridge page

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)

Check Kakao Talk Channel relationship

Basic information
Reference App setting
[SDK, RxSDK] channels()
[SDK] Channel
Install
Initialize
Permission Prerequisite Kakao Login User consent
- Register platforms
Activate Kakao Login
Manage consent items
Set Kakao Talk Channel
Required Required:
Kakao Talk Channel addition status and details

Checks if a specific user has added or blocked the Kakao Talk Channel connected to the service app.

Note

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.

Request

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.

Response

If the request is successful, channels() returns the Channels object.

Sample

Kotlin
RxKotlin
// 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)