본문 바로가기메인 메뉴 바로가기사이드 메뉴 바로가기

kakao developers

Related sites
  • Docs
  • Tutorial
  • Send a custom message to yourself

사이드 메뉴

Search

This document explains, step by step, how to create a custom template with the Message Template Tool and send a message to yourself with the REST API Test Tool.

CategoryDetails
What you will learnSend a feed message that includes a header, image, title, button, and user name to your Kakao Talk My Chatroom (Preview the result→)
PrerequisitesLog in with a Kakao Developers account

You can compose a Kakao Talk message with a default template or a custom template. See Compare configuration methods for the differences between the two methods.

This tutorial uses a custom template, which you create with the Message Template Tool.

See Template types for the available message template types.

In this tutorial, you compose a Feed A type template.

Before sending a message with the Kakao Talk Message API, complete the app settings required for Kakao Login and message sending.

Requirements for sending a message to yourself
  • Integrate Kakao Login.
  • Configure the Send Kakao Talk Message consent item.
  • The recipient must consent to the talk_message consent item.

You need a Kakao Developers app to use Kakao APIs. See Create a Kakao Developers app and create an app to use.

  1. Select the app to use on the app management page.
  2. Go to [Kakao Login] > [General] and activate Kakao Login.
  3. In [App] > [Platform Key] > [REST API key], register a Kakao Login Redirect URI.

Consent item settings screen

  1. On the app management page, go to [Kakao Login] > [Consent Items].
  2. Under [Access permission], select [Settings] for [Send Kakao Talk Message].
  3. Select either [Optional consent] or [Consent during use] as the consent level, and enter the purpose of consent.
  4. Select [Save].

You can use only domains registered in the app for web links included in messages. Message sending may fail if you use an unregistered domain as a message link.

  1. On the app management page, go to [App] > [Product Link].
  2. Under [Web domain], select [Register web domain].
  3. In the [Register web domain] window, register the website domain to open from the message.
    • The first web domain you register becomes the [default web domain].

You cannot directly edit the value designated as the default web domain. Add another domain, change the default web domain, and then edit or delete the existing domain.

  1. Select [Edit domain].
  2. Select [+] and register another web domain.
  3. Select [Select default domain] to designate the newly added domain as the default web domain.
  4. Select [Edit domain] again to edit or delete the existing domain.

In this step, create a new template in the Message Template Tool and check the template ID.

  1. In [Tools] > [Message Template], select the Developers app to use for sending the message.
  2. Select the [A] [Add Message Template] button.
  3. Select [Feed (A)] for the template type, and then select [OK].
  4. In [C] Template title, enter a name or description that identifies the template. (Optional)
  5. Select the [D] [Save] button to save the message template.
  6. Check the [E] Template ID. You need this value when sending a message to yourself.

Create message template screen

Configure the image, header, title, body, and button of the feed message.

  1. In [Purpose] under Common settings, select [Kakao Talk Message API].
  2. Set Header to [ON], and then enter a title.
    • [Header name]: Recommendation for ${NAME}
    • Note: You cannot use both a header and a profile in Feed A type. This tutorial uses only a header.
  3. In Image, upload the image to display in the message.
  4. In Message Title / Content, enter the following:
    • [Message title]: Today's recommended content
    • [Content]: This is a Kakao Developers message template test.
  5. In Button, change the button name to one you want.
  6. Select [Save].
User argument

When you enter ${NAME} in the template, NAME is registered as a user argument. When sending a message, pass the NAME value in template_args to display different text for each user.

Configure links for clickable areas such as the message image, title, and button. You cannot configure links unless you register a web domain.

After you register a web domain, [Mobile web] and [PC web] are set to [ON] by default under [Common link]. Clickable areas without individual links open this common link.

You can apply different links to clickable components such as buttons, images, the message title/content, and the header.

To apply a link other than the common link to a component, select Set individual links under [Link settings] for the component. See Component link settings for details.

To apply different links based on the user environment, such as mobile/PC web, Android, or iOS, [set individual links] under Component link settings in the Message Template Tool.

In this tutorial, you configure individual links for the Button component that open different pages on mobile web and PC web.

  1. Under [Button] > [Link settings], select [Edit].
  2. In the [Link settings] window, select [Set individual links].
  3. Set [Mobile web] and [PC web] to [ON].
  4. Under [Web domain], select [Default web domain].
    • [A] Default web domain: Default web domain designated in [App] > [Product Link] > [Web domain]
    • [B] Web domain value: Domain registered in [App] > [Product Link] > [Web domain]
    • [C] User argument: Replaced with the default web domain value if the registered domain is not passed as a user argument
  5. Enter paths that apply differently to mobile and PC.
    • [Mobile web] > [Path]: Enter /m/today.
    • [PC web] > [Path]: Enter /today.
  6. Check the full links under [Link preview].
  7. Select [Edit].
  8. Select [Save] at the top of the Message Template Tool to save the changes.

Link settings > Set individual links screen

With the REST API Test Tool, call the Send me message with custom template API to check whether the saved template is sent correctly.

  1. Under [Authentication app], select the app where you created the template.
  2. Under [Access token], select [Get token].
  3. Select talk_message in the user information access scope, and then select [OK].
    • If this item is disabled, configure the talk_message consent item as described in 1-3. Set consent item.
  4. Log in with a Kakao Account. When the Consent screen appears, select and consent to [Send Kakao Talk Message].
  5. Enter the template ID checked in Create message template in template_id.
    • Example: 5595
  6. Enter the user argument values configured in Configure message components in JSON format in template_args.
    • Example: {"NAME":"Ryan"}
  7. Select [Send] to call the API with the values you entered.
  8. Check whether the message was sent successfully.

After testing, send messages from your service code in the following order.

  1. Through Kakao Login, issue an access token for a user who consented to the talk_message consent item.
  2. Apply the template ID created in the Message Template Tool to your code.
  3. If values differ by user, pass user argument values in template_args.
  4. Call the Send me message with custom template API.
curl -v -X POST "https://kapi.kakao.com/v2/api/talk/memo/send" \
-H "Content-Type: application/x-www-form-urlencoded;charset=utf-8" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-d "template_id=5595" \
-d 'template_args={"NAME":"Ryan"}'

To send a message to a friend, see Send Kakao Talk messages between service users.

ProblemWhat to check
The Send Kakao Talk Message consent item cannot be selected when issuing an access token.Check whether the app's consent item is configured.
The message sending API cannot find the template.Check template_id, selected app, and whether the template was saved.
${NAME} is displayed as-is in the message.Check whether the NAME value is passed in template_args.
The page does not open when selecting a link.Check web domain registration and the link path.
The app does not launch from the message.Check the native app key, custom URL scheme, and native app scheme in Common settings.
The same screen opens on Android and iOS.Check whether the app scheme parameters differ by OS.

For detailed error causes, see Kakao Talk Message error codes and Message Template FAQ.

Was this helpful?

    Tutorial > Send a custom message to yourself - Kakao Developers | Docs