Change the name of the facebook page tab

Is there a way to change the name of the facebook page tab using the facebook API using the PHP SDK. I think it is constantly during the setup of the facebook application.

after setting the tab name of the application, you can change the name of the facebook tab
page later using the graphical API.

+6
source share
2 answers

Yes, you can do this using the api chart.

First you need to get the access token for the page, for this you will need to request permission manage_pages.

Once you have initialized the PHP SDK to get the page access token, you call ...

$facebook->api('/THE_PAGE_ID?fields=access_token'); 

Returns an array as shown below

 { "access_token": "THE_PAGE_ACCESS_TOKEN", "id": "THE_PAGE_ID", "type": "page" } 

Before using this token, you can save the access token to current users so you can set it again as soon as you finish making page materials.

 $users_access_token = $facebook->getAccessToken(); 

To then make the SDK, use the page access token for the next do call

 $facebook->setAccessToken('THE_PAGE_ACCESS_TOKEN'); 

Now we are ready to change the name of the tab by setting POST to / THE _PAGE_ID / tabs / TAB_ID with an array containing the new user name

 $this->api('/THE_PAGE_ID/tabs/TAB_ID', 'POST', array( 'custom_name' => 'THE_NEW_TAB_NAME' )); 

TAB_ID must be the application tab identifier added by _

It should be like this, do not forget to set the access token back to the user token before trying to do anything not related to the tab

 $facebook->setAccessToken($users_access_token); 

It may be worth noting that you can use the exact same process to change the position of the tab and set the default tab to the default, you just need to add a couple of extra bits to the POST array, "position" and "is_non_connection_landing_tab",

 $this->api('/THE_PAGE_ID/tabs/TAB_ID', 'POST', array( 'custom_name' => 'THE_NEW_TAB_NAME', 'position' => 1, 'is_non_connection_landing_tab' => true )); 
+11
source

Take a look here http://developers.facebook.com/docs/reference/api/page/ scroll down to the tab. Graph api provides Read, Create, Update, Delete functions.

+2
source

Source: https://habr.com/ru/post/899763/


All Articles