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

kakao developers

Related sites
  • Docs
  • Kakao Talk Social
  • Flutter

사이드 메뉴

Kakao Map

Search

Kakao Talk Social

Flutter

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

Retrieve Kakao Talk profile

Basic information
PermissionPrerequisiteKakao LoginUser consent
-Platform key
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 profile().

Response

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.

Sample

try {
TalkProfile profile = await TalkApi.instance.profile();
print('Succeeded in retrieving Kakao Talk profile.\nNickname: ${profile.nickname}\nProfile image: ${profile.thumbnailUrl}\nCountry code: ${profile.countryISO}');
} catch (error) {
print('Failed to retrieve Kakao Talk profile. $error');
}

Retrieve friends through picker

Basic information
PermissionPrerequisiteKakao LoginUser consent
RequiredPlatform key
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

Request

When calling selectFriend(), you can choose the selection type through parameters.


Set enableMulti to true for multi picker or false for single picker. If not specified, multi picker is applied.

You can also configure screen orientation, search options, and other details through PickerFriendRequestParams. For detailed parameter information, refer to Reference.

The components can be set by parameters.

For a web page, Redirection is available.

Response

If a user selects friends on the picker display, the information of the friends that a user selects from the Friend picker is returned through SelectedUsers. If the request failed or a problem occurred, refer to the Error code to check the cause.

Sample

// Parameter setting
final params = PickerFriendRequestParams(
title: 'Single Picker', // Name of the picker
enableSearch: true, // Enables the search function
showFavorite: true, // Marks on favorite friends
enableBackButton: true, // Enables the back button, available for web with redirect method or native app
);
// Call the picker
try {
final SelectedUsers users = await PickerApi.instance.selectFriend(context: context, params: params, enableMulti: false);
print('Success: ${users.users!.length}');
} catch(error) {
print('Failure: $error');
}

Additional feature

Redirection

This feature is not available for the native app.

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] > [REST API 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.

// Web, redirection
// Parameter setting
final PickerFriendRequestParams params = PickerFriendRequestParams(
title: 'Multi-Picker', // Name of the picker
enableSearch: true, // Enables the search function
showFavorite: true, // Marks on favorite friends
showPickedFriend: true, // Displays selected friends for multi-picker
maxPickableCount: 5, // Maximum pickable count
minPickableCount: 1, // Minimum pickable count
returnUrl: 'https://developers.kakao.com', // Essential
enableBackButton: true, // Enables the back button, available for web with redirect method or native app
);
// Call the picker
// Success: ${returnUrl}?selected=${SelectedUsers}
// Failure: ${returnUrl}?error=${Error}
await PickerApi.instance.selectFriend(context: context, params: params, enableMulti: true);

Retrieve list of friends

Basic information
PermissionPrerequisiteKakao LoginUser consent
RequiredPlatform key
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.

Request

Call friends().

Response

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:

  • 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

try {
Friends friends = await TalkApi.instance.friends();
print('Succeeded in retrieving a list of friends.\n${friends.elements?.map((error) => error.profileNickname).join('\n')}');
// You can send a message to the friends using their UUIDs.
} catch (error) {
print('Failed to retrieve a list of friends. $error');
}

Was this helpful?