This document describes how to integrate Kakao Talk Social APIs into your service with the Kakao SDK for Android ("Android SDK").
To use this API, you must add both v2-user
(Kakao Login module) and v2-talk
(Kakao Talk module that provides TalkApiClient
in the module-level build.gradle file by referring to Add modules. To implement the Friend picker, you must also add v2-friend
module that provides PickerClient
.
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms Activate Kakao Login Manage consent items |
Required | Required: Profile Info(nickname/profile image) Nickname Profile image |
To retrieve the Kakao Talk profile of the user currently logged in, call the profile() method in the TalkApiClient
class.
// Retrieve Kakao Talk profile
TalkApiClient.instance.profile { profile, error ->
if (error != null) {
Log.e(TAG, "Failed to retrieve Kakao Talk profile", error)
}
else if (profile != null) {
Log.i(TAG, "Succeeded in retrieving Kakao Talk profile" +
"\nNickname: ${profile.nickname}" +
"\nProfile Thumbnail: ${profile.thumbnailUrl}"
}
}
var disposables = CompositeDisposable()
// Retrieve Kakao Talk profile
TalkApiClient.rx.profile()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ profile ->
Log.i(TAG, "Succeeded in retrieving Kakao Talk profile" +
"\nNickname: ${profile.nickname}" +
"\nProfile Thumbnail: ${profile.thumbnailUrl}"
}, { error ->
Log.e(TAG, "Failed to retrieve Kakao Talk profile", error)
}).addTo(disposables)
profile()
returns the TalkProfile object which contains the user's Kakao Talk profile information.
The Kakao Talk profile obatained though profile()
is different from the profile of Kakao Account. Refer to Concepts.
Name | Type | Description | Required |
---|---|---|---|
nickname | String |
Kakao Talk nickname. Required user consent: Profile Info(nickname/profile image) or Nickname |
X |
profileImageUrl | String |
Kakao Talk profile image URL. Required user consent: Profile Info(nickname/profile image) or Profile image |
X |
thumbnailUrl | String |
Kakao Talk profile thumbnail image URL. Required user consent: Profile Info(nickname/profile image) or Profile image |
X |
countryISO | String |
Code of country where the user is using Kakao Talk. | X |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
Required | Register platforms Activate Kakao Login Manage consent items |
Required | Required: Friends List in Kakao Service(Including profile image, nickname, and favorites) |
This API displays the Friend picker and provides the information of the Kakao Talk friends that a user selects through the picker.
Depending on the selection type and display format of the Friend picker, you need to use a different method.
Selection type | Display format | Method to use |
---|---|---|
Only one friend (Single picker) | Full screen | selectFriend() |
Multiple friends (Multi-picker) | Full screen | selectFriends() |
Only one friend (Single picker) | Popup screen | selectFriendPopup() |
Multiple friends (Multi-picker) | Popup screen | selectFriendsPopup() |
Name | Type | Description | Required |
---|---|---|---|
title | String |
Text to be displayed in the title area of the Friend picker. (Default: "Select Friends") |
X |
viewAppearance | ViewAppearance |
Dispaly mode of the Friend picker. One of the followings: - LIGHT : Light mode.- DARK : Dark mode.- AUTO : The mode set in the system display settings is automatically applied.(Default: AUTO ) |
X |
orientation | PickerOrientation |
Orientiation of the Friend picker screen. One of the followings: - PORTRAIT : Portrait mode.- LANDSCAPE : Landscape mode.- AUTO : Orientation set in the system settings is automatically applied.(Default: AUTO ) |
X |
enableSearch | Boolean |
Whether to show the Search box for friends. (Default: true ) |
X |
enableIndex | Boolean |
Whether to show the Index by the first letter of profile nickname. (Default: true ) |
X |
showMyProfile | Boolean |
Whether to show my profile. It set to true , users can also select their own profile themselves.(Default: true ) |
X |
showFavorite | Boolean |
Whether to show the friends added as Favorite. (Default: true ) |
X |
showPickedFriend | Boolean |
Only for the multi-picker. Whether to show the selected friends. (Default: true ) |
X |
maxPickableCount | Int |
Only for the multi-picker. Maximum number of the seletable friends. This value must be greater than or equal to minPickableCount . (Default: 30 , Maximum: 100 ) |
X |
minPickableCount | Int |
Only for the multi-picker. Minimum number of the seletable friends. This value must be less than or equal to minPickableCount . (Default: 1 , Maximum: 100 ) |
X |
val openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title = "Single picker in full screen", //default "Select friends"
viewAppearance = ViewAppearance.AUTO, //default ViewAppearance.AUTO
orientation = PickerOrientation.AUTO, //default PickerOrientation.AUTO
enableSearch = true, //default true
enableIndex = true, //default true
showMyProfile = true, //default true
showFavorite = true, //default true
)
PickerClient.instance.selectFriend(
context = context!!,
params = openPickerFriendRequestParams
) { selectedUsers, error ->
if (error != null) {
Log.e(TAG, "Failed to retrieve the selected friend through the picker.", error)
} else {
Log.d(TAG, "Succeeded in retrieving the selected friend through the picker. $selectedUsers")
}
}
val openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title = "Single picker in full screen", //default "Select friends"
viewAppearance = ViewAppearance.AUTO, //default ViewAppearance.AUTO
orientation = PickerOrientation.AUTO, //default PickerOrientation.AUTO
enableSearch = true, //default true
enableIndex = true, //default true
showMyProfile = true, //default true
showFavorite = true, //default true
)
PickerClient.rx.selectFriend(
context = context!!,
params = openPickerFriendRequestParams
).subscribe({ selectedUsers ->
Log.d(TAG, "Succeeded in retrieving the selected friend through the picker. $selectedUsers")
}, { error ->
Log.e(TAG, "Failed to retrieve the selected friend through the picker.", error)
}).addTo(disposables)
val openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title = "Single picker in popup screen", //default "Select friends"
viewAppearance = ViewAppearance.AUTO, //default ViewAppearance.AUTO
orientation = PickerOrientation.AUTO, //default PickerOrientation.AUTO
enableSearch = true, //default true
enableIndex = true, //default true
showMyProfile = true, //default true
showFavorite = true, //default true
)
PickerClient.instance.selectFriendPopup(
context = context!!,
params = openPickerFriendRequestParams
) { selectedUsers, error ->
if (error != null) {
Log.e(TAG, "Failed to retrieve the selected friend through the picker.", error)
} else {
Log.d(TAG, "Succeeded in retrieving the selected friend through the picker. $selectedUsers")
}
}
val openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title = "Single picker in popup screen", //default "Select friends"
viewAppearance = ViewAppearance.AUTO, //default ViewAppearance.AUTO
orientation = PickerOrientation.AUTO, //default PickerOrientation.AUTO
enableSearch = true, //default true
enableIndex = true, //default true
showMyProfile = true, //default true
showFavorite = true, //default true
)
PickerClient.rx.selectFriendPopup(
context = context!!,
params = openPickerFriendRequestParams
).subscribe({ selectedUsers ->
Log.d(TAG, "Succeeded in retrieving the selected friend through the picker. $selectedUsers")
}, { error ->
Log.e(TAG, "Failed to retrieve the selected friend through the picker.", error)
}).addTo(disposables)
val openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title = "Multi-picker in full screen", //default "Select friends"
viewAppearance = ViewAppearance.AUTO, //default ViewAppearance.AUTO
orientation = PickerOrientation.AUTO, //default PickerOrientation.AUTO
enableSearch = true, //default true
enableIndex = true, //default true
showMyProfile = true, //default true
showFavorite = true, //default true
showPickedFriend = null, // default true
maxPickableCount = null, // default 30
minPickableCount = null // default 1
)
PickerClient.instance.selectFriends(
context = context!!,
params = openPickerFriendRequestParams
) { selectedUsers, error ->
if (error != null) {
Log.e(TAG, "Failed to retrieve the selected friend(s) through the picker.", error)
} else {
Log.d(TAG, "Succeeded in retrieving the selected friend(s) through the picker. $selectedUsers")
}
}
val openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title = "Multi-picker in full screen", //default "Select friends"
viewAppearance = ViewAppearance.AUTO, //default ViewAppearance.AUTO
orientation = PickerOrientation.AUTO, //default PickerOrientation.AUTO
enableSearch = true, //default true
enableIndex = true, //default true
showMyProfile = true, //default true
showFavorite = true, //default true
showPickedFriend = null, // default true
maxPickableCount = null, // default 30
minPickableCount = null // default 1
)
PickerClient.rx.selectFriends(
context = context!!,
params = openPickerFriendRequestParams
).subscribe({ selectedUsers ->
Log.d(TAG, "Succeeded in retrieving the selected friend(s) through the picker. $selectedUsers")
}, { error ->
Log.e(TAG, "Failed to retrieve the selected friend(s) through the picker.", error)
}).addTo(disposables)
val openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title = "Multi-picker in popup screen", //default "Select friends"
viewAppearance = ViewAppearance.AUTO, //default ViewAppearance.AUTO
orientation = PickerOrientation.AUTO, //default PickerOrientation.AUTO
enableSearch = true, //default true
enableIndex = true, //default true
showMyProfile = true, //default true
showFavorite = true, //default true
showPickedFriend = null, // default true
maxPickableCount = null, // default 30
minPickableCount = null // default 1
)
PickerClient.instance.selectFriendsPopup(
context = context!!,
params = openPickerFriendRequestParams
) { selectedUsers, error ->
if (error != null) {
Log.e(TAG, "Failed to retrieve the selected friend(s) through the picker.", error)
} else {
Log.d(TAG, "Succeeded in retrieving the selected friend(s) through the picker. $selectedUsers")
}
}
val openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title = "Multi-picker in popup screen", //default "Select friends"
viewAppearance = ViewAppearance.AUTO, //default ViewAppearance.AUTO
orientation = PickerOrientation.AUTO, //default PickerOrientation.AUTO
enableSearch = true, //default true
enableIndex = true, //default true
showMyProfile = true, //default true
showFavorite = true, //default true
showPickedFriend = null, // default true
maxPickableCount = null, // default 30
minPickableCount = null // default 1
)
PickerClient.rx.selectFriendsPopup(
context = context!!,
params = openPickerFriendRequestParams
).subscribe({ selectedUsers ->
Log.d(TAG, "Succeeded in retrieving the selected friend(s) through the picker. $selectedUsers")
}, { error ->
Log.e(TAG, "Failed to retrieve the selected friend(s) through the picker.", error)
}).addTo(disposables)
If the request is successful, the information of the friends that a user selects from the Friend picker is returned through SelectedUsers
. If you encounter errors, refer to Troubleshooting.
Name | Type | Description | Required |
---|---|---|---|
totalCount | Int |
Number of friends who a user selected on the Friend picker. Refer to If the number of friends passed in response is less than the number of selected friends. |
O |
users | List<SelectedUser> |
List of friends data that is passed in the response. Refer to SelectedUser. |
X |
Name | Type | Description | Required |
---|---|---|---|
uuid | String |
User's unique ID used to identify users in a service and used to send a Kakao Talk message. This value may change if a user deletes and then re-creates the Kakao Talk account. |
O |
id | Long |
Friend's service user ID. Only the friends who are linked to the app have a service user ID. | X |
profileNickname | String |
Friend's profile nickname set in Kakao Talk. | X |
profileThumbnailImage | String |
Friend's profile thumbnail image set in Kakao Talk. | X |
favorite | Boolean |
Whether the friend is added as Favorite. | X |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
Required | Register platforms Activate Kakao Login Manage consent items |
Required | Required: Friends List in Kakao Service (Including profile image, nickname, and favorites) |
This API enables you to get the list of Kakao Talk friends of the user currently logged in. Note that Kakao Talk profiles may be different from Kakao Account profiles. Refer to Concepts.
To get the list of Kakao Talk friends of the user currently logged in, call the friends() method in the TalkApiClient
class. You can also pass optional parameters through arguments. If you make a request without any parameters, the default settings are applied.
Name | Type | Description | Required |
---|---|---|---|
offset | Int |
Offset value that the list of friends starts from. (Default: 0 ) |
X |
limit | Int |
Maximum number of friends to be retrieved per page. (Maximum: 100 , Default: 10 ) |
X |
order | Order |
Search direction for pages. ASC or DESC . - ASC : sort in ascending order.- DESC : sort in descending order. (Default: ASC ) |
X |
friendOrder | FriendOrder |
Method to sort friends in the list. - NICKNAME : sort by Kakao Talk nickname in ascending or descending order according to the set value of order . - FAVORITE : user's favorite friends appear ahead in the sort order according to the set value of order and then the rest friends are sorted with the same priority. (Default: FAVORITE ) |
X |
// Retrieve a list of friends (Default)
TalkApiClient.instance.friends { friends, error ->
if (error != null) {
Log.e(TAG, "Failed to retrieve a list of friends.", error)
}
else if (friends != null) {
Log.i(TAG, "Succeeded in retrieving a list of friends. \n${friends.elements.joinToString("\n")}")
// You can send a message to the friends using their UUIDs.
}
}
var disposables = CompositeDisposable()
// Retrieve a list of friends (Default)
TalkApiClient.rx.friends()
.retryWhen(
// Retry the request the list of friends after requesting additional consent to the consent item that the InsufficientScope error occurs.
RxAuthOperations.instance.incrementalAuthorizationRequired(context)
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ friends ->
Log.i(TAG, "Succeeded in retrieving a list of friends \n${friends.elements.joinToString("\n")}")
// You can send a message to the friends using their UUIDs.
}, { error ->
Log.e(TAG, "Failed to retrieve a list of friends.", error)
})
.addTo(disposables)
friends()
returns Friends which contains a list of the user's Kakao Talk friends.
If the request fails because the user has not agreed to provide the Friends list, proceed the followings:
Name | Type | Description | Required |
---|---|---|---|
elements | List<Friend> |
List of Kakao Talk profile information of each friend. | X |
totalCount | Int |
Total number of Kakao Talk friends. | O |
beforeUrl | String |
Previous page URL. If there is no previous page, null is returned. |
X |
afterUrl | String |
Next page URL. If there is no next page, null is returned. |
X |
favoriteCount | Int |
Number of friends added as favorite . |
X |
Name | Type | Description | Required |
---|---|---|---|
id | Int |
Service user ID. | X |
uuid | String |
User's unique ID. Used when sending a Kakao Talk message. Do not use this value to identify users because this value may change depending on user's account status. |
O |
profileNickname | String |
Friend's profile nickname. | X |
profileThumbnailImage | String |
Friend's profile thumbnail image. | X |
favorite | Boolean |
Whether or not the friend is added as a favorite. true : Added as favorite.false : Not added as favorite. |
X |
* allowed_msg: Deprecated. Whether or not the friend allows to receive Kakao Talk messages. For more details, refer to Profile visibility option and DevTalk.