본문 바로가기메인 메뉴 바로가기사이드 메뉴 바로가기

kakao developers

Related sites
  • Docs
  • Kakao Talk Social
  • JavaScript

사이드 메뉴

Kakao Map

Search

Kakao Talk Social

JavaScript

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

Retrieve Kakao Talk profile

Basic information
PermissionPrerequisiteKakao LoginUser consent
-JavaScript key
JavaScript SDK domain
Activate Kakao Login
Manage consent items
RequiredRequired:
Profile Info(nickname/profile image)
Nickname
Profile image

Retrieves Kakao Talk profile information linked to the Kakao Account of the logged-in user.

Kakao Talk profile and Kakao Account profile

You can check the types and differences of user profiles available through the Kakao API in User profile.

Request

Call the Kakao.API.request() function, and set url to /v1/api/talk/profile to request Kakao Talk profile.

Parameter

NameTypeDescriptionRequired
urlStringFixed to '/v1/api/talk/friends'.O

Response

Kakao.API.request() returns Promise. If the promise is fulfilled, the Kakao Talk profile information is returned. For the detailed response fields, refer to REST API > Retrieve Kakao Talk profile.

Sample

Kakao.API.request({
url: '/v1/api/talk/profile',
})
.then(function (response) {
console.log(response)
})
.catch(function (error) {
console.log(error)
})

Retrieve friends through picker

Basic information
PermissionPrerequisiteKakao LoginUser consent
RequiredJavaScript key
JavaScript SDK domain
Activate Kakao Login
Manage consent items
RequiredRequired:
Friends List in Kakao Service(Including profile image, nickname, and favorites)

Opens the Friend picker and returns the information of the Kakao Talk friends selected by the use

  • The JavaScript SDK only supports the full screen type of picker, while the Android and iOS SDK provides both the popup and full screen format of picker.
  • To see the supported web browser, refer to Supported web browser.

Request

Call one of the following functions depends on the selection type.

Selection typeFunction to use
Single pickerselectFriend()
Multi-pickerselectFriends()

The components can be set by parameters.

Response

Kakao.Picker.selectFriends() returns Promise. If the promise is fulfilled, the information of the friends that a user selects from the Friend picker is returned through SelectedUsers.

Sample

Kakao.Picker.selectFriend({
title: 'Select friends',
})
.then(function (response) {
console.log(response)
})
.catch(function (error) {
console.log(error)
})

Additional Feature

Redirection

To call the friend picker on the current web page, use returnUrl parameter.

Specify the URL of the service server that processes the response to the returnUrl parameter. returnUrl must be one of the domains in [App] > [Platform key] > [JavaScript key] > [JavaScript SDK domain] on the app management page. Use the enableBackButton parameter to disable the back button.

When the user completes choosing friends, the web page will HTTP 302 redirect with the response as an encoded query string to the returnUrl.

// Redirect method
// Success: ${returnUrl}?selected=${SelectedUsers}
// Fail: ${returnUrl}?error=${Error}
Kakao.Picker.selectFriends({
returnUrl: 'https://developers.kakao.com', // Required
title: 'Select friends',
maxPickableCount: 10,
minPickableCount: 1,
})

Retrieve list of friends

Basic information
PermissionPrerequisiteKakao LoginUser consent
RequiredJavaScript key
JavaScript SDK domain
Activate Kakao Login
Manage consent items
RequiredRequired:
Friends List in Kakao Service (Including profile image, nickname, and favorites)

Retrieves Kakao Talk friend information linked to the Kakao Account of the logged-in user.

You can also add optional parameters for sort order, the number of friends to be retrieved on a page, and so on.

Request

Call the Kakao.API.request() function, and set url to /v1/api/talk/friends to request Kakao Talk friends information.

Parameter

NameTypeDescriptionRequired
urlStringFixed to '/v1/api/talk/friends'.O
dataObjectObject that contains the parameters to be passed when requesting the API.X
data: Retrieving list of friends
NameTypeDescriptionRequired
offsetNumberOffset value that the list of friends starts from.
(Default: 0)
X
limitNumberMaximum number of friends to be retrieved per page.
(Maximum: 100, Default: 10)
X
orderStringSort order of friends list.
asc or desc.
  • asc: sort in ascending order.
  • desc: sort in descending order.
(Default: asc)
X
friend_orderStringYou can sort friends in the list by nickname (Kakao Talk nickname) or favorite (favorite friends).
(Default: favorite)
X

Response

Kakao.API.request() returns Promise. If the promise is fulfilled, a list of friends is returned. For the detailed response fields, refer to REST API > Retrieve list of friends.

If the promise is rejected because the user has not agreed to provide the Friends list, proceed the followings:

  • Check if 'Friends List in Kakao Service(Including profile image, nickname, and favorites)' is set to 'Consent during use' in Consent items.
  • Request additional consent to the 'Friends List in Kakao Service(Including profile image, nickname, and favorites)' scope.

Sample

Kakao.API.request({
url: '/v1/api/talk/friends',
})
.then(function (response) {
console.log(response)
})
.catch(function (error) {
console.log(error)
})

See more

Was this helpful?