Adding Facebook App Invite For Cordova and Phonegap Apps

In this post, I will show you how you can add Facebook App Invites for you Cordova apps. App Invites are a grate way to increase downloads of you apps by giving users a way to share your app with their Facebook friends.

Before we begin I want you to use you own Facebook IDs and keys if you copy mine then it will not work for you as I will be deleting the Facebook app that I will create in this tutorial. Also this tutorial will be for android only but if you wish to do the same for iOS you can follow along and make changes for iOS wherever relevant.

What are app invites?

The facebook documentation has a pretty good definition, “App Invites are a content-rich, personal way for people to invite their Facebook friends to a mobile app.”. In other words you can invite your facebook friends to use an app. But a thing to note here is that App Invites can only be received on a mobile platform. So if you send an app invite to a facebook friend and they are using facebook from their computer they will not receive App Invite notification. Read more about App Invite here.

Step 1)

We will first start off by creating a fresh project, I will be creating it in Cordova. But if you are using another framework such as PhoneGap or Ionic you can create a new project and follow along as well.

Step 2)

After logging into the developer Dashboard we will create a new Facebook app by clicking the MyApp button.

Now select the platform in the prompt, I will select Android.

Hit Skip and Create App ID in the next prompt.

In the next prompt fill out the required app details such as Display Name, NameSpace and Category also make sure to note them down as we will need them later.

After clicking Create App ID we will be given our app info with App ID as shown.

Note down the App ID we will need it as well.

Now we will need to activate the app for public use, for that we will need to add a valid email address to our app so go to settings and add the email and click save changes.

Now go to App Review and make the app public.

Step 3)

We have created our Facebook App now we will need add a platform to it, for that again go to settings and click add platform and fill out the details as shown, you will need you own Package Name and Key Hashes (see below for how to get it).

Here the Google Play Package Name is the package name / Widget ID of you app which you can find in config.xml file

Step 4)

Now that we have created and configured our Facebook App we are not done yet, there is one more thing that we need to do before we leave Facebook which is creating an App Link, basically an App Link is the link that will point to your app and that is what will be shared in the App Invite.