사이드 메뉴
Getting started
Kakao Developers
Login
Communication
Advertisement
- Concepts
- Ad creation: Ad account
- Ad creation: Campaign
- Ad creation: Ad group
- Targeting for ad group
- Custom audience targeting for ad group
- Ad creation: Creative common
- Ad creation: Display creative
- Ad creation: Message creative
- Ad creation: Personalized message creative
- Bizboard landing settings
- Report
- Message management
- Personalized message management
- Message ad management
- Message ad operation
- Ad View management
- Business Form linkage management
- Pixel & SDK linkage management
- Audience management
- Engagement targeting management
- Customer file management
- Friend group management
- Ad account management
- Reference
- Type information
- Error code
Flutter
This document describes how to integrate Kakao Talk Share APIs into your service with the Kakao SDK for Flutter ("Flutter SDK").
Kakao Developers provides two types of message sending features: Kakao Talk Share and Kakao Talk Message. Select the feature to use by referring to Message sending features. If you want to use Kakao Talk Share, check the content after Step 2.
Decide which message template to use by referring to Template types.
Decide how to configure a message by referring to Configuration method comparison. You can configure a message in object format based on predefined default templates or use custom templates configured directly for your service.
Kakao Talk Share basically provides functionality to share messages through Kakao Talk, but it also supports web sharing functionality, so it can be used regardless of whether Kakao Talk is installed on the device.
| Kakao Talk installation status | Message sharing method |
|---|---|
| Installed | Kakao Talk message transmission available |
| Not installed | Web sharing functionality message transmission available Operation sequence:
|
If you want to support sharing only through Kakao Talk according to your service needs, you can check whether Kakao Talk execution is possible using ShareClient's isKakaoTalkSharingAvailable(). The meaning of the method call result is as follows.
true: One of the following- Requested from a native app on a mobile device and Kakao Talk is installed
- Requested from a web browser (webview) on a mobile device
false- Requested from a native app on a mobile device and Kakao Talk is not installed
- Not a mobile device
To support Kakao Talk Share on devices where Kakao Talk is not installed or in web browser environments, use the web sharing functionality. Refer to the example below.
bool isKakaoTalkSharingAvailable = await ShareClient.instance.isKakaoTalkSharingAvailable();if (isKakaoTalkSharingAvailable) {print('Sharing through Kakao Talk available');} else {print('Kakao Talk not installed: Web sharing functionality recommended');}
No value is returned when Kakao Talk Share is completed, and transmission success can be checked through Kakao Talk Share webhook.
To use Kakao Talk Share APIs in native app services, you need to set up Custom URL Scheme. Refer to the device environment-specific project configuration methods below.
- Android: Custom URL scheme
- iOS: Custom URL scheme
| Reference | App setting |
|---|---|
shareDefault()makeDefaultUrl() | Install Initialize |
| Permission | Prerequisite | Kakao Login | Consent items |
|---|---|---|---|
| - | Platform key Product Link | - | - |
Shares messages through Kakao Talk using predefined default templates.
- Check if Kakao Talk is installed: To check if it is possible to share a message through Kakao Talk, first call
isKakaoTalkSharingAvailable()to check if Kakao Talk is installed on the user's device.- If Kakao Talk is installed: Call
ShareClient'sshareDefault()to execute sharing. - If Kakao Talk is not installed: Call
WebSharerClient'smakeDefaultUrl(). When the request is successful, aUriis returned that executes web sharing functionality. Execute sharing by calling thelaunchBrowser()method with the returnedUri.
- If Kakao Talk is installed: Call
- Configure message template: For message creation, implement the
DefaultTemplateinterface, then use one of the classes below according to the desired template type to configure template objects.- Feed template:
FeedTemplate - List template:
ListTemplate - Location template:
LocationTemplate - Commerce template:
CommerceTemplate - Text template:
TextTemplate - Calendar template:
CalendarTemplate
- Feed template:
- Pass template object: When calling
shareDefault()ormakeDefaultUrl(), pass the previously configured template object as thetemplateparameter.
// Check if Kakao Talk execution is availablebool isKakaoTalkSharingAvailable = await ShareClient.instance.isKakaoTalkSharingAvailable();if (isKakaoTalkSharingAvailable) {try {await ShareClient.instance.shareDefault(template: defaultFeed);print('Kakao Talk Share completed');} catch (error) {print('Kakao Talk Share failed $error');}} else {try {Uri shareUrl = await WebSharerClient.instance.makeDefaultUrl(template: defaultFeed,);await launchBrowser(shareUrl);} catch (error) {print('Kakao Talk Share failed $error');}}
| Reference | App setting |
|---|---|
shareCustom()makeCustomUrl() | Install Initialize |
Shares messages through Kakao Talk using custom templates configured in [Tools] > [Message Template].
- Check if Kakao Talk is installed: To check if it is possible to share a message through Kakao Talk, first call
isKakaoTalkSharingAvailable()to check if Kakao Talk is installed on the user's device.- If Kakao Talk is installed: Call
ShareClient'sshareCustom()to execute sharing. - If Kakao Talk is not installed: Call
WebSharerClient'smakeCustomUrl(). When the request is successful, aUriis returned that executes web sharing functionality. Execute sharing by calling thelaunchBrowser()method with the returnedUri.
- If Kakao Talk is installed: Call
- Configure message template: Configure the message template in [Tools] > [Message Template]. For template configuration methods, refer to Custom template.
- Specify template: When calling
shareCustom()ormakeCustomUrl(), pass the template ID configured in the message template tool as thetemplateIdparameter. - Pass user arguments (optional): To include variable information in a message, add user arguments to the custom template, then pass key-value pairs to the
templateArgsparameter. For detailed usage and precautions, see Directly inputting user arguments.
// Custom template IDint templateId = '${YOUR_CUSTOM_TEMPLATE_ID}';// Check if Kakao Talk execution is availablebool isKakaoTalkSharingAvailable = await ShareClient.instance.isKakaoTalkSharingAvailable();if (isKakaoTalkSharingAvailable) {try {await ShareClient.instance.shareCustom(templateId: templateId);print('Kakao Talk Share completed');} catch (error) {print('Kakao Talk Share failed $error');}} else {try {Uri shareUrl = await WebSharerClient.instance.makeCustomUrl(templateId: templateId,templateArgs: {'key1': 'value1'},);await launchBrowser(shareUrl);} catch (error) {print('Kakao Talk Share failed $error');}}
| Reference | App setting |
|---|---|
shareScrap()makeScrapUrl() | Install Initialize |
| Permission | Prerequisite | Kakao Login | Consent items |
|---|---|---|---|
| - | Platform key Product Link | - | - |
Shares messages through Kakao Talk by configuring a scrap message with information from a specified web page.
- Check if Kakao Talk is installed: To check if it is possible to share a message through Kakao Talk, first call
isKakaoTalkSharingAvailable()to check if Kakao Talk is installed on the user's device.- If Kakao Talk is installed: Call
ShareClient'sshareScrap()to execute sharing. - If Kakao Talk is not installed: Call
WebSharerClient'smakeScrapUrl(). When the request is successful, aUriis returned that executes web sharing functionality. Execute sharing by calling thelaunchBrowser()method with the returnedUri.
- If Kakao Talk is installed: Call
- Specify web page URL for scraping: When calling
shareScrap()ormakeScrapUrl(), you must pass the URL of the web page to be scraped as theurlparameter. The domain of the web page to be scraped must be registered in [App] > [Product Link] > [Web domain] on the app management page. - Apply custom template (optional): If you want to send scrape messages based on service-defined message templates, you must pass the ID of the template configured in [Tools] > [Message Template] as the
templateIdparameter. For template configuration methods, refer to Custom template. - Pass user arguments (optional): To include variable information in a message, add user arguments to the custom template, then pass key-value pairs to the
templateArgsparameter. For detailed usage and precautions, see Directly inputting user arguments.
// Web page URL to be scrapedString url = "https://developers.kakao.com";// Check if Kakao Talk execution is availablebool isKakaoTalkSharingAvailable = await ShareClient.instance.isKakaoTalkSharingAvailable();if (isKakaoTalkSharingAvailable) {try {await ShareClient.instance.shareScrap(url: url);print('Kakao Talk Share completed');} catch (error) {print('Kakao Talk Share failed $error');}} else {try {Uri shareUrl = await WebSharerClient.instance.makeScrapUrl(url: url,templateArgs: {'key1': 'value1'},);await launchBrowser(shareUrl);} catch (error) {print('Kakao Talk Share failed $error');}}
// Custom template IDint templateId = '${YOUR_CUSTOM_TEMPLATE_ID}';// Web page URL to be scrapedString url = "https://developers.kakao.com";// Check if Kakao Talk execution is availablebool isKakaoTalkSharingAvailable = await ShareClient.instance.isKakaoTalkSharingAvailable();if (isKakaoTalkSharingAvailable) {try {await ShareClient.instance.shareScrap(url: url,templateId: templateId,);print('Kakao Talk Share completed');} catch (error) {print('Kakao Talk Share failed $error');}} else {try {Uri shareUrl = await WebSharerClient.instance.makeScrapUrl(url: url,templateId: templateId,templateArgs: {'key1': 'value1'},);await launchBrowser(shareUrl);} catch (error) {print('Kakao Talk Share failed $error');}}
Kakao Talk Share webhook is a function to send a webhook request to the URL specified on Kakao Developers when a Kakao Talk Share message is successfully sent to friends or a chatroom selected by a user.
Kakao Talk Share webhook can only be used when sending Kakao Talk Share messages and is not supported for Kakao Talk Message transmission. Kakao Talk Share is sent by users through Kakao Talk, so services cannot directly confirm whether the message was sent successfully. Therefore, a webhook function is provided to notify when message transmission is successful.
To use this feature, you need to:
- Set the webhook URL and request method by referring to Kakao Talk Share webhook setting.
- Build a server to receive a Kakao Talk Share webhook.
- Pass custom (Custom) parameters when calling the Kakao Talk Share API.
- Implement a process to handle the notification delivered to the webhook URL of your service server.
The Kakao Talk Share webhook sent to your service server does not include detailed message transmission information. To figure out additional information needed by the service, such as which message's transmission result it is and what content the user shared, you must use custom (Custom) parameters. Also, Kakao Talk Share messages without custom parameters will not deliver Kakao Talk Share webhooks.
Custom parameters must be passed as the serverCallbackArgs parameter when making Kakao Talk Share requests, and you cannot use system reserved words CHAT_TYPE, HASH_CHAT_ID, and TEMPLATE_ID as keys. These keys are included in the notification with the values defined in the specification of Kakao Talk Share webhook.
Below is an example of a Kakao Talk Share request including custom parameters.
try {// Pass custom parameters through serverCallbackArgs parameter// If this parameter is not used, Kakao Talk Share webhook will not be deliveredawait ShareClient.instance.defaultTemplate(template: defaultFeed, serverCallbackArgs: {'key1': 'value1'});print('Kakao Talk Share completed');} catch (error) {print('Kakao Talk Share failed $error');}
| Reference | App setting |
|---|---|
uploadImage()scrapImage()ImageUploadResultImageInfo | Install Initialize |
| Permission | Prerequisite | Kakao Login | Consent items |
|---|---|---|---|
| - | Platform key | - | - |
Uploads image files to the Kakao server or scrapes image URLs.
To add an image to a Kakao Talk message, you must use a URL issued by the Kakao server after uploading the image. If you are using a custom template, you can also upload images through the Message Template Tool.
To upload an image file to the Kakao server, call uploadImage(). Pass the image you want to upload using one of the following parameters:
imagePath: Upload by passing the image file path.byteData: Upload by passing the image asByteData.
If you want to scrape an image from the web to the Kakao server, call scrapImage().
If the request succeeds, an ImageUploadResult object is returned. You can check image information such as the image URL (to use in messages) within the ImageInfo inside this object.
- Image file size: up to 5 MB.
- Image storage period: stored on the Kakao server for up to 100 days, then automatically deleted.
// Local image file// This example uses an image file added as a project resource.// Prepare photo files needed for your service, such as from gallery.final ByteData byteData = await rootBundle.load('assets/images/cat1.png');// This example saves project resources as image files using path_provider.final File tempFile = File('${(await getTemporaryDirectory()).path}/cat1.png');final File file = await tempFile.writeAsBytes(byteData.buffer.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes));try {// Upload to Kakao image serverfinal ImageUploadResult imageUploadResult = await ShareClient.instance.uploadImage(imagePath: file.path);print('Image upload successful ${imageUploadResult.infos.original}');} catch (error) {print('Image upload failed $error');}
// Original image URLString url ='https://t1.kakaocdn.net/kakaocorp/Service/KakaoTalk/pc/slide/talkpc_theme_01.jpg';try {// Scrape image to Kakao serverImageUploadResult imageUploadResult =await ShareClient.instance.scrapImage(imageUrl: url);print('Image scraping successful''\n${imageUploadResult.infos.original}');} catch (error) {print('Image scraping failed $error');}