How to use facebook to invite friend with custom text

Hi everyone,

I try to invite a friend with a custom text. For Ex: Hi friends i just got #highscore in this game, can you beat me!

With the normal inviteFriends(…), i cannot do that, so i used the second method in sdk, use requestInvitableFriends() then inviteFriendsWithInviteIds(). It can send friend invitation but it don’t contain my wanted text but the last text from the first method.

In sdkbox doc, it mentioned “only available for games with a canvas implementation for the Facebook application. The canvas must be defined but doesn’t need to how any web content” <- what’s this mean? i try to host a simple webpage on google drive to test this out, but it seems not working.

Do you have any ideas?

@yinjimmy can you help?

hi @yinjimmy, can you help me with this, can we send invite with predefined text?

I’m checking on this.

Hi @yinjimmy,

Do our sdkbox facebook plugin support “game request” dialog?

Thanks for your reading

Yes, it supports GameRequestDialog.

Hi @yinjimmy,

Sorry to wasting your time, but it seems i cannot find GameRequestDialog, sdkbox contains only FBShareInfo. In PluginFacebook, there is only member function dialog(FBShareInfo *). I tried to update the newest version of sdkbox and facebook sdk using “sdkbox import facebook”, but still don’t have that feature, do you have any ideas?

BTW, do you find out how to send invite with user’s best score (predefined text) or captured screenshot, i’m trying to use Game Request feature to bypass this problem :smiley:
Thanks in advance,

P/S: FYI, i’m using cocos2d-x version 3.10

FBSDKGameRequestDialog was used in inviteFriendsWithInviteIds api. :wink:

1 Like

Ow, that’s it! Then, it mean we cannot set a predefined text, right?

Once more thing i want to ask you, when using graph api api(…) how can we get the response from that method?. I suppose the last parameter, but nothing happen. For Ex:

string response = “nothing”;
sdkbox::PluginFacebook::FBAPIParam params;
sdkbox::PluginFacebook::api(“/me”, “GET”, params, response);
log(“response %s”, response.c_str()); // still “nothing”

The tag == “nothing” for above code.

how about this code?

  1. requestInvitableFriends
void HelloWorld::onRequestInvitableFriends( const sdkbox::FBInvitableFriendsInfo& fi ) {
    std::vector<std::string> ids;
    for (auto it = fi.begin(); it != fi.end(); ++it) {
        ids.push_back(it->getUserId());
    }
    sdkbox::PluginFacebook::inviteFriendsWithInviteIds(ids, "your title", "Hi friends i just got #1000 in this game, can you beat me!");
}

Thank you, i should have read sample carefully before asking question about api function, Sorry :blush:

I still need to test invite function, it doesn’t work like i want (still cannot show predefined text), i will inform you later, thanks very much :smiley:

Hi, it seems like i cannot get it work as i want. I even implement FBSDKGameRequestDialog to use send a request, but still there is no custom message attached to it. Is that mean Facebook do not support this or do i have to set up something particularly?