페이지 이동경로
  • Docs>
  • Message>
  • Kakao Talk Messaging: Android

Message

Kakao Talk: Android

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

Before you begin

Choose an API to use

According to your service's purpose and requirements, you need to decide which API to use first by considering their characteristics and difference.

1. Select a type of Messaging API

There are two types of messaging APIs: the Kakao Talk Sharing API and the Kakao Talk Messaging API. You need to understand the differences between the two messaging APIs completely by referring to Concepts, and decide which API to use to implement the function to send a message.

2. Select a message type and configuration method

Decide which message template to use by referring to Message template > Types.

You can configure a message as an object according to the default template or create a custom template in person for your service. Refer to How to use for more details.

3. Select a target

Note that the Kakao Talk Messaging APIs are categorized according to the message targets:

  • Send to me: Provides a feature to send a message to the currently logged-in user through Kakao Talk that is linked to the user's Kakao Account. This API is only allowed to send a message to the currently logged-in user, not to the user's friends.
  • Send to friends: Provides a feature to send a message to user's friends through Kakao Talk that is linked to the Kakao Account of the currently logged-in user. You need to implement a process to get information about the message recipients through the Friends picker or the Retrieving a list of Kakao Talk friends API. Users can send a message to up to 5 friends at a time. The Kakao Talk Messaging API provides daily and monthly quotas. Refer to the quota.
Note

To send a Kakao Talk message to friends, 1. Get permission. Before permission is granted to your app, you can only retrieve the list of the team members. 2. Enable the 'Send message in KakaoTalk' scope in [My Application] > [Kakao Login] > [Consent items]. A user must also consent to the scope. To see more about the conditions for providing friend information, refer to Usage policy.

APIs by conditions

According to the desired message type, the required components of the message and the method to call are different. Refer to Message template components and samples.

Message type Configuration method Target Method
Feed, List, Location, Commerce, Text, Calendar Default template Me (MyChatroom) sendDefaultMemo()
Feed, List, Location, Commerce, Text, Calendar Default template Friends sendDefaultMessage()
Feed, List, Commerce Custom template Me (MyChatroom) sendCustomMemo()
Feed, List, Commerce Custom template Friends sendCustomMessage()
Scrape Default template Me (MyChatroom) sendScrapMemo()
Scrape Default template Friends sendScrapMessage()
Scrape Custom template Me (MyChatroom) sendScrapMemo()
Scrape Custom template Friends sendScrapMessage()

Set Custom URL Scheme

To make your app launch when a user clicks a button in the Kakao Talk message, you must set a scheme to launch an app in AndroidManifest.xml. Refer to Set Custom URL Scheme.

Configure a message

The method of configuring a message to use the Kakao Talk Messaging API is the same as the Kakao Talk Sharing API. Refer to Kakao Talk Sharing: Android > Configure a message.

Send message with default template

Basic information
Reference App setting
[SDK, RxSDK] sendDefaultMemo()
[SDK, RxSDK] sendDefaultMessage()
[SDK] DefaultTemplate
[SDK] MessageSendResult
[SDK] MessageFailureInfo
Install
Initialize
Set Custom URL Scheme
Permission Prerequisite Kakao Login User consent
- Register platforms
Activate Kakao Login
Manage consent items
Required Required:
Send message in KakaoTalk

This API enables you to configure a message as an object type according to the default template type to use.

To send a message to friends, obtain the receiving users' uuids through the Friends picker or the Retrieving list of friends API, and then pass the uuids as the receiverUuids parameter. You can send a message to up to five friends at once.

If the request is successful, the Android SDK launches Kakao Talk or lets a user log in with Kakao Account on a web page, and then shows a list of friends or chatrooms. When a user selects friends or a chatroom to send the message to, the messages are sent to the selected targets.

If the request is failed, it returns MessageFailureInfo that contains the failure result. Find out the cause of the failure using receiverUuids, code, and msg in MessageFailureInfo by referring to REST API Reference.

Send to me

Sample

Kotlin
RxKotlin
TalkApiClient.instance.sendDefaultMemo(defaultFeed) { error ->
    if (error != null) {
        Log.e(TAG, "Failed to send me a message.", error)
    } else {
        Log.i(TAG, "Succeeded in sending me a message.")
    }
}
var disposables = CompositeDisposable()

TalkApiClient.rx.sendDefaultMemo(defaultFeed)
    .retryWhen(
        // Retry the request to send a message after requesting additional consent to resolve the InsufficientScope error.
        RxAuthOperations.instance.incrementalAuthorizationRequired(context)
    )
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe({
        Log.i(TAG, "Succeeded in sending me a message.")
    }, { error ->
        Log.e(TAG, "Failed to send me a message.", error)
    })
    .addTo(disposables)

Send to friends

Sample

Kotlin
RxKotlin
// Retrieve a list of friends.
TalkApiClient.instance.friends { friends, error ->
    if (error != null) {
        Log.e(TAG, "Failed to retrieve a list of friends.", error)
    }
    else {
        Log.d(TAG, "Succeeded in retrieving a list of friends: \n${friends!!.elements.joinToString("\n")}")

        if (friends.elements.isEmpty()) {
            Log.e(TAG, "There is no friend to send a message to :(")
        }
        else {

            // Retrieve UUIDs of the friends to send a message according to your service's environment.
            // This sample displays the Friends list and collects the UUIDs of the friends selected by a user. 
            FriendsActivity.startForResult(
                context,
                friends.elements.map { PickerItem(it.uuid, it.profileNickname, it.profileThumbnailImage) }
            ) { selectedItems ->
                if (selectedItems.isEmpty()) return@startForResult
                Log.d(TAG, "Selected friends:\n${selectedItems.joinToString("\n")}")


                // List of UUIDs of recipients to send a message.
                val receiverUuids = selectedItems

                // Feed message.
                val template = defaultFeed

                // Send a scrape message.
                TalkApiClient.instance.sendDefaultMessage(receiverUuids, template) { result, error ->
                    if (error != null) {
                        Log.e(TAG, "Failed to send a message.", error)
                    }
                    else if (result != null) {
                        Log.i(TAG, "Succeeded in sending a message to ${result.successfulReceiverUuids}")

                        if (result.failureInfos != null) {
                            Log.d(TAG, "Succeed! But failed to send a message to some friends: \n${result.failureInfos}")
                        }
                    }
                }
            }
        }
    }
}
var disposables = CompositeDisposable()

// Retrieve a list of friends.
TalkApiClient.rx.friends()

    // Retrieve UUIDs of the friends to send a message according to your service's environment.
    // This sample displays the Friends list and collects the UUIDs of the friends selected by a user.  
    .flatMap { friends ->
        FriendsActivity.startForResult(
            context,
            friends.elements.map { PickerItem(it.uuid, it.profileNickname, it.profileThumbnailImage) }
        )
    }
    .observeOn(Schedulers.io())
    .flatMap { selectedItems ->

        // List of UUIDs of recipients to send a message.
        val receiverUuids = selectedItems

        // Feed message
        val template = defaultFeed

        TalkApiClient.rx.sendDefaultMessage(receiverUuids, template)
    }
    .retryWhen(
        // Retry the request to send a message after requesting additional consent to resolve the InsufficientScope error.
        RxAuthOperations.instance.incrementalAuthorizationRequired(context)
    )
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe({ result ->
        Log.i(TAG, "Succeeded in sending a message to ${result.successfulReceiverUuids}")

        if (result.failureInfos != null) {
            Log.d(TAG, "Succeed! But failed to send a message to some friends: \n${result.failureInfos}")
        }
    }, { error ->
        Log.e(TAG, "Failed to send a message.", error)
    })
    .addTo(disposables)

Send message with custom template

Basic information
Reference App setting
[SDK, RxSDK] sendCustomMemo()
[SDK, RxSDK] sendCustomMessage()
[SDK] MessageSendResult
[SDK] MessageFailureInfo
Install
Initialize
Set Custom URL Scheme
Permission Prerequisite Kakao Login User consent
- Register platforms
Activate Kakao Login
Manage consent items
Message Template
Required Required:
Send message in KakaoTalk

Unlike the Sending message with default template, you can customize a template in [Tools] > [Message Template Builder] to send a message.

Set templateId to the template ID of the custom template registered in [Message Template Builder]. If you use user arguments for some components when you configure a custom message to input variable information, you must also pass key and value pairs as the value of templateArgs. Otherwise, the defined argument is displayed to users as raw data, such as ${key}.

To send a message to friends, obtain the receiving users' uuids through the Friends picker or the Retrieving list of friends API, and then pass the uuids as the receiverUuids parameter. You can send a message to up to five friends at once.

If the request is successful, the Android SDK launches Kakao Talk or lets a user log in with Kakao Account on a web page, and then shows a list of friends or chatrooms. When a user selects friends or a chatroom to send the message to, the messages are sent to the selected targets.

If the request is failed, it returns MessageFailureInfo that contains the failure result. Find out the cause of the failure using receiverUuids, code, and msg in MessageFailureInfo by referring to REST API Reference.

Send to me

Sample

Kotlin
RxKotlin
// Template ID of the custom template.
//  * Refer to the guide: https://developers.kakao.com/docs/latest/en/message/message-template
val templateId = templateIds["customMessage"] as Long

TalkApiClient.instance.sendCustomMemo(templateId) { error ->
    if (error != null) {
        Log.e(TAG, "Failed to send me a message.", error)
    } else {
        Log.i(TAG, "Succeeded in sending me a message.")
    }
}
var disposables = CompositeDisposable()

// Template ID of the custom template registered in [Tools] > [Message Template Builder]. 
//  * Refer to the guide: https://developers.kakao.com/docs/latest/en/message/message-template
val templateId = templateIds["customMessage"] as Long

TalkApiClient.rx.sendCustomMemo(templateId)
    .retryWhen(
        // Retry the request to send me a message after requesting additional consent to resolve the InsufficientScope error.
        RxAuthOperations.instance.incrementalAuthorizationRequired(context)
    )
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe({
        Log.i(TAG, "Succeeded in sending me a message.")
    }, { error ->
        Log.e(TAG, "Failed to send me a message.", error)
    })
    .addTo(disposables)

Send to friends

Sample

Kotlin
RxKotlin
// Retrieve a list of friends.
TalkApiClient.instance.friends { friends, error ->
    if (error != null) {
        Log.e(TAG, "Failed to retrieve a list of friends.", error)
    }
    else if (friends != null) {
        Log.d(TAG, "Succeeded in retrieving a list of friends: \n${friends.elements.joinToString("\n")}")

        if (friends.elements.isEmpty()) {
            Log.e(TAG, "There is no friend to send a message to :")
        }
        else {

            // Retrieve UUIDs of the friends to send a message according to your service's environment.

                // List of UUIDs of recipients to send a message.
                val receiverUuids = selectedItems

                // Template ID of the custom template.
                //  * Refer to the guide: https://developers.kakao.com/docs/latest/en/message/message-template
                val templateId = templateIds["customMessage"] as Long

                // Send a scrape message.
                TalkApiClient.instance.sendCustomMessage(receiverUuids, templateId) { result, error ->
                    if (error != null) {
                        Log.e(TAG, "Failed to send a message.", error)
                    }
                    else if (result != null){
                        Log.i(TAG, "Succeeded in sending a message to ${result.successfulReceiverUuids}")

                        if (result.failureInfos != null) {
                            Log.d(TAG, "Succeed! But failed to send a message to some friends: \n${result.failureInfos}")
                        }
                    }
                }
            }
        }
    }
}
var disposables = CompositeDisposable()

// Retrieve a list of friends.
TalkApiClient.rx.friends()

    // Retrieve UUIDs of the friends to send a message according to your service's environment.
    
    .observeOn(Schedulers.io())
    .flatMap { selectedItems ->

        // List of UUIDs of recipients to send a message.
        val receiverUuids = selectedItems

        // Template ID of the custom template.
        //  * Refer to the guide: https://developers.kakao.com/docs/latest/en/message/message-template
        val templateId = templateIds["customMessage"] as Long

        TalkApiClient.rx.sendCustomMessage(receiverUuids, templateId)
    }
    .retryWhen(
        // Retry the request to send a message after requesting additional consent to resolve the InsufficientScope error.
        RxAuthOperations.instance.incrementalAuthorizationRequired(context)
    )
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe({ result ->
        Log.i(TAG, "Succeeded in sending a message to ${result.successfulReceiverUuids}")

        if (result.failureInfos != null) {
            Log.d(TAG, "Succeed! But failed to send a message to some friends: \n${result.failureInfos}")
        }
    }, { error ->
        Log.e(TAG, "Failed to send a message.", error)
    })
    .addTo(disposables)

Send scrape message with default template

Basic information
Reference App setting
[SDK, RxSDK] sendScrapMemo()
[SDK, RxSDK] sendScrapMessage()
[SDK] DefaultTemplate
[SDK] MessageSendResult
[SDK] MessageFailureInfo
Install
Initialize
Set Custom URL Scheme
Permission Prerequisite Kakao Login User consent
- Register platforms
Activate Kakao Login
Manage consent items
Required Required:
Send message in KakaoTalk

This API scrapes a web page, and then configures a message based on the scraped web page information to send a message. Thus, when you request to send a scrape message, you must pass url, a web page to be scraped. Make sure that you have registered the domain of the web page to be scraped as a site domain in [My Application] > [Platform] > [Web] in advance.

To send a message to friends, obtain the receiving users' uuids through the Friends picker or the Retrieving list of friends API, and then pass the uuids as the receiverUuids parameter. You can send a message to up to five friends at once.

If the request is successful, the Android SDK launches Kakao Talk or lets a user log in with Kakao Account on a web page, and then shows a list of friends or chatrooms. When a user selects friends or a chatroom to send the message to, the messages are sent to the selected targets.

If the request is failed, it returns MessageFailureInfo that contains the failure result. Find out the cause of the failure using receiverUuids, code, and msg in MessageFailureInfo by referring to REST API Reference.

Send to me

Sample

Kotlin
RxKotlin
// Web page URL to be shared.
//  * CAUTION: The domain of the URL to be shared must be registered in [My Appliction] > [Platform] > [Web] in Kakao Developers.
val url = "https://developers.kakao.com"

TalkApiClient.instance.sendScrapMemo(url) { error ->
    if (error != null) {
        Log.e(TAG, "Failed to send me a message.", error)
    }
    else {
        Log.i(TAG, "Succeeded in sending me a message.")
    }
}
var disposables = CompositeDisposable()

// Web page URL to be shared.
//  * CAUTION: The domain of the URL to be shared must be registered in [My Appliction] > [Platform] > [Web] in Kakao Developers.
val url = "https://developers.kakao.com"

TalkApiClient.rx.sendScrapMemo(url)
    .retryWhen(
        // Retry the request to send me a message after requesting additional consent to resolve the InsufficientScope error.
        RxAuthOperations.instance.incrementalAuthorizationRequired(context)
    )
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe({
        Log.i(TAG, "Succeeded in sending me a message.")
    }, { error ->
        Log.e(TAG, "Failed to send me a message.", error)
    })
    .addTo(disposables)

Send to friends

Sample

Kotlin
RxKotlin
// Retrieve a list of friends.
TalkApiClient.instance.friends { friends, error ->
    if (error != null) {
        Log.e(TAG, "Failed to retrieve a list of friends.", error)
    }
    else {
        Log.d(TAG, "Succeeded in retrieving a list of friends: \n${friends!!.elements.joinToString("\n")}")

        if (friends.elements.isEmpty()) {
            Log.e(TAG, "There is no friend to send a message to :(")
        } else {

            // Retrieve UUIDs of the friends to send a message according to your service's environment.
            // This sample displays the Friends list and collects the UUIDs of the friends selected by a user. 
            FriendsActivity.startForResult(
                context,
                friends.elements.map { PickerItem(it.uuid, it.profileNickname, it.profileThumbnailImage) }
            ) { selectedItems ->
                if (selectedItems.isEmpty()) return@startForResult
                Log.d(TAG, "Selected friends:\n${selectedItems.joinToString("\n")}")


                // List of UUIDs of recipients to send a message.
                val receiverUuids = selectedItems

                // Web page URL to be shared.
                //  * CAUTION: The domain of the URL to be shared must be registered in [My Appliction] > [Platform] > [Web] in Kakao Developers.
                val url = "https://developers.kakao.com"

                // Send a scrape message.
                TalkApiClient.instance.sendScrapMessage(receiverUuids, url) { result, error ->
                    if (error != null) {
                        Log.e(TAG, "Failed to send a message.", error)
                    }
                    else if (result != null) {
                        Log.i(TAG, "Succeeded in sending a message to ${result.successfulReceiverUuids}")

                        if (result.failureInfos != null) {
                            Log.d(TAG, "Succeed! But failed to send a message to some friends: \n${result.failureInfos}")
                        }
                    }
                }
            }
        }
    }
}
var disposables = CompositeDisposable()

// Retrieve a list of friends.
TalkApiClient.rx.friends()

    // Retrieve UUIDs of the friends to send a message according to your service's environment.
    // This sample displays the Friends list and collects the UUIDs of the friends selected by a user.  
    .flatMap { friends ->
        FriendsActivity.startForResult(
            context,
            friends.elements.map { PickerItem(it.uuid, it.profileNickname, it.profileThumbnailImage) }
        )
    }
    .observeOn(Schedulers.io())
    .flatMap { selectedItems ->

        // List of UUIDs of recipients to send a message.
        val receiverUuids = selectedItems

        // Web page URL to be shared.
        //  * CAUTION: The domain of the URL to be shared must be registered in [My Appliction] > [Platform] > [Web] in Kakao Developers.
        val url = "https://developers.kakao.com"

        TalkApiClient.rx.sendScrapMessage(receiverUuids, url)
    }
    .retryWhen(
        // Retry the request to send a message after requesting additional consent to resolve the InsufficientScope error.
        RxAuthOperations.instance.incrementalAuthorizationRequired(context)
    )
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe({ result ->
        Log.i(TAG, "Succeeded in sending a message to ${result.successfulReceiverUuids}")

        if (result.failureInfos != null) {
            Log.d(TAG, "Succeed! But failed to send a message to some friends: \n${result.failureInfos}")
        }
    }, { error ->
        Log.e(TAG, "Failed to send a message.", error)
    })
    .addTo(disposables)

Send scrape message with custom template

Basic information
Reference App setting
[SDK, RxSDK] sendScrapMemo()
[SDK, RxSDK] sendScrapMessage()
[SDK] MessageSendResult
[SDK] MessageFailureInfo
Install
Initialize
Set Custom URL Scheme
Permission Prerequisite Kakao Login User consent
- Register platforms
Activate Kakao Login
Manage consent items
Message Template
Required Required:
Send message in KakaoTalk

This API scrapes a web page, and then configures a message based on the scraped web page information to send a message. Unlike the Sending scrape message with default template, you can use a custom template registered in [Tools] > [Message Template Builder] when requesting to send a scrape message.

When you request to send a scrape message, you must pass url, a web page to be scraped. Make sure that you have registered the domain of the web page to be scraped as a site domain in [My Application] > [Platform] > [Web] in advance.

Also, you must set templateId to the template ID of the custom template registered in [Message Template Builder]. If you use user arguments for some components when you configure a custom message to input variable information, you must also pass key and value pairs as the value of templateArgs. Otherwise, the defined argument is displayed to users as raw data, such as ${key}.

To send a message to friends, obtain the receiving users' uuids through the Friends picker or the Retrieving list of friends API, and then pass the uuids as the receiverUuids parameter. You can send a message to up to five friends at once.

If the request is successful, the Android SDK launches Kakao Talk or lets a user log in with Kakao Account on a web page, and then shows a list of friends or chatrooms. When a user selects friends or a chatroom to send the message to, the messages are sent to the selected targets.

If the request is failed, it returns MessageFailureInfo that contains the failure result. Find out the cause of the failure using receiverUuids, code, and msg in MessageFailureInfo by referring to REST API Reference.

Send to me

Sample

Kotlin
RxKotlin
// Web page URL to be shared.
//  * CAUTION: The domain of the URL to be shared must be registered in [My Appliction] > [Platform] > [Web] in Kakao Developers.
val url = "https://developers.kakao.com"

// Template ID of the custom template.
//  * Refer to the guide: https://developers.kakao.com/docs/latest/en/message/message-template
val templateId = templateIds["customMessage"] as Long

TalkApiClient.instance.sendScrapMemo(url, templateId) { error ->
    if (error != null) {
        Log.e(TAG, "Failed to send me a message.", error)
    }
    else {
        Log.i(TAG, "Succeeded in sending me a message.")
    }
}
var disposables = CompositeDisposable()

// Web page URL to be shared.
//  * CAUTION: The domain of the URL to be shared must be registered in [My Appliction] > [Platform] > [Web] in Kakao Developers.
val url = "https://developers.kakao.com"

// Template ID of the custom template.
//  * Refer to the guide: https://developers.kakao.com/docs/latest/en/message/message-template
val templateId = templateIds["customMessage"] as Long

TalkApiClient.rx.sendScrapMemo(url, templateId)
    .retryWhen(
        // Retry the request to send me a message after requesting additional consent to resolve the InsufficientScope error.
        RxAuthOperations.instance.incrementalAuthorizationRequired(context)
    )
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe({
        Log.i(TAG, "Succeeded in sending me a message.")
    }, { error ->
        Log.e(TAG, "Failed to send me a message.", error)
    })
    .addTo(disposables)

Send to friends

Sample

Kotlin
RxKotlin
// Retrieve a list of friends.
TalkApiClient.instance.friends { friends, error ->
    if (error != null) {
        Log.e(TAG, "Failed to retrieve a list of friends.", error)
    }
    else {
        Log.d(TAG, "Succeeded in retrieving a list of friends: \n${friends!!.elements.joinToString("\n")}")

        if (friends.elements.isEmpty()) {
            Log.e(TAG, "There is no friend to send a message to :(")
        } else {

            // Retrieve UUIDs of the friends to send a message according to your service's environment.
            // This sample displays the Friends list and collects the UUIDs of the friends selected by a user. 
            FriendsActivity.startForResult(
                context,
                friends.elements.map { PickerItem(it.uuid, it.profileNickname, it.profileThumbnailImage) }
            ) { selectedItems ->
                if (selectedItems.isEmpty()) return@startForResult
                Log.d(TAG, "Selected friends:\n${selectedItems.joinToString("\n")}")


                // List of UUIDs of recipients to send a message.
                val receiverUuids = selectedItems

                // Web page URL to be shared.
                //  * CAUTION: The domain of the URL to be shared must be registered in [My Appliction] > [Platform] > [Web] in Kakao Developers.
                val url = "https://developers.kakao.com"

                // Template ID of the custom template.
                //  * Refer to the guide: https://developers.kakao.com/docs/latest/en/message/message-template
                val templateId = templateIds["customMessage"] as Long
                
                // Send a scrape message.
                TalkApiClient.instance.sendScrapMessage(receiverUuids, url, templateId) { result, error ->
                    if (error != null) {
                        Log.e(TAG, "Failed to send a message.", error)
                    }
                    else if (result != null) {
                        Log.i(TAG, "Succeeded in sending a message to ${result.successfulReceiverUuids}")

                        if (result.failureInfos != null) {
                            Log.d(TAG, "Succeed! But failed to send a message to some friends: \n${result.failureInfos}")
                        }
                    }
                }
            }
        }
    }
}
var disposables = CompositeDisposable()

// Retrieve a list of friends.
TalkApiClient.rx.friends()

    // Retrieve UUIDs of the friends to send a message according to your service's environment.
    // This sample displays the Friends list and collects the UUIDs of the friends selected by a user.  
    .flatMap { friends ->
        FriendsActivity.startForResult(
            context,
            friends.elements.map { PickerItem(it.uuid, it.profileNickname, it.profileThumbnailImage) }
        )
    }
    .observeOn(Schedulers.io())
    .flatMap { selectedItems ->

        // List of UUIDs of recipients to send a message.
        val receiverUuids = selectedItems

        // Web page URL to be shared.
        //  * CAUTION: The domain of the URL to be shared must be registered in [My Appliction] > [Platform] > [Web] in Kakao Developers.
        val url = "https://developers.kakao.com"
        
        // Template ID of the custom template.
        //  * Refer to the guide: https://developers.kakao.com/docs/latest/en/message/message-template
        val templateId = templateIds["customMessage"] as Long

        TalkApiClient.rx.sendScrapMessage(receiverUuids, url, templateId)
    }
    .retryWhen(
        // Retry the request to send a message after requesting additional consent to resolve the InsufficientScope error.
        RxAuthOperations.instance.incrementalAuthorizationRequired(context)
    )
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe({ result ->
        Log.i(TAG, "Succeeded in sending a message to ${result.successfulReceiverUuids}")

        if (result.failureInfos != null) {
            Log.d(TAG, "Succeed! But failed to send a message to some friends: \n${result.failureInfos}")
        }
    }, { error ->
        Log.e(TAG, "Failed to send a message.", error)
    })
    .addTo(disposables)

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 builder in advance. Refer to Upload image.

See more