페이지 이동경로
  • Docs>
  • Kakao Talk Social>
  • Flutter

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
Reference App setting
profile()
TalkProfile
Install
Initialize
Permission Prerequisite Kakao Login User consent
- Register platforms
Activate Kakao Login
Manage consent items
Required Required:
Profile Info(nickname/profile image)
Nickname
Profile image

Retrieves the Kakao Talk profile of the user currently logged in.

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
Reference App setting
selectFriend()
selectFriends()
SelectedUsers
Install
Initialize
Set up for hybrid app: For redirection and popup
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.

Request

Depending on the selection type of the Friend picker, you need to use a different method.

Selection type Function to use
Single picker selectFriend()
Multi picker selectFriends()

The components can be set by parameters.

For an Android or iOS native app, pass the BuildContext to the context parameter.

For a web page, Redirection and Popup are 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 Troubleshooting to check the cause.

Sample

Single picker
Multi picker
// Native app
// Parameter setting
var 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 {
    SelectedUsers users = await PickerApi.instance.selectFriend(params: params, context: context);
    print('Success: ${users.users!.length}');
} catch(e) {
    print('Failure: $e');
}
// Native app
// Parameter setting
var 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
    enableBackButton: true, // Enables the back button, available for web with redirect method or native app
);

// Call the picker
try {
    SelectedUsers users = await PickerApi.instance.selectFriends(params: params, context: context);
    print('Success: ${users.users!.length}');
} catch(e) {
    print('Failure: $e');
}

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 site domains in [My Application] > [Platform] > [Web]. 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
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.selectFriends(params: params);

Popup

This feature is not available for the native app.

To open the picker on a popup, do not use context parameter.

When the user completes choosing friends, the response will be returned as Future.

// Web, popup
// Parameter setting
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
);

// Call the picker
try {
    SelectedUsers users = await PickerApi.instance.selectFriends(params: params);
    print('Success: ${users.users!.length}'):
} catch(e) {
    print('Failure: $e');
}

Retrieve list of friends

Basic information
Reference App setting
friends()
Friends
Install
Initialize
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)

Retrieves the list of Kakao Talk friends of the user currently logged in.

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');
}