在facebook页面上添加标签,为添加应用程序添加自定义标签,并传递一些数据


adding tab on facebook page with custom label for add app and passing some data with it

我正在创建一个用于制作粉丝页面的应用程序。用户可以在我的网站上创建他们的页面设计,点击发布按钮,该应用程序应该作为选项卡添加到页面中,并与设计的一起制作。我有页面ID和应用程序ID。请建议我可以直接添加选项卡的方法。当我使用时

http://facebook.com/add.php?api_key=app_api_key&page=page_id,

它显示添加应用程序按钮。我可以更改该按钮的标签吗。。

您可以通过使用以下调用通过程序实现这一点:

参见此处获取页面令牌(向下滚动到"页面登录")

$page_token = 'XXX' // This is the page token
$app_id = '123456789' // This is the app that you want to install
$tab_title = 'My Tab Name';
// The following lines of code will install the tab app onto the page.
$install_tab_call = "/{$page_id}/tabs?app_id={$app_id}&access_token={$page_token}";
$facebook->api($install_tab_call,'POST');
// The following lines of code will update the tab app's name on the page.              
$change_tab_call = "/{$page_id}/tabs/app_{$app_id}?custom_name={$tab_title}&access_token={$page_token}";
$facebook->api($change_tab_call,'POST');

因为你使用这些命令来执行你的操作,所以你可以使用任何符合你需求的UI设计,而无需自定义Facebook UI。只需在调用上面脚本的页面上放置您自己的元素。我建议使用AJAX调用。

此外,您还可以在文档中查看可以为页面选项卡操作的所有其他设置:https://developers.facebook.com/docs/reference/api/page/#tabs

请注意,执行任何处理页面设置的操作都需要manage_pages权限