페이지 이동경로
  • 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 (hereinafter referred to as 'Android SDK').

Tag used in this document

Tag Description
Login required The API marked with this tag requires Kakao Login. You must implement the Kakao Login function first, and then call the corresponding API by using the access token issued when a user logs in.
Consent required To use the API marked with this tag, you must enable a specific scope required for the corresponding API.
In addition, a user must also consent to the scope. Otherwise, an error occurs or empty value is returned. To check which scopes a user has consented to, you can call the Retrieving consent details API.

Before you begin

Register Android Platform

To use the Android SDK, you must register the Android platform in advance. Go to [My Application] > [Platform] and register the Android platform by specifying its package name and key hashes. If not, an error may occur.

Add modules

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. Since 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.

Add Kakao Talk Channel

To enable a user to add a specific Kakao Talk Channel as a friend, call the addChannelUrl() method defined in the TalkApiClient class. You must pass the Kakao Talk Channel ID through channelPublicId as an argument.

You can invoke the bridge page URL using the openWithDefault() method in KakaoCustomTabsClient.

This API does not force users to add Kakao Talk Channels but only presents the bridge page to redirect users to Kakao Talk Channel specified with the value of channelPublicId. When this feature is invoked, users can select whether to add the Kakao Talk Channel on the bridge page.

Parameter
Name Type Description Required
channelPublicId String Kakao Talk Channel ID. O
// Add URL of Kakao Talk Channel.
val url = TalkApiClient.instance.addChannelUrl("_ABcdE")

// Open through CustomTabs.
KakaoCustomTabsClient.openWithDefault(context, url)

When the user selects the option to add the Kakao Talk Channel on the bridge page, the Kakao Talk app starts through a Custom URL Scheme, and the designated screen of the Kakao Talk Channel is displayed.

This API does not inform you 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.

Kakao Talk Channel chat

To allow a user to start a Kakao Talk Channel chat, call the channelChatUrl() method defined in the TalkApiClient class. You must pass the Kakao Talk Channel ID through channelPublicId as an argument.

You can invoke the bridge page URL using the openWithDefault() method in KakaoCustomTabsClient.

Parameter
Name Type Description Required
channelPublicId String Kakao Talk Channel ID. O
// Kakao Talk Channel chat URL
val url = TalkApiClient.instance.channelChatUrl("_ABcdE")

// Open through CustomTabs.
KakaoCustomTabsClient.openWithDefault(context, url)

When the user selects the option to start a Kakao Talk Channel chat on the bridge page, the Kakao Talk app starts through a Custom URL Scheme, and the designated screen of the Kakao Talk Channel is displayed.

When the bridge page is invoked, the Kakao Talk Channel sends the user a message saying "Hello, how can I help you?" with the web page URL that the user requested a chat for.

Check Kakao Talk Channel relationship Login required Consent required

To use this API,

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.

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)
Return data

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

Channels
Name Type Description Required
userId Long Service user ID. X
channels List<Channel> Kakao Talk Channel information. X
Channel
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.

IMPORTANT

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.

Legacy

To see how to integrate the features of Kakao Talk Channel using the Legacy Kakao SDK for Android, click this button. It is highly recommended to migrate to the new version of Android SDK as soon as possible because the Legacy version may not be supported anymore. The Legacy guide is not provided in the English version. Refer to the original Korean documentation.

See more