How can I display Facebook Public Page Posts on my website?
0 comments |
|
|

A few weeks ago, Facebook announced that they were rolling out a new feature: the ability to embed Facebook posts on your website or blog.
- Log into the Facebook account
- Visit https://developers.facebook.com/apps,
- On the top right of the next screen, click on the button “+Create New App”
- Fill all the information and proceed further
- On the next screen you will see “App ID:” and “APP Secret:” You will need it when requesting.
- To get Facebook posts by request, you need to implement Facebook login system in your website
Here is the code in Drupal to implement Facebook login system

To send this request you need to get "manage_pages" permission first otherwise it will give error.

Facebook will send a code to your redirect URL and you will get the “User Access Token” with the help of this code

And then you need to send the request again to get the user account information

Then you can find out which page the user has allowed and then you need to send a request to that page for the “Page Access Token”.

Now subscribe the Facebook pages if you want to get the real time Facebook Webhook notification

Here is a screenshot of the full code.

If you get the page access token successfully then you need to send a request to fetch the page posts

Now you can display these posts on your page where you want.
Enjoy!
Add new comment