페이지 이동경로
  • 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 (hereinafter referred to as 'Flutter SDK').

Tag used in this document

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 you begin

Before using Kakao Talk Channel APIs with the Flutter SDK, you must complete the prerequisites.

Add modules

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

Implement Kakao Login

To use the Checking Kakao Talk Channel relationship API that requires the tokens issued through Kakao Login,

  • You must implement Kakao Login beforehand.
  • A user has been logged in with a Kakao Account.

Add Kakao Talk Channel

To enable a user to add a specific Kakao Talk Channel as a friend, call the addChannelUrl() method defined in the TalkApi class. You must pass the Kakao Talk Channel ID through channelPublicId as an argument.

To open the specified Kakao Talk Channel via a default web browser, call the launchBrowserTab() method.

Parameter

Name Type Description Required
channelPublicId String Kakao Talk Channel ID. O

Sample

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

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

Return data

If the request is successful, addChannelUrl() launches the Kakao Talk application through Custom URL Scheme, and the user is directed to the specified Kakao Talk Channel to add the channel as a friend.

This API does not inform you whether the user adds the Kakao Talk Channel or not. To check the added status, use the Checking Kakao Talk Channel relationship API that shows the relationship between the user and the Kakao Talk Channel.

Kakao Talk Channel chat

To allow a user to start a Kakao Talk Channel chat, call the channelChatUrl() method defined in the TalkApi class. You must pass the Kakao Talk Channel ID through channelPublicId as an argument.

To open the specified Kakao Talk Channel via a default web browser, call launchBrowserTab() method.

Parameter

Name Type Description Required
channelPublicId String Kakao Talk Channel ID. O

Sample

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

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

Return data

If the request is successful, channelChatUrl() launches the Kakao Talk application through Custom URL Scheme, and the user is directed to the specified Kakao Talk Channel's chatroom. With the bridge page is displayed, a chat with the Kakao Talk Channel is started with the message saying "안녕하세요. 무엇을 도와드릴까요?" ("Hello, how can I help you?"). This message also includes the web page URL that the user requested a chat for.

Check Kakao Talk Channel relationship Login required Consent required

To use this API,

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.

Sample

// Checking Kakao Talk Channel relationship
try {
  Channels relations = await TalkApi.instance.channels();
  print('Succeeded in checking channel relationship.\n${relations.channels}');
} catch (e) {
  print('Failed to check channel relationship. $e');
}

Return data

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

Channels
Name Type Description Required
userId Int Service user ID. X
channels List<Channel> Kakao Talk Channel information. X
Channel
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.

IMPORTANT

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.

See more