Search code examples
facebook-instant-games

How to try to invite friends on Facebook Instant Game SDK? (ShareAsync not working)


I want to know how to invite or request. but FBInstant SDK doesn't ask me any target IDs when sharing.

my code is following (Typescript),

const options : FBInstant.SharePayload = {
    intent  : "INVITE",
    text    : "SomeText",
    image   : base64Image, // exist.
    data    : {}
};
FBInstant.shareAsync(options);

and this shows "SHARE" window. FBInstant.shareAsync() not work exactly.


Solution

  • You should actually use FBInstant.context.chooseAsync/FBInstant.context.createAsync for invites in Instant Games. Your goal should be to move the players you want to play together into the same context (as specified by FBInstant.context methods).

    Sharing (shareAsync) is intended for broadcast sharing and despite the intent parameter, it is not that useful for invitations.