good_evening
good_evening

Reputation: 21749

How can I allow people to subscribe to my Facebook app to their Page?

I have a Facebook app that can be used for certain businesses. Instead of manually connecting my app and their pages, is it possible for me to create a website where a customer can login through Facebook, select their Page, and connect it with my App with certain subscription permissions? Where do I even begin? I can't find more info on https://developers.facebook.com/

Basically I am trying to have functionality similar to manychat.com just for my own service.

Upvotes: 9

Views: 408

Answers (2)

Edison Biba
Edison Biba

Reputation: 4423

I will go through an example which I have already implemented. It has to do with Facebook Ads Leads but you can retrieve whatever information you want from pages.

So the flow is like this: I create an app in Facebook, select which permissions I need to get from Facebook users/pages and then create my application to connect with this Facebook app.

End users will open a link and they have a button login with Facebook and when they login with Facebook they will have some options that they can choose and these are their pages.

Please be aware that it depends on what permissions you are asking. If you ask for permissions that are related to pages then Facebook will automatically ask them to select a page otherwise will just ask them to give their personal details to your app.

Facebook has a detailed page with information how you can archive this and you can read it here.

They also have a video tutorial how to make this integration here

Be aware that it's a bit tricky to get through that tutorial but just try to do everything that is listed there and also don't forget to create an app token.

Below I have added some simple steps that you need to go through for this integration but you need to go through links that I provided to get information how to do these steps.

Step 1: Create your app in facebook.

  • Fill your app information here
  • In App Domains you should include webserver URL(Where you want these informations that you get from pages to be sent)

Step 2: Subscribe to facebook app from your server

  • Create a webhook.php file so facebook can make a call there and verify your app

  • Register your file in facebook app

Step 3: Create a platform.php file in your server

  • This file will be just a simple html page which will ask users to login with their facebook and give your permissions to manage their pages.

Step 4: Modify webhooks.php file so you can receive information from facebook when something changes in pages or whatever information you requested to read form pages

Please be aware that you need your facebook business manager and you should be verified as a business in facebook in order to be able to test your integration. So you should go and apply to get verified in facebook.

Upvotes: 4

Sreeram Nair
Sreeram Nair

Reputation: 2387

From musical tastes to work history, there are close to 50 different types of permissions you can request from your visitors with Facebook Login.

you’ll need to create a developers account on Facebook. To do this, navigate to developers.facebook.com and log in with your Facebook credentials.

You can check on how to use facebook login in your webpage here for more details.

The details of how Facebook can securely authenticate a user and hand this information back to your server are best handled by the PHP SDK. Read the documentation if you want to explore the details.

OpenID basically does the same thing, only the technical details differ and it's not specific to Facebook. Oauth is another very similar technology.

You can use the following button in order to allow the user to login:

<fb:login-button scope="public_profile,email" onlogin="checkLoginState();">
</fb:login-button>

Then in the checkLoginState callback, call FB.getLoginStatus:

function checkLoginState() {
    FB.getLoginStatus(function(response) {
       // do stuff
    });
}

This should give you an access_token and an app_scoped user_id, if the response.status is connected.

Upvotes: 0

Related Questions