20.1 Kakaotalk Message Template V2 Example

20.1. Kakaotalk Message Template V2 Example

 


20.1.1. Send an invitation message V2 to a friend

This section shows an example of a send an invitation message V2 to a friend.

Unity Example

using Kakaogame.SDK; // [TODO] Get my Kakao profile information from my Invite Friends list KGKakaoProfile kakaoProfile; // [TODO] Set invitation message template ID string templateId = "4108"; // [TODO] Add required arguments to invitation message Dictionary<string, object> argumentDic = new Dictionary<string, object>(); // Send a Kakaotalk invitation message KGKakaoTalkMessage.SendNewInviteMessage(     kakaoProfile,     templateId,     argumentDic,     (result) => {         if (result.isSuccess) {             // Sending invitation message to KakaoTalk succeeded         }         else if (result.code == KGResultCode.MessageSettingDisabled) {             // If the recipient has opted-out of the message         }         else if (result.code == KGResultCode.ExceedDailyUsage) {             // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app         }         else if (result.code == KGResultCode.ExceedMonthlyUsage) {             // Occurs when one month exceeds a month's quota that a specific person can send to a particular app         }         else {             // Failed to send Kakao Talk invitation message         }     });

Android Example

// [TODO] Get my Kakao profile information from my Invite Friends list KGKakaoProfile kakaoProfile; // [TODO] Set invitation message template ID String templateId; // [TODO] Add required arguments to invitation message Map<String, String> args = new LinkedHashMap<String, String>(); String nickname = ((KGKakaoProfile)KGLocalPlayer.getCurrentPlayer().getIdpProfile()).getNickname(); args.put("${sender_name}", nickname); args.put("${invitation_event_id}", ""); // Send a Kakaotalk invitation message KGKakaoTalkMessage.sendNewInviteMessage(kakaoProfile, templateId, args, new KGResultCallback<Boolean>() {  @Override  public void onResult(KGResult<Boolean> result) {   if (result.isSuccess()) {    // Sending invitation message to KakaoTalk succeeded   } else {    // Failed to send Kakao Talk invitation message          if (result.getCode() == KGResult.KGResultCode.MESSAGE_SETTING_DISABLE) {     // If the recipient has opted-out of the message    } else if (result.getCode() == KGResult.KGResultCode.EXCEED_DAILY_USAGE) {     // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app    } else if (result.getCode() == KGResult.KGResultCode.EXCEED_MONTHLY_USAGE) {     // Occurs when one month exceeds a month's quota that a specific person can send to a particular app    } else {     // etc    }   }  } });

iOS Example

#import <KakaoGame/KakaoGame.h> // [TODO] Get my Kakao profile information from my Invite Friends list KGKakaoProfile *kakaoProfile; // Kakaotalk profile(KGKakaoProfile Object) // [TODO] Set invitation message template ID NSString *templateId = @"4108"; // [TODO] Add required arguments to invitation message NSDictionary* argumentDic = @{@"name" : @"nickname", @"iphoneMarketParam" : @"test", @"iphoneExecParam" : @"test", @"sender_name" : @"iOSTester", @"invitation_event_id" : @(29)}; // Send a Kakaotalk invitation message [KGKakaoTalkMessage sendNewInviteMessageWithKakaoProfile:kakaoProfile                                               templateId:templateId                                              argumentDic:argumentDic                                        completionHandler:^(NSError *error) {     if (IS_SUCCESS(error) == YES)     {If the recipient has opted-out of the message         // Sending invitation message to KakaoTalk succeeded     }     else     {         // Failed to send Kakao Talk invitation message               if (error.code == KGErrorMessageSettingDisabled)         {             // If the recipient has opted-out of the message         }         else if (error.code == KGErrorExceedDailyUsage)         {             // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app         }         else if (error.code == KGErrorExceedMonthlyUsage)         {             // Occurs when one month exceeds a month's quota that a specific person can send to a particular app         }         else         {             // etc         }     } }];

Unreal

20.1.2. Send an game message V2 to a friend

This section shows an example of a send an game message V2 to a friend.

Unity Example

Android Example

iOS Example

Unreal

20.1.3. Send an group chat room message V2 to a friend

This section shows an example of a send an group chat room message V2 to a friend.

Unity Example

Android Example

iOS Example

Unreal

20.1.4. Send Message V2 to Guild Chat Room

This section shows an example of a send an message V2 to the guild chat room.

 

Unity

Android

iOS