페이지 이동경로
  • Docs>
  • Kakao Talk Message>
  • JavaScript

Kakao Talk Message

JavaScript

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

You can test the features described in this document in [Tools] > [JS SDK demo] menu.

The Kakao Talk Message API only supports sending messages between users within the same service, and the Kakao Talk Social API permission is required to provide the message sending feature to friends. For more details, see Message sending features and How to use.

Before you begin

You need to select which API to call based on the type of message to send and the configuration method. Follow the steps below to select the API to use before development.

Choose implementation method

1. Select message sending feature

Kakao Developers provides two types of message sending features: Kakao Talk Share and Kakao Talk Message. Refer to Message sending features to select the feature to use. If you want to use Kakao Talk Message, perform the following steps.

REST API call

The JavaScript SDK does not support Kakao Talk Message API in built-in function form. To use Kakao Talk Message API with JavaScript SDK on a web page, use the Kakao.API.request function to make a request to the same URL as the REST API.

2. Select message type and configuration method

Refer to Template types to decide which message template to use.

You can configure messages to send using default templates based on predefined templates in object form, or custom templates configured directly for your service. Refer to Configuration method comparison.

3. Select message target

Note that for Kakao Talk Message, the APIs used are distinguished according to the message targets.

Target Description
Send to me Sends a message to the "Me" chat in Kakao Talk of the currently logged-in user. This feature cannot send messages to other users and can only send messages to the logged-in user themselves.
Send to friends Sends a message to friends in Kakao Talk of the currently logged-in user.
Important: Additional feature request is required.
You must implement a process to receive recipient information through Picker or Retrieve Kakao Talk friends list. You can send messages to up to 5 friends at once. Daily and monthly quotas are set, so refer to Quota.
Note: Permission Required

If you want to send messages to friends, you must request permission. See Usage policy.


Set custom URL scheme

Kakao Talk messages include a link to open the specified web page or app. The buttons in the message launch the app through a Custom URL Scheme consisting of a URI scheme and parameters. For detailed setup instructions, refer to Custom URL scheme setup.

Send me message with default template

Basic information
Reference App setting
Kakao.API.request() Install
Initialize
Set custom URL scheme
Permission Prerequisite Kakao Login Consent items
- Register platforms
Activate Kakao Login
Consent items
Required Required:
Send message in Kakao Talk (talk_message)

This is an API that sends a message to me by defining components as objects according to predefined template formats.

First, you need to configure objects according to the desired template type. For configuration methods, refer to Default template.

When calling the Kakao.API.request() function, pass the previously configured template object as the template_object parameter.

Kakao.API.request() returns a Promise. For the response content when the request succeeds, refer to REST API.

Request

Parameter
Name Type Description Required
url String Fixed to /v2/api/talk/memo/default/send. O
data Object Parameters to pass to the API. O
data: Sending me message with default template
Name Type Description Required
template_object Object Object containing message components
One of Feed, List, Location, Commerce, Text, Calendar
O

Sample

Kakao.API.request({
  url: '/v2/api/talk/memo/default/send',
  data: {
    template_object: {
      object_type: 'feed',
      content: {
        title: 'Strawberry cheese cake',
        description: '#cake #strawberry #cafe #atmosphere #blinddate',
        image_url:
          'https://mud-kage.kakao.com/dn/Q2iNx/btqgeRgV54P/VLdBs9cvyn8BJXB3o7N8UK/kakaolink40_original.png',
        link: {
          web_url: 'https://developers.kakao.com',
          mobile_web_url: 'https://developers.kakao.com',
        },
      },
      item_content: {
        profile_text: 'Kakao',
        profile_image_url: 'https://mud-kage.kakao.com/dn/Q2iNx/btqgeRgV54P/VLdBs9cvyn8BJXB3o7N8UK/kakaolink40_original.png',
        title_image_url: 'https://mud-kage.kakao.com/dn/Q2iNx/btqgeRgV54P/VLdBs9cvyn8BJXB3o7N8UK/kakaolink40_original.png',
        title_image_text: 'Cheese cake',
        title_image_category: 'Cake',
        items: [
          {
            item: 'Cake1',
            item_op: '1000 won',
          },
          {
            item: 'Cake2',
            item_op: '2000 won',
          },
          {
            item: 'Cake3',
            item_op: '3000 won',
          },
          {
            item: 'Cake4',
            item_op: '4000 won',
          },
          {
            item: 'Cake5',
            item_op: '5000 won',
          },
        ],
        sum: 'Total',
        sum_op: '15000 won',
      },
      social: {
        like_count: 100,
        comment_count: 200,
      },
      buttons: [
        {
          title: 'View on Web',
          link: {
            mobile_web_url: 'https://developers.kakao.com',
            web_url: 'https://developers.kakao.com',
          },
        },
        {
          title: 'View on App',
          link: {
            mobile_web_url: 'https://developers.kakao.com',
            web_url: 'https://developers.kakao.com',
          },
        },
      ],
    },
  },
})
  .then(function(response) {
    console.log(response);
  })
  .catch(function(error) {
    console.log(error);
  });

Send me message with custom template

Basic information
Reference App setting
Kakao.API.request() Install
Initialize
Set custom URL scheme
Permission Prerequisite Kakao Login Consent items
- Register platforms
Activate Kakao Login
Consent items
Message template
Required Required:
Send message in Kakao Talk (talk_message)

This API sends a message to the currently logged-in user's Kakao Talk using custom templates directly configured in [Tools] > [Message Template]. For template configuration methods, refer to Custom template.

When calling the Kakao.API.request() function, you must pass the custom template ID as the template_id parameter.

Kakao.API.request() returns a Promise. For the response content when the request succeeds, refer to REST API.

Request

Parameter
Name Type Description Required
url String Fixed to /v2/api/talk/memo/send. O
data Object Parameters to pass to the API. O
data: Sending me message with custom template
Name Type Description Required
template_id Number Message template ID configured in [Tools] > [Message Template]. O
template_args Object Required when the message template specified by template_id uses user arguments
Pass in key:value format
Important: If you do not use this parameter even though the custom template uses user arguments, the part specified as user arguments will be exposed in the message as ${KEY} format
X

Sample

Kakao.API.request({
  url: '/v2/api/talk/memo/send',
  data: {
    template_id: ${YOUR_TEMPLATE_ID},
  },
})
  .then(function(response) {
    console.log(response);
  })
  .catch(function(error) {
    console.log(error);
  });

Send me scrape message

Basic information
Reference App setting
Kakao.API.request() Install
Initialize
Set custom URL scheme
Permission Prerequisite Kakao Login Consent items
- Register platforms
Activate Kakao Login
Consent items
Required Required:
Send message in Kakao Talk
(talk_message)

This API configures a scrape message with information scraped from a specified web page and sends a message to me. If you need to send to other users, use the Send scrape message API.

When calling the Kakao.API.request() function, you must pass the web page URL to scrape as the request_url parameter. The domain of the web page to be scraped must be registered in [App] > [General] > [Platform] > [Web] on the app management page.

Kakao.API.request() returns a Promise. For the response content when the request succeeds, refer to REST API.

Request

Parameter
Name Type Description Required
url String Fixed to /v2/api/talk/memo/scrap/send. O
data Object Parameters to pass to the API. O
data: Sending me scrape message
Name Type Description Required
request_url String Web page URL to be scraped
Important: Only domains registered in [App] > [General] > [Platform] > [Web] on the app management page can be used
O
template_id Number Message template ID configured in [Tools] > [Message Template]
Used when you want to send scrape messages based on service-defined message templates
(Refer to: Custom template)
X
template_args Object Required when the message template specified by template_id uses user arguments
Pass in key:value format
Cannot overwrite (overwrite) scrape results
Important: If you do not use this parameter even though the custom template uses user arguments, the part specified as user arguments will be exposed in the message as ${KEY} format
X

Example: Using default template

Kakao.API.request({
  url: '/v2/api/talk/memo/scrap/send',
  data: {
    request_url: 'https://developers.kakao.com',
  },
})
  .then(function(response) {
    console.log(response);
  })
  .catch(function(error) {
    console.log(error);
  });

Example: Using custom template

Kakao.API.request({
  url: '/v2/api/talk/memo/scrap/send',
  data: {
    request_url: 'https://developers.kakao.com',
    template_id: ${YOUR_TEMPLATE_ID},
  },
})
  .then(function(response) {
    console.log(response);
  })
  .catch(function(error) {
    console.log(error);
  });

Send friends message with default template

Basic information
Reference App setting
Kakao.API.request() Install
Initialize
Set custom URL scheme
Permission Prerequisite Kakao Login Consent items
Required:
Permission
Register platforms
Activate Kakao Login
Consent items
Required Required:
Send message in Kakao Talk (talk_message)

This API sends a message using default templates.

First, you need to configure objects according to the desired template type. For configuration methods, refer to Default template.

When calling the Kakao.API.request() function, pass the previously configured template object as the template_object parameter.

Kakao.API.request() returns a Promise. For the response content when the request succeeds, refer to REST API.

Request

Parameter
Name Type Description Required
url String Fixed to /v1/api/talk/friends/message/default/send. O
data Object Parameters to pass to the API. O
data: Sending friends message with default template
Name Type Description Required
receiver_uuids String[] User uuid values obtained through Picker or Retrieve Kakao Talk friends list API
Can send messages to up to 5 users at once
O
template_object Object Object containing message components
One of Feed, List, Location, Commerce, Text, Calendar
O

Sample

Kakao.API.request({
  url: '/v1/api/talk/friends/message/default/send',
  data: {
    receiver_uuids: ['${RECEIVER_UUID}'],
    template_object: {
      object_type: 'feed',
      content: {
        title: 'Strawberry cheese cake',
        description: '#cake #strawberry #cafe #atmosphere #blinddate',
        image_url:
          'https://mud-kage.kakao.com/dn/Q2iNx/btqgeRgV54P/VLdBs9cvyn8BJXB3o7N8UK/kakaolink40_original.png',
        link: {
          web_url: 'https://developers.kakao.com',
          mobile_web_url: 'https://developers.kakao.com',
        },
      },
      item_content: {
        profile_text: 'Kakao',
        profile_image_url: 'https://mud-kage.kakao.com/dn/Q2iNx/btqgeRgV54P/VLdBs9cvyn8BJXB3o7N8UK/kakaolink40_original.png',
        title_image_url: 'https://mud-kage.kakao.com/dn/Q2iNx/btqgeRgV54P/VLdBs9cvyn8BJXB3o7N8UK/kakaolink40_original.png',
        title_image_text: 'Cheese cake',
        title_image_category: 'Cake',
        items: [
          {
            item: 'Cake1',
            item_op: '1000 won',
          },
          {
            item: 'Cake2',
            item_op: '2000 won',
          },
          {
            item: 'Cake3',
            item_op: '3000 won',
          },
          {
            item: 'Cake4',
            item_op: '4000 won',
          },
          {
            item: 'Cake5',
            item_op: '5000 won',
          },
        ],
        sum: 'Total',
        sum_op: '15000 won',
      },
      social: {
        like_count: 100,
        comment_count: 200,
      },
      buttons: [
        {
          title: 'View on Web',
          link: {
            mobile_web_url: 'https://developers.kakao.com',
            web_url: 'https://developers.kakao.com',
          },
        },
        {
          title: 'View on App',
          link: {
            mobile_web_url: 'https://developers.kakao.com',
            web_url: 'https://developers.kakao.com',
          },
        },
      ],
    },
  },
})
  .then(function(response) {
    console.log(response);
  })
  .catch(function(error) {
    console.log(error);
  });

Send friends message with custom template

Basic information
Reference App setting
Kakao.API.request() Install
Initialize
Set custom URL scheme
Permission Prerequisite Kakao Login Consent items
Required:
Permission
Register platforms
Activate Kakao Login
Consent items
Message template
Required Required:
Send message in Kakao Talk (talk_message)

This API sends a message to the currently logged-in user's Kakao Talk using custom templates directly configured in [Tools] > [Message Template]. For template configuration methods, refer to Custom template.

When calling the Kakao.API.request() function, you must pass the custom template ID as the template_id parameter.

Kakao.API.request() returns a Promise. For the response content when the request succeeds, refer to REST API.

Request

Parameter
Name Type Description Required
url String Fixed to /v1/api/talk/friends/message/send. O
data Object Parameters to pass to the API. O
data: Sending friends message with custom template
Name Type Description Required
receiver_uuids String[] User uuid values obtained through Picker or Retrieve Kakao Talk friends list API
Can send messages to up to 5 users at once
O
template_id Number Message template ID configured in [Tools] > [Message Template]. O
template_args Object Required when the message template specified by template_id uses user arguments
Pass in key:value format
Important: If you do not use this parameter even though the custom template uses user arguments, the part specified as user arguments will be exposed in the message as ${KEY} format
X

Example

Kakao.API.request({
  url: '/v1/api/talk/friends/message/send',
  data: {
    receiver_uuids: ['${RECEIVER_UUID}'],
    template_id: ${YOUR_TEMPLATE_ID},
  },
})
  .then(function(response) {
    console.log(response);
  })
  .catch(function(error) {
    console.log(error);
  });

Send friends scrape message

Basic information
Reference App setting
Kakao.API.request() Install
Initialize
Set custom URL scheme
Permission Prerequisite Kakao Login Consent items
Required:
Permission
Register platforms
Activate Kakao Login
Consent items
Required Required:
Send message in Kakao Talk
(talk_message)

This API configures a scrape message with information scraped from a specified web page and sends a message.

When calling the Kakao.API.request() function, you must pass the web page URL to scrape as the request_url parameter. The domain of the web page to be scraped must be registered in [App] > [General] > [Platform] > [Web] on the app management page.

Kakao.API.request() returns a Promise. For the response content when the request succeeds, refer to REST API.

Request

Parameter
Name Type Description Required
url String Fixed to /v1/api/talk/friends/message/scrap/send. O
data Object Parameters to pass to the API. O
data: Sending friends scrape message with default template
Name Type Description Required
receiver_uuids String[] User uuid values obtained through Picker or Retrieve Kakao Talk friends list API.
Can send messages to up to 5 users at once.
O
request_url String Web page URL to be scraped.
Important: Only domains registered in [App] > [General] > [Platform] > [Web] on the app management page can be used.
O
template_id Number Message template ID configured in [Tools] > [Message Template].
Used when you want to send a scrape message with the template registered in [Tools] > [Message Template].
Specify the ID of the template to apply.
When you use this parameter, the scraped content is applied in the template with the specified template_id.
X
template_args Object If you specify template_id and the specified template contains other user arguments besides the default argument keys, pass the user arguments using this parameter in key:value format.
Cannot overwrite scrape results.
X

Example: Using default template

Kakao.API.request({
  url: '/v1/api/talk/friends/message/scrap/send',
  data: {
    receiver_uuids: ['${RECEIVER_UUID}'],
    request_url: 'https://developers.kakao.com',
  },
})
  .then(function(response) {
    console.log(response);
  })
  .catch(function(error) {
    console.log(error);
  });

Example: Using custom template

Kakao.API.request({
  url: '/v1/api/talk/friends/message/scrap/send',
  data: {
    receiver_uuids: ['${RECEIVER_UUID}'],
    request_url: 'https://developers.kakao.com',
    template_id: ${YOUR_TEMPLATE_ID},
  },
})
  .then(function(response) {
    console.log(response);
  })
  .catch(function(error) {
    console.log(error);
  });

Upload image

You can attach images to a message by passing an image URL when configuring a message template or by uploading images in the Message template tool in advance. For detailed instructions and examples, see Upload image.

See more

```