How to auto publish post on Facebook Fan Page as admin using Facebook PHP SDK V4 Graph API v2.2 (1) - Create Facebook App

Facebook Developers

I have a ecommerce webstore using OpenCart with around 2000 products. I have created twitter, goolge+, pinterest and facebook page for this website. With Google moving towards semantic search, all these social signals are increasingly important. Everyday, I have to select one or two products and post on these social media websites. I don't like to do this manually and need to find ways to let a script doing the posting. For facebook page, I can use the APIs for daily auto posting. 

When I search for "Facebook PHP SDK for auto posting", there are lots of confusing results, mainly due to code written in different Facebook SDK versions. The documentation from Facebook developers website also quite difficult to understand. However, after reading articles from many websites, trial and error with example codes, finally I am able to do auto posting with Facebook PHP SDK v4 and Graph API v2.2.

Here's my expectations:

1) I want to auto post to Facebook Fan Page as admin.

2) No Login with Facebook required.

3) I want to post product title, product url, and product image, just like normal posting.

4) With 2000++ product listing and still increasing, I want able to auto post three to five items per day. It will take more that one year to post all products from my website. 

In part 1 of this article, I will describe how I set up facebook app. In the next article, I will describe the code used to auto post single item to facebook page.

Here's our steps to set up the app:

1) Set up a facebook app at developers.facebook.com. Click Apps ->Add a New App

Create New Facebook App

2) Select Website

Select Website App

3) You are requested to enter name for your new app

Enter New Facebook App Name

 

4) Click "Create New Facebook App ID" button after done.

Create New Facebook App ID

5

) Choose a category for your app. In my case, I select "Shopping". Confirm that you want to "Create App ID". 

Create Facebook App ID 

 

6) Now you are at new facebook app setup.

Facebook App Setup 

 

7)  At the bottom of this page, enter your website domain.

Tell facebook about your website

 

8) Click "Skip Quick Start" at the top and you should have your app ID and secret. Now you have an app to work with.

Facebook App ID and Secret

 

 

So we are done here. Before starts writing any code, we need to obtain a permanent Facebook Page Access Token to be used in our script. This will be in next article.

 

Last modified on Tuesday, 29 December 2020 07:03
Rate this item
(0 votes)
back to top