버전 비교

  • 이 줄이 추가되었습니다.
  • 이 줄이 삭제되었습니다.
  • 서식이 변경되었습니다.

...

This section shows an example of KakaoTalk invitation message sending. (Guide : 20. Kakaotalk Message Template V2)

Unity 예제

코드 블럭
using Kakaogame.SDK;
using Kakaogame.SDK.Kakao;
  
// [TODO] Set event Id
int eventId = 511; // Send the invitation message for this event
  
// [TODO] Set invitation message template ID
int templateId = 4100; // The Id value of the template created by the Message Template Admin
  
// [TODO] Add required arguments to invitation message
String nickname = ((KGKakaoProfile) KGLocalPlayer.getCurrentPlayer().getIdpProfile()).getNickname();
Map<String, String> args = new LinkedHashMap<String, String>();
args.put("${sender_name}", nickname);
  
// [TODO] Set up recipient profiles
KGKakaoProfile kakaoProfile; // The profile object looked up by 'loadInvitableFriendProfiles'
 
// Send a Kakaotalk invitation message
KGKakaoInvitation.SendInviteMessage(eventId, kakaoProfile, templateId, args, (result) => {
    if (result.isSuccess)
    {
        // Success
    }
    else
    {
        // Failed to send Kakao Talk invitation message
        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 if (result.code == KGResultCode.NotKakaoTalkUser)
        {
            // The user is not a KakaoTalk user.
        }
        else
        {
            // Other errors...
        }
    }
});

...