This document describes how to integrate Kakao Talk Channel APIs into your service with the Kakao SDK for iOS ("iOS SDK").
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.
Reference | App setting |
---|---|
[SDK, RxSDK] followChannel() [SDK] FollowChannelResult |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms Activate Kakao Login Manage consent items Set Kakao Talk Channel |
- | - |
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.
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.
// 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)
Reference | App setting |
---|---|
[SDK, RxSDK] addChannel() [SDK] makeUrlForAddChannel() |
Install Import modules Initialize URL Schemes Allowlist |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms | - | - |
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.
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.
TalkApi.shared.addChannel(channelPublicId: "${CHANNEL_ID}") {
if let error = error {
print(error)
} else {
print("addChannel() success.")
// Implement service logics
...
}
}
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)
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.")
}
Reference | App setting |
---|---|
[SDK, RxSDK] chatChannel() [SDK] makeUrlForChatChannel() |
Install Import modules Initialize URL Schemes Allowlist |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms | - | - |
Starts a chat with Kakao Talk Channel.
Call chatChannel()
in TalkApi
. Pass the profile ID of the Kakao Talk Channel.
This API does not inform whether the user enters the chat room successfully.
TalkApi.shared.chatChannel(channelPublicId: "${CHANNEL_ID}") {
if let error = error {
print(error)
} else {
print("chatChannel() success.")
// Implement service logics
...
}
}
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.")
}
Reference | App setting |
---|---|
[SDK, RxSDK] channels() [SDK] Channel |
Install Import modules 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.
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.
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.
If the request is successful, channels()
returns the Channels
object.
TalkApi.shared.channels { (channels, error) in
if let error = error {
print(error)
}
else {
print("channels() success.")
// Implement service logics
_ = channels
}
}
// Class member property
let disposeBag = DisposeBag()
TalkApi.shared.rx.channels()
.retry(when: Auth.shared.rx.incrementalAuthorizationRequired())
.subscribe (onSuccess:{ (channels) in
print("channels() success.")
// Implement service logics
_ = channels
}, onFailure: {error in
print(error)
})
.disposed(by: disposeBag)