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

Kakao Talk Channel

Flutter

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

Before you begin

Select Method to add Kakao Talk Channel

Follow Kakao Talk Channel and Add Kakao Talk Channel are available. Refer to Add Kakao Talk Channel and decide what to use. Follow Kakao Talk Channel is recommended because of the easy implementation.

Set Custom URL scheme

To use Follow Kakao Talk channel, set a custom URL scheme in AndroidManifest.xml. The custom URL scheme is used to launch the service app after following Kakao Talk channel. Refer to the sample below.

<!-- Custom URL scheme setting for Android device in the Flutter project -->
<activity
    android:name="com.kakao.sdk.flutter.auth.AppsHandlerActivity"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <!-- Redirect URI: "kakao${NATIVE_APP_KEY}://channel" -->
        <data android:scheme="kakao${YOUR_NATIVE_APP_KEY}" android:host="channel"/>
    </intent-filter>
    </intent-filter>
</activity>

Follow Kakao Talk Channel

Basic information
Reference App setting
FollowChannelResult
followChannel()
Install
Initialize
Set Custom URL scheme
Permission Prerequisite Kakao Login User consent
- Platform key
Activate Kakao Login
Manage consent items
Set Kakao Talk Channel
- -

Requests adding Kakao Talk Channel to the user.

Note: Kakao Login

Follow Kakao Talk Channel is available without Kakao Login. However, to avoid an inconvenient login process, we recommend using Follow Kakao Talk Channel in a service with Kakao Login.

Displays a screen for adding Kakao Talk Channel and returns the result in the response.

Request

Request followChannel() in TalkApi. Kakao Talk Channel profile ID is required. Refer to Services using Kakao Login and Services not using Kakao Login for the request process.

Response

If the request is successful, FollowChannelResult in the response includes the Kakao Talk Channel profile ID and the result. If the request fails, refer to Trouble shooting to figure out the reason.

Sample

try {
  // Follow Kakao Talk Channel
  await TalkApi.instance.followChannel("${CHANNEL_PUBLIC_ID}");
  print("Success");
  // Success
} catch (error) {
  print('Failed to follow a Kakao Talk Channel. $error');
  // Fail
}

Add Kakao Talk Channel

Basic information
Reference App setting
addChannel()
addChannelUrl()
Install
Initialize
Permission Prerequisite Kakao Login User consent
- Platform key - -

Provides a bridge page that lets users go to a Kakao Talk Channel and add it as a friend.

To use this feature, users must be in a logged-in state. If users click [Add Channel] in a logged-out state, direct them to the login page to log in.

Request

Call addChannel() in TalkApi. Pass the profile ID of the Kakao Talk Channel.

Response

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.

Sample

try {
  // Add Kakao Talk Channel
  await TalkApi.instance.addChannel(channelId);
} catch (error) {
  print('Failed to add a Kakao Talk Channel. $error');
}

Additional feature

Bridge page

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 launchBrowser() method.

// Add URL of Kakao Talk Channel
Uri url = await TalkApi.instance.addChannelUrl('_ABcdE');

// Open URL via a device browser
try {
  await launchBrowser(url);
} catch (error) {
  print('Any web browser is not installed: Install a web browser. $error');
}

Start Kakao Talk Channel chat

Basic information
Reference App setting
chatChannel()
chatChannelUrl()
Install
Initialize
Permission Prerequisite Kakao Login User consent
- Platform key - -

Provides a bridge page to start a chat with the Kakao Talk Channel on Kakao Talk.

Request

Call chatChannel() in TalkApi. Pass the profile ID of the Kakao Talk Channel.

Response

This API does not inform you whether the user has successfully started the chat.

Sample

try {
  // Start Kakao Talk Channel chat
  await TalkApi.instance.chatChannel(channelId);
} catch(error) {
  print('Failed to start a Kakao Talk Channel chat. $error');
}

Addtional feature

Bridge page

To send the user to a bridge page before launching Kakao Talk, use chatChannelUrl(). Pass the profile ID of the Kakao Talk Channel. To open the specified Kakao Talk Channel via a default web browser, call launchBrowser() method.

// Kakao Talk Channel chat URL
Uri url = await TalkApi.instance.chatChannelUrl('_ABcdE');

// Open URL via a device browser
try {
  await launchBrowser(url);
} catch (error) {
  print('Any web browser is not installed: Install a web browser. $error');
}

Check Kakao Talk Channel relationship

Basic information
Reference App setting
channels()
Channels
Install
Initialize
Permission Prerequisite Kakao Login User consent
- Platform key
Activate Kakao Login
Manage consent items
Set Kakao Talk Channel
Required Required:
Kakao Talk Channel addition status and details

Checks whether a specific user has added or blocked your Kakao Talk Channel connected to your service app.

Note

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 webhook function.

Request

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.

Response

If the request is successful, channels() returns the Channels object.

Sample

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