This document describes how to integrate Kakao Talk Channel APIs into your service with the Kakao SDK for Flutter ("Flutter SDK").
Before using Kakao Talk Channel APIs with the Flutter SDK, you must complete the prerequisites.
To use the features of Kakao Talk Channel, you need to add kakao_flutter_sdk_talk
for Kakao Talk module and kakao_flutter_sdk_user
for Kakao Login module in pubspec.yaml by referring to Install SDK. After that, add the following libraries in your dart file.
import 'package:kakao_flutter_sdk_talk/kakao_flutter_sdk_talk.dart';
//If you use the Checking Kakao Talk Channel relationship API, import this module as well.
import 'package:kakao_flutter_sdk_user/kakao_flutter_sdk_user.dart';
Permission | Prerequisite | Kakao Login | User consent | Reference |
---|---|---|---|---|
- | Register platforms | - | - | addChannel() addChannelUrl() |
Launches Kakao Talk to let the user add the Kakao Talk Channel. Call addChannel()
in TalkApi
. Pass the profile ID of the Kakao Talk Channel.
Name | Type | Description | Required |
---|---|---|---|
channelPublicId | String |
Kakao Talk Channel ID. | O |
try {
// Add Kakao Talk Channel
await TalkApi.instance.addChannel(channelId);
} catch(e) {
Log.e(context, tag, 'Failed to add', e);
}
This API does not inform whether the user adds the Kakao Talk Channel. To check the added status, use the Checking Kakao Talk Channel relationship API that shows the relationship between a user and a Kakao Talk Channel.
To send the user to a bridge page before launching Kakao Talk, use addChannelUrl()
. Pass the profile ID of the Kakao Talk Channel. To open the specified Kakao Talk Channel via a default web browser, call the launchBrowserTab()
method.
// Add URL of Kakao Talk Channel
Uri url = await TalkApi.instance.addChannelUrl('_ABcdE');
// Open URL via a device browser
try {
await launchBrowserTab(url);
} catch (error) {
print('Any web browser is not installed: Install a web browser. $error');
}
Permission | Prerequisite | Kakao Login | User consent | Reference |
---|---|---|---|---|
- | Register platforms | - | - | chatChannel() chatChannelUrl() |
Starts a chat with Kakao Talk Channel. Call chatChannel()
in TalkApi
. Pass the profile ID of the Kakao Talk Channel.
Name | Type | Description | Required |
---|---|---|---|
channelPublicId | String |
Kakao Talk Channel ID. | O |
try {
// Start Kakao Talk Channel chat
await TalkApi.instance.chatChannel(channelId);
} catch(e) {
Log.e(context, tag, 'Failed to start a chat', e);
}
To send the user to a bridge page before launching Kakao Talk, use addChannelUrl()
. Pass the profile ID of the Kakao Talk Channel. To open the specified Kakao Talk Channel via a default web browser, call launchBrowserTab()
method.
// Kakao Talk Channel chat URL
Uri url = await TalkApi.instance.chatChannelUrl('_ABcdE');
// Open URL via a device browser
try {
await launchBrowserTab(url);
} catch (error) {
print('Any web browser is not installed: Install a web browser. $error');
}
Permission | Prerequisite | Kakao Login | User consent | Reference |
---|---|---|---|---|
- | Register platforms Activate Kakao Login Manage consent items Set Kakao Talk Channel |
Required | Required: Kakao Talk Channel addition status and details |
channels() Channels |
To check if a specific user has added or blocked your Kakao Talk Channel connected to your service app, call the channels()
method defined in the TalkApi
class.
Make sure that this API only informs the relationship between the user and the Kakao Talk Channel connected to the app that made a request. Thus, you cannot get all Kakao Talk Channels' information that the user has added but the channels related to your service only.
// Checking Kakao Talk Channel relationship
try {
Channels relations = await TalkApi.instance.channels();
print('Succeeded in checking channel relationship.\n${relations.channels}');
} catch (error) {
print('Failed to check channel relationship. $error');
}
If the request is successful, channels()
returns the Channels
object.
Name | Type | Description | Required |
---|---|---|---|
userId | Int |
Service user ID. | X |
channels | List<Channel> |
Kakao Talk Channel information. | X |
Name | Type | Description | Required |
---|---|---|---|
uuid | String |
Kakao Talk Channel ID for search purpose. | O |
encodedId | String |
Kakao Talk Channel profile ID. (Example: _ZeUTxl ) |
O |
relation | String |
Relationship between a Kakao Talk Channel and a user. - ADDED : a user has blocked the channel.- BLOCKED : a user has blocked the channel.- NONE : a user has not either added or blocked the channel. |
O |
updatedAt | DateTime |
Time when a Kakao Talk Channel is added or blocked in UTC*. Only returned if a Kakao Talk Channel is added ( ADDED ) or blocked (BLOCKED ). |
X |
* The time is based on Coordinated Universal Time(UTC), being 9 hours behind Korean Standard Time(KST). For the format of time, refer to RFC3339: Date and Time on the Internet.
To get a notification when a user adds or blocks one of your Kakao Talk Channels linked to you service, use the Kakao Talk Channel callback function.