버전 비교

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

21.1. KakaoTalk Invitation SDK Example

목차

 

...

 

경고

Caution

Do not mix with existing APIs under 3.9.0.

In games newly released after 2022, you cannot use the Get Friends List and Send Message APIs guided below.

Please use the message sending function using the friend picker API.

21.1.1. Querying ongoing invitation event list

...

코드 블럭
#import <KakaoGame/KakaoGame.h>
 
// query of the ongoing invitation event list.
[KGKakaoInvitation loadEventsWithCompletionHandler:^(NSError *error, NSArray *invitationEvents) {
    if (IS_SUCCESS(error) == YES)
    {
        // Successful invitation event list lookup
        if (invitationEvents != nil)
        {
            for (KGKakaoEvent *invitationEvent in invitationEvents)
            {
                // Event ID: Required when sending an invitation message, to retrieve a list of invitees or senders.
                int eventId = invitationEvent.eventId;
  
                // Event start time
                long long startTime = invitationEvent.startTime;
  
                // Event end time
                long long finishTime = invitationEvent.finishTime;
  
                // Event Description
                NSString *eventDescription = invitationEvent.eventDescription;
            }
        }
    }
    else if (error.code == KGErrorNotKakaoTalkUser)
    {
        // The user is not a KakaoTalk user.
    }
    else
    {
        // Fail invitation event list lookup
    }
}];

Windows Sync

코드 블럭
#include "KakaoGameLib.h"
 
 
KakaoGame::Data::KGResult result;
std::vector<KakaoGame::Data::KGKakaoEvent> invitationEvents;
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
// query of the ongoing invitation event list.
kgKakaoInvitation.loadEvents(result, invitationEvents)'
if (result.isSuccess()) {
    // Successful invitation event list lookup
    for (KakaoGame::Data::KGKakaoEvent invitationEvent : invitationEvents)
    {
        // Event ID: Required when sending an invitation message, to retrieve a list of invitees or senders.
        int32_t eventId = invitationEvent.eventId;
 
        // Event start time
        int64_t startTime = invitationEvent.startTime;
 
        // Event end time
        int64_t finishTime = invitationEvent.finishTime;
 
        // Event Description
        std::wstring eventDescription = invitationEvent.eventDescription;
    }
}
else if (result.code == KakaoGame::Data::KGResultCode::NotKakaoTalkUser)
{
    // The user is not a KakaoTalk user.
}
else
{
    // Fail invitation event list lookup
}

Windows Async

코드 블럭
#include "KakaoGameLib.h"
 
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
// query of the ongoing invitation event list.
kgKakaoInvitation.loadEvents([this](KakaoGame::Data::KGResult result, std::vector<KakaoGame::Data::KGKakaoEvent> invitationEvents) {
    if (result.isSuccess()) {
        // Successful invitation event list lookup
        for (KakaoGame::Data::KGKakaoEvent invitationEvent : invitationEvents) {
            // Event ID: Required when sending an invitation message, to retrieve a list of invitees or senders.
            int32_t eventId = invitationEvent.eventId;
  
            // Event start time
            int64_t startTime = invitationEvent.startTime;
  
            // Event end time
            int64_t finishTime = invitationEvent.finishTime;
  
            // Event Description
            std::wstring eventDescription = invitationEvent.eventDescription;
        }
    }
    else if (result.code == KakaoGame::Data::KGResultCode::NotKakaoTalkUser)
    {
        // The user is not a KakaoTalk user.
    }
    else
    {
        // Fail invitation event list lookup
    }
});

Unreal

코드 블럭
코드 블럭
#include "KakaoGame.h"
  
// query of the ongoing invitation event list.
FKGKakaoInvitation::LoadEvents(FKGResultWithEventsDelegate::CreateLambda([=](FKGResult result, TArray<FKGKakaoEvent> events) {
  if (result.IsSuccess())
  {
    // Successful invitation event list lookup
    for (FKGKakaoEvent invitationEvent : events)
    {
      // Event ID: Required when sending an invitation message, to retrieve a list of invitees or senders.
      int32 eventId = invitationEvent.GetEventId();
 
      // Event start time
      int64 startTime = invitationEvent.GetStartTime();
 
      // Event end time
      int64 finishTime = invitationEvent.GetFinishTime();
 
      // Event Description
      FString eventDescription = invitationEvent.GetEventDescription();
    }
  }
  else if (result.GetCode() == FKGResultCode::NotKakaoTalkUser)
  {
    // The user is not a KakaoTalk user.
  }
  else
  {
    // Fail invitation event list lookup
  }
}));

21.1.2. Querying KakaoTalk Invitation Target List

...

코드 블럭
#import <KakaoGame/KakaoGame.h>
  
// [TODO] Set limit of recommended friends
int recommendLimit = 5; // The number of recommended friends
// int recommendLimit = 0; // Set to 0 if you want to fetch the list without recommended friends
// int recommendLimit = -1; // Set it to -1 if you want to include all of your recommended friends (the number of recommended friends is variably)
 
// [TODO] Set start value for querying friend list
int offset; // Start value for querying friend list
 
// [TODO] Set size of querying friend list
int limit; // Friend list size
 
// Querying KakaoTalk Invitation Target List
[KGKakaoInvitation loadInvitableFriendProfilesWithRecommendLimit:recommendLimit offset:offset limit:limit completionHandler:^(NSError *error, int totalCount, NSArray *idpProfiles) {
    if (IS_SUCCESS(error) == YES)
    {
        // Success
 
        // Query of invitation target friend profile list successful
        for (KGKakaoProfile *kakaoProfile in idpProfiles)
        {
            // KakaoTalk nickname
            NSString *nickname = kakaoProfile.nickname;
 
            // KakaoTalk profile thumbnail image url
            NSString *thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
 
            // If this user is a recommended friend or not
            BOOL isRecommended = kakaoProfile.isRecommended;
 
            // KakaoTalk installation os
            NSString *talkOs = kakaoProfile.kakaoTalkOS.description;
 
            // Whether your friends are allowed to get messages or not. You must not send message if it is 'false'.
            BOOL isAllowMessage = kakaoProfile.isAllowedMessage;
        }
    }
    else if (error.code == KGErrorNotKakaoTalkUser)
    {
        // The user is not a KakaoTalk user.
    }
    else
    {
        // Fail...
    }
}];

Windows Sync

코드 블럭
#include "KakaoGameLib.h"
 
// [TODO] Set limit of recommended friends
int32_t recommendLimit = 5; // The number of recommended friends
// int32_t recommendLimit = 0; // Set to 0 if you want to fetch the list without recommended friends
// int32_t recommendLimit = -1; // Set it to -1 if you want to include all of your recommended friends (the number of recommended friends is variably)
// [TODO] Set start value for querying friend list
int32_t offset; // Start value for querying friend list
 
// [TODO] Set size of querying friend list
int32_t limit; // Friend list size
  
KakaoGame::Data::KGResult result;
int32_t totalCount;
std::vector<KakaoGame::Data::KGKakaoProfile> players;
 
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
 
// Querying KakaoTalk Invitation Target List
kgKakaoInvitation.loadInvitableFriendProfiles(recommendLimit , offset, limit, result, players);
if (result.isSuccess()) {
    // Success
    for (KakaoGame::Data::KGKakaoProfile kakaoProfile : players) {
        // KakaoTalk nickname
        std::wtring nickname = kakaoProfile.nickname;
 
        // KakaoTalk profile thumbnail image url
        std::wtring thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
 
        // KakaoTalk installation os
        KakaoGame::Data::KGOSType kakaoTalkOS = kakaoProfile.kakaoTalkOS;
 
        // Whether your friends are allowed to get messages or not. You must not send message if it is 'false'.
        bool allowedMessage = kakaoProfile.allowedMessage;
    }
}
else if (result.code == KakaoGame::Data::KGResultCode::NotKakaoTalkUser)
{
    // The user is not a KakaoTalk user.
}
else
{
    // Fail...
}

Windows Async

코드 블럭
#include "KakaoGameLib.h"
 
// [TODO] Set limit of recommended friends
int32_t recommendLimit = 5; // The number of recommended friends
// int32_t recommendLimit = 0; // Set to 0 if you want to fetch the list without recommended friends
// int32_t recommendLimit = -1; // Set it to -1 if you want to include all of your recommended friends (the number of recommended friends is variably)
// [TODO] Set start value for querying friend list
int32_t offset; // Start value for querying friend list
 
// [TODO] Set size of querying friend list
int32_t limit; // Friend list size
 
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
 
// Querying KakaoTalk Invitation Target List
kgKakaoInvitation.loadInvitableFriendProfiles(recommendLimit, offset, limit, [this](KakaoGame::Data::KGResult result, std::vector<KakaoGame::Data::KGKakaoProfile> players) {
    if (result.isSuccess()) {
        // Success
        for (KakaoGame::Data::KGKakaoProfile kakaoProfile : players)
        {
            // KakaoTalk nickname
            std::wtring nickname = kakaoProfile.nickname;
  
            // KakaoTalk profile thumbnail image url
            std::wtring thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
  
            // KakaoTalk installation os
            KakaoGame::Data::KGOSType kakaoTalkOS = kakaoProfile.kakaoTalkOS;
  
            // Whether your friends are allowed to get messages or not. You must not send message if it is 'false'.
            bool allowedMessage = kakaoProfile.allowedMessage;
        }
    }
    else if (result.code == KakaoGame::Data::KGResultCode::NotKakaoTalkUser) {
        // The user is not a KakaoTalk user.
    }
    else {
        // Fail...
    }
});

Unreal

코드 블럭
#include "KakaoGame.h"
  
// [TODO] Set start value for querying friend list
int32 offset = 0; // Start value for querying friend list
 
// [TODO] Set size of querying friend list
int32 limit = 500; // Friend list size
 
// Querying KakaoTalk Invitation Target List
FKGKakaoInvitation::LoadInvitableFriendProfiles(0, offset, limit, FKGResultWithKakaoProfilesDelegate::CreateLambda([=](FKGResult result, int32 totalCount, TArray<FKGKakaoProfile> kakaoProfiles) {
  if (result.IsSuccess())
  {
    // Success
    for (FKGKakaoProfile kakaoProfile : kakaoProfiles)
    {
      // KakaoTalk nickname
      FString nickname = kakaoProfile.GetNickname();
 
      // KakaoTalk profile thumbnail image url
      FString thumbnailImageUrl = kakaoProfile.GetThumbnailImageUrl();
 
      // KakaoTalk installation os
      EKGOSType talkOs = kakaoProfile.GetKakaoTalkOS();
 
      // Whether your friends are allowed to get messages or not. You must not send message if it is 'false'.
      bool isAllowMessage = kakaoProfile.IsAllowedMessage();
    }
  }
  else if (result.GetCode() == FKGResultCode::NotKakaoTalkUser)
  {
    // The user is not a KakaoTalk user.
  }
  else
  {
    // Fail
  }
}));

21.1.3. Sending a KakaoTalk Invitation Message

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...
        }
    }
});

...

코드 블럭
#import <KakaoGame/KakaoGame.h>
  
// [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 sendInviteMessageWithEventId:eventId kakaoProfile:kakaoProfile templateId:templateId argumentDic:args (result) => {
    if (IS_SUCCESS(error) == YES)
    {
        // Success
    }
    else 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 == KGErrorExceedMothlyUsage)
    {
        // Occurs when one month exceeds a month's quota that a specific person can send to a particular app
    }
    else if (error.code == KGErrorNotKakaoTalkUser)
    {
        // The user is not a KakaoTalk user.
    }
    else
    {
        // Failed to send Kakao Talk invitation message
    }
}];

Windows Sync

코드 블럭
#include "KakaoGameLib.h"
 
KakaoGame::Data::KGLocalPlayer localPlayer;
KakaoGame::API::KGLocalPlayer kgLocalPlayer;
  
// [TODO] Bring your own profile object
getCurrentPlayer(localPlayer);
// [TODO] Set event Id
int32_t eventId = 511; // Send the invitation message for this event
 
// [TODO] Set invitation message template ID
int32_t templateId = 4100; // The Id value of the template created by the Message Template Admin
 
// [TODO] Add required arguments to invitation message
std::map<std::wstring, std::wstring> arguments;
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("${sender_name}"), localPlayer.kakaoProfile.nickname));
 
// [TODO] Set up recipient profiles
KakaoGame::Data::KGKakaoProfile kakaoProfile; // The profile object looked up by 'loadInvitableFriendProfiles'
  
KakaoGame::Data::KGResult result;
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
 
// Send a Kakaotalk invitation message
kgKakaoInvitation.sendInviteMessage(eventId, kakaoProfile, templateId, arguments, result);
if (result.isSuccess()) {
    // Success
}
else {
    // Failed to send Kakao Talk invitation message
    if (result.code == KakaoGame::Data::KGResultCode::MessageSettingDisabled) {
        // If the recipient has opted-out of the message
    } else if (result.code == KakaoGame::Data::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 == KakaoGame::Data::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 == KakaoGame::Data::KGResultCode::NotKakaoTalkUser) {
        // The user is not a KakaoTalk user.
    } else {
        // Other errors...
    }
}

Windows Async

코드 블럭
#include "KakaoGameLib.h"
  
KakaoGame::Data::KGLocalPlayer localPlayer;
KakaoGame::API::KGLocalPlayer kgLocalPlayer;
 
// [TODO] Bring your own profile object
getCurrentPlayer(localPlayer);
 
// [TODO] Set event Id
int32_t eventId = 511; // Send the invitation message for this event
 
// [TODO] Set invitation message template ID
int32_t templateId = 4100; // The Id value of the template created by the Message Template Admin
 
// [TODO] Add required arguments to invitation message
std::map<std::wstring, std::wstring> arguments;
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("${sender_name}"), localPlayer.kakaoProfile.nickname));
 
// [TODO] Set up recipient profiles
KakaoGame::Data::KGKakaoProfile kakaoProfile; // The profile object looked up by 'loadInvitableFriendProfiles'
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
 
// Send a Kakaotalk invitation message
kgKakaoInvitation.sendInviteMessage(eventId, kakaoProfile, templateId, arguments, [this](KakaoGame::Data::KGResult result) {
    if (result.isSuccess()) {
        // Success
    }
    else {
        // Failed to send Kakao Talk invitation message
        if (result.code == KakaoGame::Data::KGResultCode::MessageSettingDisabled) {
            // If the recipient has opted-out of the message
        } else if (result.code == KakaoGame::Data::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 == KakaoGame::Data::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 == KakaoGame::Data::KGResultCode::NotKakaoTalkUser) {
            // The user is not a KakaoTalk user.
        } else {
            // Other errors...
        }
    }
});

Unreal

코드 블럭
#include "KakaoGame.h"
  
// [TODO] Set event Id
int32 eventId = 511; // Send the invitation message for this event
   
// [TODO] Set invitation message template ID
FString templateId = TEXT("4100"); // The Id value of the template created by the Message Template Admin
   
// [TODO] Add required arguments to invitation message
FKGIdpProfile idpProfile = FKGLocalPlayer::GetCurrentPlayer().GetIdpProfile();
FKGKakaoProfile *localKakaoProfile = (FKGKakaoProfile*)&idpProfile;
FString nickname = localKakaoProfile->GetNickname();
 
TSharedPtr<FJsonObject> argumentMap = MakeShareable(new FJsonObject);
argumentMap->SetStringField(TEXT("${sender_name}"), nickname);
   
// [TODO] Set up recipient profiles
FKGKakaoProfile kakaoProfile; // The profile object looked up by 'loadInvitableFriendProfiles'
 
// Send a Kakaotalk invitation message
FKGKakaoInvitation::SendInviteMessage(eventId, kakaoProfile, templateId, argumentMap, FKGResultDelegate::CreateLambda([=](FKGResult result) {
  if (result.IsSuccess())
  {
    // Success
  }
  else
  {
    // Failed to send Kakao Talk invitation message
    if (result.GetCode() == FKGResultCode::MessageSettingDisabled)
    {
        // If the recipient has opted-out of the message
    }
    else if (result.GetCode() == FKGResultCode::ExceedDailyUsage)
    {
        // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app
    }
    else if (result.GetCode() == FKGResultCode::ExceedMonthlyUsage)
    {
        // Occurs when one month exceeds a month's quota that a specific person can send to a particular app
    }
    else if (result.GetCode() == FKGResultCode::NotKakaoTalkUser)
    {
        // The user is not a KakaoTalk user.
    }
    else
    {
        // Other errors
    }
  }
}));

21.1.4. Querying the number of friends I sent an invitation to

...

코드 블럭
#import <KakaoGame/KakaoGame.h>
  
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
  
[KGKakaoInvitation loadReceiversCountWithEventId:eventId completionHandler:^(NSError *error, int totalReceiversCount, int joinersCount) {
    if (IS_SUCCESS(error) == YES)
    {
        // Success
  
        // Total receivers count
        int totalCount = totalReceiversCount;
  
        // Number of friends who joined the game
        int registeredCount = joinersCount;
    }
    else
    {
        // Fail...
    }
}];

Windows Sync

코드 블럭
#include "KakaoGameLib.h"
  
// [TODO] Set event Id
int32_t eventId = 511; // Querying this invitation event
 
KakaoGame::Data::KGResult result;
int32_t totalReceiversCount;
int32_t joinersCount;
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
 
// Querying the number of friends I sent an invitation to
kgKakaoInvitation.loadReceiversCount(eventId, result, totalReceiversCount, joinersCount);
if (result.isSuccess()) {
    // Success
 
    // Total receivers count
    int totalCount = totalReceiversCount;
    // Number of friends who joined the game
    int registeredCount = joinersCount;
}
else {
    // Fail...
}

Windows Async

코드 블럭
#include "KakaoGameLib.h"
  
// [TODO] Set event Id
int32_t eventId = 511; // Querying this invitation event
  
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
 
// Querying the number of friends I sent an invitation to
kgKakaoInvitation.loadReceiversCount(eventId, [this](KakaoGame::Data::KGResult result, int32_t totalReceiversCount, int32_t joinersCount) {
    if (result.isSuccess()) {
        // Success
  
        // Total receivers count
        int totalCount = totalReceiversCount;
        // Number of friends who joined the game
        int registeredCount = joinersCount;
    }
    else {
        // Fail...
    }
});

Unreal

코드 블럭
#include "KakaoGame.h"
// [TODO] Set event Id
int32 eventId = 511; // Querying this invitation event
   
FKGKakaoInvitation::LoadReceiversCount(eventId, FKGResultWithReceiversCountDelegate::CreateLambda([=](FKGResult result, int32 totalReceiversCount, int32 joinersCount) {
  if (result.IsSuccess())
  {
    // Success
    // Total receivers count
    int32 totalCount = totalReceiversCount;
    // Number of friends who joined the game
    int32 registeredCount = joinersCount;
  }
  else
  {
    // Fail
  }
}));

21.1.5. Querying the list of friends I sent an invitation to

...

코드 블럭
#import <KakaoGame/KakaoGame.h>
  
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
 
// Querying the list of friends I sent an invitation to
[KGKakaoInvitation loadReceiversWithEventId:eventId completionHandler:^(NSError *error, NSArray *joiners, NSArray *invitees) {
    if (IS_SUCCESS(error) == YES)
    {
        // Success
 
        // List of players joined to the app, including unlink users
        for (KGPlayer *joiner in joiners)
        {
            // Receiver's playerId
            NSString *playerId = joiner.playerId;
 
            KGKakaoProfile *kakaoProfile = (KGKakaoProfile*)joiner.idpProfile;
  
            // Receiver's nickname
            NSString *nickname = kakaoProfile.nickname;
  
            // Receiver's KakaoTalk thumbnail profile image url
            NSString *thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
  
            // If the player has unlinked this app or not
            // If you want to display information on whether or not to leave the UI, use this flag
            BOOL isUnregistered = kakaoProfile.isUnregistered;
        }
 
        // List of recipients who have not yet joined the app
        // Player ID is not provided because the user has not signed up for the app
        for (KGKakaoPrfoile *invitee in invitees)
        {
            // Receiver's nickname
            NSString *nickname = invitee.nickname;
            // Receiver's KakaoTalk thumbnail profile image url
            NSString *thumbnailImageUrl = invitee.thumbnailImageUrl;
        }
    }
    else if (error.code == KGErrorNotKakaoTalkUser)
    {
        // The user is not a KakaoTalk user.
    }
    else
    {
        // Fail...
    }
}];

Windows Sync

코드 블럭
#include "KakaoGameLib.h"
  
// [TODO] Set event Id
int32_t eventId = 511; // Querying this invitation event
 
KakaoGame::Data::KGResult result;
std::vector<KakaoGame::Data::KGPlayer> joiners;
std::vector<KakaoGame::Data::KGKakaoProfile> invitees;
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
 
// Querying the list of friends I sent an invitation to
kgKakaoInvitation.loadReceivers(eventId, result, joiners, invitees);
if (result.isSuccess()) {
    // Success
 
    // List of players joined to the app, including unlink users
    for (KakaoGame::Data::KGPlayer joiner : joiners) {
        // Receiver's playerId
        std::wstring playerId = player.playerId;
  
        KakaoGame::Data::KGKakaoProfile kakaoProfile = player.kakaoProfile;
        // Receiver's nickname
        std::wstring nickname = kakaoProfile.nickname;
        // Receiver's KakaoTalk thumbnail profile image url
        std::wstring thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
        // If the player has unlinked this app or not
        // If you want to display information on whether or not to leave the UI, use this flag
        bool unregistered = kakaoProfile.unregistered;
    }
 
    // List of recipients who have not yet joined the app
    // Player ID is not provided because the user has not signed up for the app
    for (KakaoGame::Data::KGKakaoProfile invitee : invitees) {
        // Receiver's nickname
        std::wstring nickname = invitee.nickname;
        // Receiver's KakaoTalk thumbnail profile image url
        std::wstring thumbnailImageUrl= invitee.thumbnailImageUrl;
    }
}
else
{
    // Fail...
}

Windows Async

코드 블럭
#include "KakaoGameLib.h"
  
// [TODO] Set event Id
int32_t eventId = 511; // Querying this invitation event
  
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
 
// Querying the list of friends I sent an invitation to
kgKakaoInvitation.loadReceivers(eventId, [this](KakaoGame::Data::KGResult result, std::vector<KakaoGame::Data::KGPlayer> joiners, std::vector<KakaoGame::Data::KGKakaoProfile> invitees) {
    if (result.isSuccess())
    {
        // Success
 
        // List of players joined to the app, including unlink users
        for (KakaoGame::Data::KGPlayer joiner : joiners) {
            // Receiver's playerId
            std::wstring playerId = player.playerId;
 
            KakaoGame::Data::KGKakaoProfile kakaoProfile = player.kakaoProfile;
            // Receiver's nickname
            std::wstring nickname = kakaoProfile.nickname;
            // Receiver's KakaoTalk thumbnail profile image url
            std::wstring thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
            // If the player has unlinked this app or not
            // If you want to display information on whether or not to leave the UI, use this flag
            bool unregistered = kakaoProfile.unregistered;
        }
 
        // List of recipients who have not yet joined the app
        // Player ID is not provided because the user has not signed up for the app
        for (KakaoGame::Data::KGKakaoProfile invitee : invitees) {
            // Receiver's nickname
            std::wstring nickname = invitee.nickname;
            // Receiver's KakaoTalk thumbnail profile image url
            std::wstring thumbnailImageUrl= invitee.thumbnailImageUrl;
        }
    }
    else
    {
        // Fail...
    }
});

Unreal

코드 블럭
#include "KakaoGame.h"
  
// [TODO] Set event Id
int32 eventId = 511; // Querying this invitation event
   
FKGKakaoInvitation::LoadReceivers(eventId, FKGResultWithReceiversDelegate::CreateLambda([=](FKGResult result, TArray<FKGPlayer> joiners, TArray<FKGKakaoProfile> invitees) {
  if (result.IsSuccess())
  {
    // Success
 
    // List of players joined to the app, including unlink users
    for (FKGPlayer player : joiners)
    {
      // Receiver's playerId
      FString playerId = player.GetPlayerId();
 
      FKGIdpProfile idpProfile = player.GetIdpProfile();
      FKGKakaoProfile *kakaoProfile = (FKGKakaoProfile*)&idpProfile;
       
      // Receiver's nickname
      FString nickname = kakaoProfile->GetNickname();
      // Receiver's KakaoTalk thumbnail profile image url
      FString thumbnailImageUrl = kakaoProfile->GetThumbnailImageUrl();
      // If the player has unlinked this app or not
      // If you want to display information on whether or not to leave the UI, use this flag
      bool unregistered = kakaoProfile->IsUnregistered();
    }
  
    // List of recipients who have not yet joined the app
    // Player ID is not provided because the user has not signed up for the app
    for (FKGKakaoProfile invitee : invitees)
    {
      // Receiver's nickname
      FString inviteeNickname = invitee.GetNickname();
      // Receiver's KakaoTalk thumbnail profile image url
      FString inviteeThumbnailImageUrl = invitee.GetThumbnailImageUrl();
    }
  }
  else
  {
    // Fail
  }
}));

21.1.6. Querying the count of players who invited you

...

코드 블럭
#import <KakaoGame/KakaoGame.h>
  
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
  
[KGKakaoInvitation loadSendersCountWithEventId:eventId completionHandler:^(NSError *error, int count) {
    if (IS_SUCCESS(error) == YES)
    {
        // Success
  
        // Get the number of players who invited you
        int senderCount = count;
    }
    else
    {
        // Fail...
    }
}];

Windows Sync

코드 블럭
#include "KakaoGameLib.h"
  
// [TODO] Set event Id
int32_t eventId = 511; // Querying this invitation event
 
KakaoGame::Data::KGResult result;
int32_t count;
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
 
kgKakaoInvitation.loadSendersCount(eventId, result, count);
if (result.isSuccess()) {
    // Success
 
    // Get the number of players who invited you
    int senderCount = count;
}
else {
    // Fail...
}

Windows Async

코드 블럭
#include "KakaoGameLib.h"
  
// [TODO] Set event Id
int32_t eventId = 511; // Querying this invitation event
  
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
 
kgKakaoInvitation.loadSendersCount(eventId, [this](KakaoGame::Data::KGResult result, int32_t count) {
    if (result.isSuccess()) {
        // Success
  
        // Get the number of players who invited you
        int senderCount = count;
    }
    else {
        // Fail...
    }
});

Unreal

코드 블럭
#include "KakaoGame.h"
  
// [TODO] Set event Id
int32 eventId = 511; // Querying this invitation event
   
FKGKakaoInvitation::LoadSendersCount(eventId, FKGResultWithSendersCountDelegate::CreateLambda([=](FKGResult result, int32 count) {
  if (result.isSuccess)
  {
    // Success
  
    // Get the number of players who invited you
    int32 senderCount = count;
  }
  else
  {
    // Fail...
  }
}));

21.1.7. Querying the list of players who invited you

...

코드 블럭
#import <KakaoGame/KakaoGame.h>
  
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
 
// Querying the list of players who invited you
[KGKakaoInvitation loadSendersWithEventId:eventId completionHandler:^(NSError *error, NSArray *invitationSenders) {
    if (IS_SUCCESS(error) == YES)
    {
        // Success
 
        // Get the list of players who invited you
        if (invitationSenders != nil && [invitationSenders count] > 0)
        {
            for (KGPlayer *invitationSender in invitationSenders)
            {
                // Get the playerId
                NSString *playerId = invitationSender.playerId;
 
                KGKakaoProfile *kakaoProfile = (KGKakaoProfile*)invitationSender.idpProfile;
                // player's nickname
                NSString *nickname = kakaoProfile.nickname;
  
                // player's KakaoTalk thumbnail image url
                NSString *thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
            }
        }
    }
    else if (error.code == KGErrorNotKakaoTalkUser)
    {
        // The user is not a KakaoTalk user.
    }
    else
    {
        // Fail...
    }
}];


Windows Sync

코드 블럭
#include "KakaoGameLib.h"
  
// [TODO] Set event Id
int32_t eventId = 511; // Querying this invitation event
 
KakaoGame::Data::KGResult result;
std::vector<KakaoGame::Data::KGPlayer> invitationSenders;
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
 
// Querying the list of players who invited you
kgKakaoInvitation.loadSenders(eventId, result, invitationSenders);
if (result.isSuccess()) {
    // Success
 
    // Get the list of players who invited you
    for (KakaoGame::Data::KGPlayer invitationSender : invitationSenders) {
        // Get the playerId
        std::wstring playerId = player.playerId;
 
        KakaoGame::Data::KGKakaoProfile kakaoProfile = invitationSender.kakaoProfile;
        // player's nickname
        std::wstring nickname = kakaoProfile.nickname;
        // player's KakaoTalk thumbnail image url
        std::wstring thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
    }
}
else
{
    // Fail...
}

Windows Async

코드 블럭
#include "KakaoGameLib.h"
  
// [TODO] Set event Id
int32_t eventId = 511; // Querying this invitation event
  
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
 
// Querying the list of players who invited you
kgKakaoInvitation.loadSenders(eventId, [this](KakaoGame::Data::KGResult result, std::vector<KakaoGame::Data::KGPlayer> invitationSenders) {
    if (result.isSuccess()) {
        // Success
 
        // Get the list of players who invited you
        for (KakaoGame::Data::KGPlayer invitationSender : invitationSenders) {
            // Get the playerId
            std::wstring playerId = player.playerId;
 
            KakaoGame::Data::KGKakaoProfile kakaoProfile = invitationSender.kakaoProfile;
            // player's nickname
            std::wstring nickname = kakaoProfile.nickname;
            // player's KakaoTalk thumbnail image url
            std::wstring thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
        }
    }
    else {
        // Fail...
    }
});

Unreal

코드 블럭
#include "KakaoGame.h"
  
// [TODO] Set event Id
int32 eventId = 511; // Querying this invitation event
   
FKGKakaoInvitation::LoadSenders(eventId, FKGResultWithSendersDelegate::CreateLambda([=](FKGResult result, TArray<FKGPlayer> players) {
  if (result.IsSuccess())
  {
    // Success
 
    // Get the list of players who invited you
    for (FKGPlayer player : players)
    {
      // Get the playerId
      FString playerId = player.GetPlayerId();
 
      FKGIdpProfile idpProfile = player.GetIdpProfile();
      FKGKakaoProfile *kakaoProfile = (FKGKakaoProfile*)&idpProfile;
       
      // player's nickname
      FString nickname = kakaoProfile->GetNickname();
 
      // player's KakaoTalk thumbnail image url
      FString thumbnailImageUrl = kakaoProfile->GetThumbnailImageUrl();
    }
  }
  else
  {
    // Fail
  }
}));