This document describes how to integrate Kakao Talk Social APIs into your service with the Kakao SDK for Flutter (hereinafter referred to as 'Flutter SDK').
Tag | Description |
---|---|
Login required | The API marked with this tag requires Kakao Login. You must implement the Kakao Login function first, and then call the corresponding API by using the access token issued when a user logs in. |
Consent required | To use the API marked with this tag, you must enable a specific scope required for the corresponding API. In addition, a user also must consent to the scope. Otherwise, an error occurs or empty value is returned. To check which scopes a user has consented to, you can call the Retrieving consent details API. |
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';
To retrieve the Kakao Talk profile of the user currently logged in, call the profile()
method in the TalkApi
class.
To use this API,
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 (e) {
print('Failed to retrieve Kakao Talk profile. $e');
}
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 Understand 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 |
To use this API,
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((e) => e.profileNickname).join('\n')}');
// You can send a message to the friends using their UUIDs.
} catch (e) {
print('Failed to retrieve a list of friends.');
}
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 in Kakao Service(Including profile image, nickname, and favorites) scope, 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 since 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 |
* Deprecated 'allowedMsg' that indicates whether or not the friend allows to receive Kakao Talk messages from the app as Profile visibility option is provided. For more details, refer to DevTalk.