This document describes how to integrate Kakao Talk Channel APIs into your service with the Kakao SDK for iOS ("iOS SDK").
To use the features of Kakao Talk Channel, add the KakaoSDKTalk
or RxKakaoSDKTalk
(Kakao Talk module) in the Podfile by referring to Install SDK.
To use the Checking Kakao Talk Channel relationship API that requires Kakao Login, you must also add the Kakao Login module, KakaoSDKUser
.
After that, add the import statements as follows.
import KakaoSDKTalk
//If you use the Checking Kakao Talk Channel relationship API, import this module as well.
import KakaoSDKUser
import KakaoSDKTalk
import RxKakaoSDKTalk
//If you use the Checking Kakao Talk Channel relationship API, import this module as well.
import RxKakaoSDKUser
import KakaoSDKUser
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.
Permission | Prerequisite | Kakao Login | User consent | Reference |
---|---|---|---|---|
- | Register platforms Activate Kakao Login Manage consent items Set Kakao Talk Channel |
- | - | CommonFollowChannelResult iOS SDK followChannel() ReactiveX iOS SDK followChannel() |
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 followChannel()
in TalkApi
. Kakao Talk Channel profile ID is required. Refer to Services using Kakao Login and Services not using Kakao Login for the request process.
// Follow Kakao Talk Channel
TalkApi.shared.followChannel(channelPublicId: "${CHANNEL_PUBLIC_ID}") { result, error in
if let error = error {
print(error)
// Fail
}
else {
print(result)
// Success
...
}
}
let disposeBag = DisposeBag()
// Follow Kakao Talk Channel
UserApi.shared.rx.followChannel(channelPublicId:"${CHANNEL_ID}")
.subscribe(onSuccess: { (result) in
print("followChannel(channelPublicId:) success.")
// Success
...
}, onFailure: { error in
print(error)
// Fail
})
.disposed(by: disposeBag)
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.
Permission | Prerequisite | Kakao Login | User consent | Reference |
---|---|---|---|---|
- | Register platforms | - | - | iOS SDKaddChannel() makeUrlForAddChannel() ReactiveX iOS SDKaddChannel() |
To use this feature, set URL Schemes and add kakaoplus
to Allowlist.
Launches Kakao Talk to let the user add the Kakao Talk Channel. Call addChannel()
in TalkApi
. Pass the profile ID of the Kakao Talk Channel.
Name | Type | Description | Required |
---|---|---|---|
channelPublicId | String |
Kakao Talk Channel ID. | O |
TalkApi.shared.addChannel(channelPublicId: "${CHANNEL_ID}") {
if let error = error {
print(error)
} else {
print("addChannel() success.")
// do something
...
}
}
let disposeBag = DisposeBag()
TalkApi.shared.rx.addChannel(channelPublicId: "${CHANNEL_ID}")
.subscribe(onCompleted:{
print("addChannel() success")
//do something
...
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
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 iOS SDK does not support this feature.
To send the user to a bridge page before launching Kakao Talk, use makeUrlForAddChannel()
. Pass the profile ID of the Kakao Talk Channel. To open the url, use the present()
method in safariViewController
.
//in ViewController
var safariViewController : SFSafariViewController? // to keep instance
...
self.safariViewController = SFSafariViewController(url: TalkApi.shared.makeUrlForAddChannel(channelPublicId:"{channel-id}")!)
guard (self.safariViewController != nil) else { return }
self.safariViewController?.modalTransitionStyle = .crossDissolve
self.safariViewController?.modalPresentationStyle = .overCurrentContext
self.present(self.safariViewController!, animated: true) {
print("Succeeded in opening a bridge page to add Kakao Talk Channel.")
}
Permission | Prerequisite | Kakao Login | User consent | Reference |
---|---|---|---|---|
- | Register platforms | - | - | iOS SDKchatChannel() makeUrlForChatChannel() ReactiveX iOS SDK chatChannel() |
To use this feature, set URL Schemes and add kakaoplus
to Allowlist.
Starts a chat with Kakao Talk Channel. Call chatChannel()
in TalkApi
. Pass the profile ID of the Kakao Talk Channel.
Name | Type | Description | Required |
---|---|---|---|
channelPublicId | String |
Kakao Talk Channel ID. | O |
TalkApi.shared.chatChannel(channelPublicId: "${CHANNEL_ID}") {
if let error = error {
print(error)
} else {
print("chatChannel() success.")
// do something
...
}
}
let disposeBag = DisposeBag()
TalkApi.shared.rx.chatChannel(channelPublicId: "${CHANNEL_ID}")
.subscribe(onCompleted:{
print("chatChannel() success")
//do something
...
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
ReactiveX iOS SDK does not support this feature.
To send the user to a bridge page before launching Kakao Talk, use makeUrlForChatChannel()
. Pass the profile ID of the Kakao Talk Channel. To open the URL, use the present()
method in safariViewController
.
//in ViewController
var safariViewController : SFSafariViewController? // to keep instance
...
self.safariViewController = SFSafariViewController(url: TalkApi.shared.makeUrlForChatChannel(channelPublicId:"{channel-id}")!)
guard (self.safariViewController != nil) else { return }
self.safariViewController?.modalTransitionStyle = .crossDissolve
self.safariViewController?.modalPresentationStyle = .overCurrentContext
self.present(self.safariViewController!, animated: true) {
print("Succeeded in opening a bridge page to add Kakao Talk Channel.")
}
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 iOS SDK channels() ReactiveX iOS 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 TalkApi
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.
TalkApi.shared.channels { (channels, error) in
if let error = error {
print(error)
}
else {
print("channels() success.")
// Do something
_ = channels
}
}
// Class member property
let disposeBag = DisposeBag()
TalkApi.shared.rx.channels()
.retry(when: Auth.shared.rx.incrementalAuthorizationRequired())
.subscribe (onSuccess:{ (channels) in
print("channels() success.")
// Do something
_ = channels
}, onFailure: {error in
print(error)
})
.disposed(by: disposeBag)
If the request is successful, channels()
returns the Channels
object.
Name | Type | Description | Required |
---|---|---|---|
userId | Int64 |
Service user ID. | X |
channels | [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 added 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.