While sending out an App invite in my app, I am trying to find a way to add metadata to it so I can track internally who sent invites and how successful they were (Facebook only shows data from when the dialog is opened and there is no way to track specific funnels).
my code for sending the invite is:
private void openFacebookAppInvite() {
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(FACEBOOK_APP_LINK_URL)
.setPreviewImageUrl(INVITE_PREVOEW_IMAGE_URL)
.build();
// WANT TO ADD METADATA HERE
AppInviteDialog.show(this, content);
}
If notification is missing, then invited person should navigate to https://developers.facebook.com/requests/ and accept invite there. At the bottom it should say "1 developer request". Click through to that and approve the app, and you should be good to go.
Maybe this is not the answer that you had hoped for, but I think it will help to implement your requirements.
Part 1: send data directly with an AppInvite
As far as I know, it is not possible to send custom data with AppInvites created with an AppInviteContent.Builder
directly. I will explain a more complex possibility in Part 3. But maybe a GameRequest is an option for you. A GameRequestDialog
can be initialized with a GameRequestContent
object. The method setData
of the class GameRequestContent.Builder
"sets optional data which can be used for tracking".
Part 2: tracking invites
Of course you can track that an user opened the AppInviteDialog
(by do a simple request to your server). Sadly it is not possible to track which or how many users are invited.
But after an invited user accepts the invitation, installs and run the mobile app (or give you the permissions on a canvas, if you have a canvas app too), you are able to get all AppRequests
(Invites) by do a query to /me/apprequests
with the Graph API.
Also possible:
POST
request, your server will get after an invited user opens the canvas page, contains a parameter request_ids
. This is a comma separated list of app-request-ids, which can be used in a graph query. AppLinkData.fetchDeferredAppLinkData
and appLinkData.getTargetUri().getQueryParameter("request_ids")
. See the section "Supporting incoming links" in the documentation. Now you are able to create a graph api request. Part 3: send data with an AppInvite via an App-Link
As shown in Part 2.2., you will get a targetUrl
after an invited user opens the app. This targetUrl
is specified in the AppLink found under the AppLinkUrl you used for the AppInvite. With a "Dynamic App Link endpoint" it is possible to send data to the invitees.
Here an idea how to implement this:
POST:http://example.com/users/${USER}/invites/
. ${USER} is the username of the sender of the invitation.GET:http://example.com/users/${USER}/invites/${UUID}
. The response to this endpoint is a page with a defined AppLink where al:android:url
is example://users/${USER}/invites/${UUID}
- of course the placeholder ${USER} and ${UUID} are replaced with the correct values from step 1 and 2. http://example.com/users/${USER}/invites/${UUID}
) as the app-link-url when creating the AppInviteContent.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With