This document describes how to integrate Kakao Talk Social APIs into your service with the Kakao SDK for Flutter ("Flutter SDK").
Before using Kakao Talk Social APIs with the Flutter SDK,
kakao_flutter_sdk_talk
and kakao_flutter_sdk_user
in pubspec.yaml by referring to Install SDK, add the following libraries in your dart file.import 'package:kakao_flutter_sdk_talk/kakao_flutter_sdk_talk.dart';
import 'package:kakao_flutter_sdk_user/kakao_flutter_sdk_user.dart';
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 TalkApi
class.
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');
}
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 with a size of 640x640 pixels. Only HTTPS is supported.Required user consent: Profile Info(nickname/profile image) or Profile image |
X |
thumbnailUrl | String |
Kakao Talk profile thumbnail image URL with a size of 110x110 pixels. Only HTTPS is supported.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.
The picker of the Flutter SDK has a different mechanism depending on the environment. Refer to the description and examples below.
Native app (Android, iOS)
BuildContext
object (context) as an argument to the picker call function. Refer to the example.Web
See the below to check the difference between pop-up and redirect methods.
Future
.returnUrl
of your service server as a query string through redirection (HTTP 302 Redirect).returnUrl
in [My Appliction] > [Platform] > [Web].Depending on the selection type of the Friend picker, you need to use a different function.
Number of selectable friends | Function to use |
---|---|
Only one friend (Single picker) | selectFriend() |
Multiple friends (Multi-picker) | selectFriends() |
Name | Type | Description | Required |
---|---|---|---|
title | String |
Text to be displayed in the title area of the Friend picker. (Default: "Select Friends") |
X |
enableSearch | Boolean |
Whether to show the Search box for friends. (Default: true ) |
X |
showMyProfile | Boolean |
Whether to show my profile. It set to true , users can also select their own profile.(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 | Number |
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 | Number |
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 |
returnUrl | String |
Required when implementing with the Flutter web redirect method. Service URL that the information of the selected friends are passed to. IMPORTANT: Only allowed the domain registered in [My Appliction] > [Platform] > [Web]. |
X |
enableBackButton | Boolean |
Flutter web pop-up method is not available. Whether to show the back (←) button. - true : the Back button displayed.- false : the Back button no displayed.(Default: true ) |
X |
// Parameter setting
var params = PickerFriendRequestParams(
title: 'Multi-Picker',
enableSearch: true,
showMyProfile: true,
showFavorite: true,
showPickedFriend: null,
maxPickableCount: null,
minPickableCount: null,
enableBackButton: true,
);
// Call the picker
try {
SelectedUsers users = await PickerApi.instance.selectFriends(params: params, context: context);
print('Success: ${users.users!.length}');
} catch(e) {
print('Failure: $e');
}
// Parameter setting (redirect method)
PickerFriendRequestParams params = PickerFriendRequestParams(
title: 'Multi-Picker',
enableSearch: true,
showMyProfile: true,
showFavorite: true,
showPickedFriend: null,
maxPickableCount: null,
minPickableCount: null,
returnUrl: 'https://developers.kakao.com', // Essential
enableBackButton: true,
);
// Call the picker
// Success: ${returnUrl}?selected=${SelectedUsers}
// Failure: ${returnUrl}?error=${Error}
await PickerApi.instance.selectFriends(params: params);
// Parameter setting (pop-up method)
PickerFriendRequestParams params = PickerFriendRequestParams(
title: 'Multi-Picker',
enableSearch: true,
showMyProfile: true,
showFavorite: true,
showPickedFriend: null,
maxPickableCount: null,
minPickableCount: null,
);
// Call the picker
try {
SelectedUsers users = await PickerApi.instance.selectFriends(params: params);
print('Success: ${users.users!.length}'):
} catch(e) {
print('Failure: $e');
}
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.
Name | Type | Description | Required |
---|---|---|---|
selectedTotalCount | Number |
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 | SelectedUser[] |
List of friends data that is passed in the response. | 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 | String |
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 |
If the request is failed, error code and message are returned. To check its cause and solution, refer to Troubleshooting.
Name | Type | Description | Required |
---|---|---|---|
code | Number |
Error code. | O |
msg | String |
Error message. | O |
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) |
To get the list of Kakao Talk friends of the user currently logged in, call the friends()
method in the TalkApi
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. Sort order is decided depending on the set value of order .- nickname : sort by Kakao Talk nickname. - 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 |
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');
}
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 to send 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 | Bool |
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.