CyberMew
CyberMew

Reputation: 1421

How to create custom request in Facebook Open Graph?

I am slightly confused about this whole open graph thing despite reading about it.

How would I go about customizing it if I just want to change "xxx has sent you a request" to simply "xxx has sent you a challenge request" or "xxx has challenged you in yyy", along with a custom message the user can type in?

I also can't seem to restrict the list to people who already have played the game before, the dialog just shows All, Game Players, and Friends to Invite. I want to only show Game Players (and even then how can I customise this text?).

I am using the Unity's SDK, FB.AppRequest, with just a hardcode message (which doesn't seen to appear anywhere) and title of the ingame dialog popup. Basically now I just want to complete a game, and then challenge friends to beat my score (with a custom user message in that request for friends to read).

edit: how do I know if a request came in and loaded the app? Do I simply delete all notifications for the app for simplicity?

Upvotes: 0

Views: 955

Answers (1)

Brian Jew
Brian Jew

Reputation: 906

v5.1 of the SDK has Structured Requests which let you use Open Graph objects so you can do "xxx sent you a shoe" or "xxx asked for a sock". However, we don't have a "xxx has challenged you in yyy"

If you look at the InteractiveConsole.cs example, you can see that it uses "[\"all\",\"app_users\",\"app_non_users\"]" to specify the exact tabs to show. You can change this in your own code to be just: "[\"app_users\"]" for showing only Game Players. Currently this label isn't customizable, but you can create your own custom list with a customized label. See "filters" in https://developers.facebook.com/docs/reference/dialogs/requests/ for more details.

You can see if a player came in with a request through FB.GetDeepLink(). That will fetch the raw url along with the url params such as the request id. You can check for that to respond appropriately to requests.

Upvotes: 0

Related Questions